cancel
Showing results for 
Search instead for 
Did you mean: 

Webservices with to request API

Mani
Level 4
Hi Team,

I am facing an issue with the request to API, i.e., I am taking a job from the server and inside the job having multiple sub jobs.
Initially we used to work with a job (inside with a single job), while mapping the variables it is directly mapped with template of JSON code request using API's in webservices. 
But now I am having a job from the server and inside the job having multiple sub jobs as mentioned in first line. So multiple jobs with in Main job is not known to us, when the process is running automatically.
If not known to us how many fields to be sent in request using POST API. The variables mapping is making me an issue. Here dynamically we are creating POST API, I am mapping the variables in the process.
Now multiple variables need to be mapped which is unknown to us while running the process automatically.

Please can any one give me a resolution or an idea for proceeding further in my development.
Thanks in Advance.

Mani K.

------------------------------
Mani K
------------------------------
1 BEST ANSWER

Helpful Answers

Hi Mani,

From the process you can dynamically create a JSON body string as per the business logic and pass that to the desired action of your WebAPI definition. So the action in the WebAPI won't have multiple parameters and instead it will be a single JSON string that you can pass to your body content for the POST request.
Alternatively you can use code stages inside WebAPI to form the request body dynamically based on the inputs.

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

View answer in original post

3 REPLIES 3

Hi Mani,

From the process you can dynamically create a JSON body string as per the business logic and pass that to the desired action of your WebAPI definition. So the action in the WebAPI won't have multiple parameters and instead it will be a single JSON string that you can pass to your body content for the POST request.
Alternatively you can use code stages inside WebAPI to form the request body dynamically based on the inputs.

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

Hi Shashank Kumar,

Thanks for your reply, that was really helpful.
I am trying to use code stage inside WEBAPI to form the request body . Can you please point me to a example.
I know C# well and can create a JSON string but the moment  I try to return it it throw error.
The error reads as follows
"Compilation failed: Action "GenerateRequestContent Post" (line 1): Character is not valid."

Thanks Advance.


------------------------------
Mani K
------------------------------

Hi Mani,

Have a look at the Connector for Microsoft Graph API - Outlook available on DX. See in the Common Code area and Create Message action.

https://digitalexchange.blueprism.com/dx/entry/3439/solution/microsoft-graph-api---outlook

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------