Skip to main content
marcot0005
January 6, 2022
Solved

Data not showing up externally in a webAPI

  • January 6, 2022
  • 8 replies
  • 0 views

I've got a sort of weird problem that I can't figure out. I have a webAPI built that kicks off a process model for creating new users. When I test it within Appian, I get a JSON response with all the info about the process model.

{ "pp" : { "id" : 268442112, "name" : "Create User Bob Newman", "priority" : 1, "initiator" : { "id" : "******" }, "startTime" : "2022-01-06T18:04:14.980Z", "timeZone" : "US/Eastern", "starred" : false, "parentName" : "", "execId" : 1, "status" : 0 }, "pm" : { "id" : 5238, "uuid" : "0005e780-67c2-8000-2559-7f0000014e7a", "name" : "PP Web API User Generation", "description" : "Create a new user with a web API", "version" : "16.0", "creator" : { "id" : "*****" }, "timeZone" : "US/Eastern", "starred" : false, "parentName" : "" }, "pv" : { "GroupsLIstDS" : { "id" : "0aeb9200-355f-4ff1-9741-7b2ef4459c2a@35138" }, "email" : "bob.newman@example.com", "firstName" : "Bob", "lastName" : "Newman", "newuser" : null, "successCode" : "207", "username" : "Bob Newman" } }

However when I access the same API externally, I get an empty JSON response that looks like this: 

{
    "pp": {
        "id"268442123,
        "name""",
        "initiator": {
            "id"""
        },
        "timeZone""",
        "starred"false,
        "parentName"""
    },
    "pm": {
        "uuid""",
        "name""",
        "description""",
        "version""",
        "creator": {
            "id"""
        },
        "timeZone""",
        "starred"false,
        "parentName"""
    },
    "pv": {}
}
The process model otherwise runs as it should. The only difference being that internally it gives info, and externally it doesn't. Can anyone help me figure out why this is? 
Best answer by selvakumark
I've tried all levels of security for the service account, and that doesn't seem to change anything. 

Hi Marco,

I could reproduce this issue only when the service account used for authentication has Initiator access over the process model. If I changed the security to Viewer, I was able to see the process info.

But since you've tested it already, we could try calling the API in postman using the basic authentication of your admin account. In this way, we can check whether the issue is with the service account/security or not.

8 replies

stefanhelzle0001
Brainy
January 7, 2022

When calling from external, the JSON looks wrong. Could it be that the user does not have proper permissions? In the API, what do you return in the onError part of the startProcess?

marcot0005
January 7, 2022

On error it returns the standard "There was an error starting the process" message.

The process model is running and does everything it needs to do without giving any errors. I can see it completes properly. It just doesn't spit back any info at the end and then only specifically when connecting externally. I've tried all levels of security for the service account, and that doesn't seem to change anything. 

stefanhelzle0001
Brainy
January 7, 2022

Sorry, no good ideas here ...

You did save&publish, not just save?

Chaining is enabled?

A node that creates users must be run as a sys admin user. Permissions?

January 9, 2022

If I understood correctly, you are looking for capturing response at external system when API gets called.

If yes, you can do it by using onSuccess attribute of start process SS.

e.g: 

onSuccess: a!httpResponse(
statusCode: 200,
body: a!toJson(
{
response: 
index(fv!processInfo, "pp", {})
}
)
)

marcot0005
January 10, 2022

That's exactly what I am doing (well, returning all of fv!process info, not just the pp section), but the response data is all empty. And even then only when I access it from an external source. If I test it within appian, all the data is there (as shown in the first section) but externally the data is missing (as the second section).