cancel
Showing results for 
Search instead for 
Did you mean: 

API capture POST/PUT content

JensDeveloper
Contributor II

Hi,

I was wondering how to capture the content of a PUT/POST call to update/insert the data into a database.

I know how to capture the URL through pipeline paramters (PATH_INFO) to make all my GET requests working but now I’m trying to find a way to capture the content of the PUT/POSt method.

I have searched for pipeline parameters but only found QUERY_STRING and it doesn’t capture the content.

Anyone knows a solution to this?

Regards

Jens

1 ACCEPTED SOLUTION

Supratim
Contributor III

Hi @JensDeveloper,
It can be achieved in two ways-

  1. You can use a unlinked (no input/open input) mapper as you first snap. (Hope you are sending json data only. )
    Then whatever payload you are sending from client it can be accessible in mapper. Let say you are sending a payload like- [{“name”:“Supratim”,“lname”:“Das”},{“name”:“Supratim2”,“lname”:“Das”}] , you will get response like [{“name”:“Supratim”},{“name”:“Supratim2”}]. Please refer below two pics.
    One more important thing when you use open mapper then you need to pass Content-Type as “application/json” from HTTP header.

In Pipeline-
image

Response from postman
image

  1. Rather having open mapper view, you can use JSON parser (If you are sending JSON, Incase of XML you have to start with unlinked XML parser.) then rest of the part remain same. In this you can ignore to pass Content-Type from header. This option we can choose where we are using json schema to validate any complex json payload before processing.

For both the case, if you want to capture entire payload, you can use “$” instead of $name.

image

View solution in original post

2 REPLIES 2

Supratim
Contributor III

Hi @JensDeveloper,
It can be achieved in two ways-

  1. You can use a unlinked (no input/open input) mapper as you first snap. (Hope you are sending json data only. )
    Then whatever payload you are sending from client it can be accessible in mapper. Let say you are sending a payload like- [{“name”:“Supratim”,“lname”:“Das”},{“name”:“Supratim2”,“lname”:“Das”}] , you will get response like [{“name”:“Supratim”},{“name”:“Supratim2”}]. Please refer below two pics.
    One more important thing when you use open mapper then you need to pass Content-Type as “application/json” from HTTP header.

In Pipeline-
image

Response from postman
image

  1. Rather having open mapper view, you can use JSON parser (If you are sending JSON, Incase of XML you have to start with unlinked XML parser.) then rest of the part remain same. In this you can ignore to pass Content-Type from header. This option we can choose where we are using json schema to validate any complex json payload before processing.

For both the case, if you want to capture entire payload, you can use “$” instead of $name.

image

Thanks a lot, this will help me immense. Now I understand it.

Regards Jens