You can translate the question and the replies:

Querying a Rest API through post request with application/x-www-form-urlencoded content-type

Hello, I need to connect to a REST API whit a POST requests which returns a json file. In this Post request, I need to put in the body, that must be an application/x-www-form-urlencoded content-type, two parameters. So I created a Json data source connector, I set HTTP client as Data Route, and I set POST as http method and fill the field URL with the good URL. But there is not the choice application/x-www-form-urlencoded as content type for the post body... How can I parameterize it in order to have the good content type? Thanks in advance for your consideration.
user
04-05-2021 10:49:42 -0400
code

3 Answers

Hi, In JSON data source, to add a content type I would click on the *HTTP headers* > *New* > add the name as "Content-Type" and value as "application/x-www-form-urlencoded". The available *Content-Type* dropdown would define the type of content entered in the post body of POST,PUT,PATCH request. For parameterization, I would make use of interpolation variables to add parameters in URL, HTTP headers and Post body. These variables would allow you to retrieve the values for variables to be passed at run time. You could refer to the section [HTTP Path](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/path_types_in_virtual_dataport/http_path#http-path) for more information. Hope this helps.
Denodo Team
05-05-2021 05:58:16 -0400
code
Hello, Thanks for your answer it works perfectly ! But now I am facing another issue... This request returns a JSON body that is empty, and the important information of the response is in the headers. Indeed, a session cookie is returned in the headers of the response. Is there any way to retrieve this cookie from the headers ? Thanks in advance for your answer.
user
 Edited on: 21-06-2021 03:44:39 -0400
Hi, I am glad that you were able to add the content type successfully. For your question related to session cookie, refer to the answer provided in a similar community question [Retrieve header from http client request](https://community.denodo.com/answers/question/details?questionId=9064u000000L8GjAAK&title=Retieve+header+from+http+client+request). Hope this helps.
Denodo Team
20-05-2021 08:42:33 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here