I have created a Connected System that uses OpenAPI. I then created an Integration that uses the OpenAPI CS to call a User Authentication API that returns a service token. That token is then used to authenticate other APIs that are available for the application. Every API must have the token referenced in the header in order to authenticate.
I am trying to create an Expression Rule that can be used as a wrapper to call the User Authentication API and return the token. I would like to use this rule as the Header value when creating additional integrations for the other APIs so that the authentication can occur every time the integration is called. When I test the expression rule, I get an error that reads: "The jsonText parameter must not be null or empty."
Here is a screen shot of the Integration, which works when I manually insert a valid bearer token:
Here is the expression rule that fails:
It seems like the API is not being called because the response is always null. I had to modify the call to the Integration to include the onSuccess and onError parameters. I have tried using those values as well, but they are also null.
I can't understand why the Integration works when I use the Test Request option on the Integration screen, but it does not work when called from an Expression Rule.
Can anyone help me understand how I should configure the Expression Rule for it to work? If so, would you be willing to share an example?
Thanks!
Discussion posts and replies are publicly visible
I suspect that the Integration Object requires a query parameter to be successful otherwise it might just be the expression itself is wrong.
Either way you need to create a rule input in your integration object and reference it in your query parameter. (I added a screenshot of this on your other post)
In your expression you don't need it so complex, the code below should work perfectly.
fromJson( rule!CO_CXP_POST_UserSession_OpenAPI( isActive: 1 /* create a rule input for this parameter */ ).result.body)
Did you configure the token fetching integration to "Queries Data" for "Usage"?
insurityapp0001, Sorry for jumping into the conversation 6 months late. Im adding a response here because I had a similar issue but I cannot be sure the root cause is the same. Do you have mixed casing in the Header name? eg "X-AdobeSign-ClientId" can you try either making the Header name all lower case if that is possible, Else in the WebAPI code, update the Header name you expect to a lower case eg. "x-adobesign-clientid" instead of "X-AdobeSign-ClientId" (which would be the Header name used from Postman/ external client) . It is possible that your issue might have been addressed after a version upgrade by Appian. Please do let us know in either case about how your issue was resolved if it has been.
Thanks,
Pavan