Jump to content
  • 0

IncorrectBodyParameter using GET using REST/PHP


jorgeorbit

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);
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 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

 

Link to comment
Share on other sites

  • 0

Hi - Just want to share, I encountered the same issue but in my case, it is working in Swagger, I was able to return records but when I used the URL on my third-party application, I get the 'IncorrectBodyParameter' error message and I just realized that I am copying the 'CURL' URL instead of the 'Request' URL. When I used the Request URL, it worked. 

This article might also help - https://howto.caspio.com/web-services-api/rest-api/error-handling/

Link to comment
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...