Invalid Parameter : Custom Endpoint

I am new to sugarCRM
I had created a custom module(source IP) called order and its working fine. And I had created a custom API for the order module and I exposed that endpoint to different application in different server. The API was tested using Postman and was working fine. Whenever application (destination ip) hits order API in sugarCRM.,SugarCRM is throwing invalid parameter(error code 422) .
Below is the response
{"error":"invalid_parameter","error_message":"A parameter in your request was invalid." }
Version used is 10.3 (Enterprise)

How to solve this problem ?

Parents
  • If your call works in Postman but not from your other server I would check whether you are passing authentication correctly.

    Are you using curl and passing your OAuth token as a parameter instead of adding it to the header?

    curl_setopt($curl_request, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "oauth-token: {$oauthtoken}"))

  • Hi Francesca Shiekh,

    Thank you for the reply.

    Curl isn't used to call API. Javascript is used to call API in the other server. Below is the procedure used to call the API 
    All the sugarCRM inbuilt stock API's are working properly. with the other server. Only custom module's API is not working.

    Once the access token is generated from below url :  
    http://{​​​​​​​​{​​​​​​​​URL}​​​​​​​​}​​​​​​​​/sugarcrm/rest/v10/oauth2/token   (token is generated from this url)


    will be passed in the headers as Bearer token to update orderAPI
    http://{​​​​​​​​{​​​​​​​​URL}​​​​​​​​}​​​​​​​​/sugarcrm/rest/v10/Ord_Orders/UpdateOrderMethod


    <propertyMap>
    <property>
    <name>Request-Line</name>
    <value>PUT /sugarcrm/rest/v10/Ord_Orders/UpdateOrderMethod HTTP/1.1</value>
    </property>
    <property>
    <name>Cookie</name>
    <value>PHPSESSID=6b1c70d0-6571-4969-b613-6697b2a2311a; download_token_custom=d6794d5a-e532-44f8-b655-15efcb2b893e</value>
    </property>
    <property>
    <name>Cookie</name>
    <value>PHPSESSID=lncpj8nrnjqdutfuh205vao8rr; path=/</value>
    </property>
    <property>
    <name>Authorization</name>
    <value>Bearer 6b1c70d0-6571-4969-b613-6697b2a2311a</value>
    </property>
    <property>
    <name>Accept</name>
    <value>*/*</value>
    </property>
    <property>
    <name>Host</name>
    <value>{{Value is been added has IP}}</value>
    </property>
    <property>
    <name>Content-Type</name>
    <value>application/json; charset=ISO-8859-1</value>
    </property>
    </propertyMap>

  • Sorry ,

    I can't see what the problem is other that v10 being superseded by rest v11 in more recent versions, but I don't see why that would break it. Maybe André will have more insight for you.

Reply Children