Jump to content
  • 0
jorgeorbit

IncorrectBodyParameter using GET using REST/PHP

Question

I am getting the response: 

["Code"]=>
string(22) "IncorrectBodyParameter"
["Message"]=>
string(73) "Cannot perform operation because the body parameter is absent or invalid."
 
This is my PHP code:
 
$accesstoken = '___my token___';
$ch = curl_init();
$headr = array();
$headr[] = 'Content-length: 0';
$headr[] = 'accept: application/json';
$headr[] = 'Authorization: bearer '.$accesstoken;
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_POST,true);
//  Initiate curl
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
                $mnxdb_url = "___my url taken from swager__";
curl_setopt($ch, CURLOPT_URL,$mnxdb_url);
// Execute
$result=curl_exec($ch);
// check for error 
if ($result === false)
{
print_r('Curl error: ' . curl_error($ch));
}
// Closing
curl_close($ch);

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @jorgeorbit,

Perhaps you did not follow the correct syntax while specifying the values of the fields.

It would be easier to narrow down the issue if you send a Body of the request and specify datatypes of fields which you use to create a record.

Regards,

vitalikssssss

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Vitalikssssss said:

Thank you for your reply Vitaliks,

This is the request:

https://medinexo.caspio.com/rest/v2/tables/MNX_Currencies/records?q.select=Currency_Name%2CCurrency_Alphabetic_Code%2CCurrency_Numeric_Code%2CCurrency_USD_Exchange%2C

In swager the response body looks like this:

{
  "Result": [
    {
      "Currency_Name": "Afghani",
      "Currency_Alphabetic_Code": "AFN",
      "Currency_Numeric_Code": 971,
      "Currency_USD_Exchange": 77.8389
    },
    {
      "Currency_Name": "Lek",
      "Currency_Alphabetic_Code": "ALL",
      "Currency_Numeric_Code": 8,
      "Currency_USD_Exchange": null
    },

 

2 hours ago, Vitalikssssss said:

https:// cify datatypes of fields which you use to create a recor

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...