Posted: Thu Apr 02, 2020 1:35 am Post subject: contect-type application/x-www-form-urlencoded
Master
Joined: 05 Dec 2007 Posts: 296
Hi Kindly help. I need to call a rest service with content type application/x-www-form-urlencoded. Is it supported by IIB 10. According to trace the data still goes out as Json and not parsed as application/x-www-form-urlencoded"
I need to send these parameters
Code:
SET OutputRoot.HTTPRequestHeader."Content-Type"= 'application/x-www-form-urlencoded';
SET OutputRoot.JSON.Data.grant_type='password';
SET OutputRoot.JSON.Data.client_id='111';
SET OutputRoot.JSON.Data.client_secret='343434';
SET OutputRoot.JSON.Data.BANK_ID='hhh';
SET OutputRoot.JSON.Data.username='user';
SET OutputRoot.JSON.Data.password='pwd';
Kindly help, I am not sure how to handle this. [/code]
If you use JSON Domain, the content type will be overridden to Application/json though your requirement is not quite clear, if you intend to post a valid JSON with content type as application/x-www-form-urlencoded you can add the lines below to your code.
Code:
DECLARE TempBlob BLOB;
SET TempBlob = ASBITSTREAM(OutputRoot.JSON);
SET OutputRoot.JSON = NULL;
SET OutputRoot.BLOB.BLOB = TempBlob;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum