Posted: Mon Jan 20, 2020 12:38 am Post subject: Access POST parameters in compute node
Newbie
Joined: 20 Jan 2020 Posts: 3
Hello
I'm quite new to IBM IIB and I'm trying to develop a REST service that can be consumed by other services. I have done most of the work but my question is on the compute node. I am able to access values that I pass to the service using GET with the code below
Code:
SET myValue = InputLocalEnvironment.REST.Input.Parameters.myValue;
What I want to know is how can I access values that I send to the service using HTTP POST. I tried with the same code above but it does not work
That does not answer my question. There are multiple ways to pass POST parameters.
Code:
Content-Type: application/x-www-form-urlencoded
That does answer the question, though. You are sending the parameters as x-www-form-urlencoded.
IIB does not automatically decode x-www-form-urlencoded params. You should proceed as follows:
- Insert a Trace node immediately after the HTTP node
- Set the Pattern property of the Trace node to ${Root}
- Put a message through the flow, then look carefully at the tree structure in the Trace node output.
- Write ESQL to extract the parameters from the incoming message.
Thanks, I put a trace node and realised that content type of application/x-www-form-urlencoded was being passed as a BLOB. I just had to cast the blob back to a string and now I can read the parameters
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