Jump to content

How to get the "Raw json input" data in BODY from POST/PUT API Client


wissam_dk

Recommended Posts

Hi 

I am using ARC/Postman to configure 2 endpoints for both Prestashop 1.6 & 1.7:

1) getConfig (Working):

    - GET url is: 

    

http://localhost/prestashop1.6/module/wissam/getconfig?private_key=PRIVATE_KEY&key=PUBLIC_KEY

 

    and it returns a json object which i have decode into array object in my php code.

2) setConfig:

    - POST url is:

    

http://localhost/prestashop1.6/module/wissam/setconfig?private_key=PRIVATE_KEY&key=PUBLIC_KEY

 

    and BODY is Raw input where it contain json object with edited values.

    But I cannot find  a way in my php code to read the BODY json data into a  variable.

    

   

Is there a call function in Prestashop to get value of RAW body data like for example:

Tools::getValue($key);

Like we do in Wordpress:

$request = new WP_REST_Request( 'POST', '/setconfig' );

$body = $request->get_body();

 

prestashop-wissam-set-api.png

prestashop-wissam-get-api.png

Edited by wissam_dk (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...