cancel
Showing results for 
Search instead for 
Did you mean: 

JSON data from BP to external API

AnuraagPandey
Level 4
Hello, 
I am testing few functionality, but I am stuck and would really appreciate help.

I have sample data, in JSON format, 
Now I want to send this (POST) to an external API. I am currently using Utility JSON - Post JSON, with some basic input details - URL,  username, password, and JSON (this is the data item). The process runs through with no error.
But the data was not sent successfully, almost as if the API call never happened. I am not sure if I am missing something.
I welcome any suggestions, or a different approach to achieve this task.

Regards
Anuraag

------------------------------
Anuraag Pandey
------------------------------
5 REPLIES 5

ewilson
Staff
Staff
Hi @AnuraagPandey,

What version of Blue Prism are you using? When you say you're using the Post JSON action are you referring to the action available on the Utility - HTTP VBO? There's no Post JSON action available on the Utility - JSON VBO, unless you're using a customized version.

If you are using the Utility - HTTP VBO, does it return data items for Status Code, Result Headers, and Result?

Cheers,



------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

ritansh.jatwani
Level 9

Hi @AnuraagPandey,

Have you tested the API in Postman?

Instead of directly integrating with Blue Prism, you can first test the functionality using Postman and once you get successful results, it can be easily integrated with Blue Prism​



------------------------------
Ritansh Jatwani Senior Consultant
Consultant
EY
Gurgaon
*If you find this post helpful mark it as best answer
------------------------------

Hi Eric, you were right I am using Utility - HTTP VBO, and no the return data items were unchanged/unaffected.

I found a workaround for this though. I am now using a python script to send the json to this said API, and I am calling the script via blue prism as one of the action stages. 
----------------------------------------------------------------------------------------------------------------
I still have one issue though, I want to receive a csv file as part of the GET calls that I am making to this API. 
It works when I use POSTMAN to test if the API actually works, and it does. 

So, now my question is there some setting that I need to make one configuring the webservice inside the "SYSTEM" > "WEB API SERVICES" > there are few options like "responses", should I somehow tell blue prism that I am expecting a file?
I know "binary" data type is normally used for files, but I am not too sure how to use it here. 

21022.pngKind Regards

------------------------------
Anuraag Pandey
------------------------------

Hi Ritansh,
I appreciate your reply here, yes I tested using POSTMAN. 😄 

I have found the solution though. Using a python script. 
But there is another way, FYI. 🙂 

While setting up the web service,
we define a few things, like -
parameters, fields that we are sending(column header in a database table, for example: Name, Place, etc. )
requests,
method: POST
body content: Template (and then paste the template of the JSON that the API demands.)
headers:   Content-Type   :    application/json

And then we can use an action stage to call the webservice and call the method "POST".
This works for me.

Regards

------------------------------
Anuraag Pandey
------------------------------

Hi @AnuraagPandey,

Downloading a file using the Web API feature can be tricky as it's limited to text-only files. If your CSV is just text, nothing binary to it, then it will be found in the Response Content data item. If there is binary content to the file then it will likely be corrupted due to the way the feature handles the response from the web call.

There is a HTTP Request File action on the ​Utility - HTTP VBO which should work well for you.

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------