Hi,
I am trying to implement a POST rest service in Aware. The API call works in Postman, but the data is passed as "form-data" instead of the raw body json format that I am used to use.(The option selected in Postman) How do I implement this in Aware as it won't work when I take the username and password from an object that is in context?
Thanks
Francois
Rest API "form-data" as Body Input
Re: Rest API "form-data" as Body Input
Sorry, do not understand
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Rest API "form-data" as Body Input
Hi Jaymer,
Sorry for the confusion. Please have a look at the 2 attachments. Both screenshots from Postman.
In Screenshot1 you will see that the Body data is sent through as form data(x-www-form-urlencoded),which is the correct way to do it for this specific API.
In Screenshot2 you will see that the Body data is sent through in raw JSON format. I have created all my previous POST Rest services in the same manner in Aware, works great because the Input Parm object is in context and in JSON format.
What I want to know. How do I implement the POST with parameters sent as form data(as in Postman-because the API gives me a return,code 200).
If I implement it in the same way as above, taking the Parm Object in Context as input, I get an error, that is in Aware.. Should this rather be used as a string(see screenshot3). None of it is working, or should I pass a HEADER with it?
Sorry for the confusion. Please have a look at the 2 attachments. Both screenshots from Postman.
In Screenshot1 you will see that the Body data is sent through as form data(x-www-form-urlencoded),which is the correct way to do it for this specific API.
In Screenshot2 you will see that the Body data is sent through in raw JSON format. I have created all my previous POST Rest services in the same manner in Aware, works great because the Input Parm object is in context and in JSON format.
What I want to know. How do I implement the POST with parameters sent as form data(as in Postman-because the API gives me a return,code 200).
If I implement it in the same way as above, taking the Parm Object in Context as input, I get an error, that is in Aware.. Should this rather be used as a string(see screenshot3). None of it is working, or should I pass a HEADER with it?
- Attachments
-
- Screenshot3.PNG (30.99 KiB) Viewed 8368 times
-
- Screenshot2.PNG (10.17 KiB) Viewed 8368 times
-
- Screenshot1.PNG (28.68 KiB) Viewed 8368 times
Re: Rest API "form-data" as Body Input
Postman shows the payload,
and I think doing this will send the same JSON string:
and I think doing this will send the same JSON string:
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Rest API "form-data" as Body Input
Hi Jaymer,
Thank you for the reply.
Still no joy. I have attached the API error and also the API Curl command provided by the API company.
And the error attached is the one I get when I do it like you showed in your example above.
I have included the necessary HEADERS in Aware.
According to me it should work.
Kind regards,
Francois
Thank you for the reply.
Still no joy. I have attached the API error and also the API Curl command provided by the API company.
And the error attached is the one I get when I do it like you showed in your example above.
I have included the necessary HEADERS in Aware.
According to me it should work.
Kind regards,
Francois
- Attachments
-
- CurlCommand.PNG (44.23 KiB) Viewed 8352 times
-
- APIError.PNG (13.05 KiB) Viewed 8352 times
Re: Rest API "form-data" as Body Input
Hi Aware_Support,
Any thoughts on this porblem?
Kind regards,
Francois
Any thoughts on this porblem?
Kind regards,
Francois
Re: Rest API "form-data" as Body Input
If this is what curl is sending, then why aren't you doing the same thing:
In the "use this string" field:
username=<<LoggedInRegularUser.LoginName>>&password=<<LoggedInRegularUser.APIPassword>>
In the "use this string" field:
username=<<LoggedInRegularUser.LoginName>>&password=<<LoggedInRegularUser.APIPassword>>
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 7567
- Joined: Sun Apr 24, 2005 12:36 am
- Contact:
Re: Rest API "form-data" as Body Input
If you want us to investigate please pay for a support ticket (we will send you the invoice) and attach a small BSV that demonstrates the issue along with the description of how to reproduce the problem in this BSV
Aware IM Support Team
Re: Rest API "form-data" as Body Input
Hi Jaymer,
Thank you very much, working now. Just wasn't too sure how Aware wants me to send the String through. Also, I had to change the Content type to Text/XML and not JSON.
Thanks for the help.
Kind regards,
Francois
Thank you very much, working now. Just wasn't too sure how Aware wants me to send the String through. Also, I had to change the Content type to Text/XML and not JSON.
Thanks for the help.
Kind regards,
Francois