The sugarCRM is hosted on http along with that custom API is expose.
And when we are trying to access the exposed endpoint from different application which is hosted in https.
Does it create a problem ?
The sugarCRM is hosted on http along with that custom API is expose.
And when we are trying to access the exposed endpoint from different application which is hosted in https.
Does it create a problem ?
it should not give a problem, I would recommend to put your Sugar Instance behind a firewall if you still want to leave your instance without an SSL.
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara
The problem is stock API's are working fine. These problem is only for custom API.
can you post it an example of your request here plus URI ?
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara
Below is my URI and and request structure
URI : http://{{URL}}/sugarcrm/rest/v10/Ord_Orders/UpdateOrderMethod
JSON Request :
{ "o_id": "53", "custAccount": "C59" }
Register API Function :
public function registerApiRest() { return array( 'MyGetEndpoint' => array( //request type 'reqType' => 'PUT', //set authentication 'noLoginRequired' => false, //endpoint path 'path' => array('Ord_Orders','UpdateOrderMethod'), //endpoint variables 'pathVars' => array('', ''), //method to call 'method' => 'UpdateOrderMethod', //short help string to be displayed in the help documentation 'shortHelp' => 'updating an order in SugarCRM', //long help to be displayed in the help documentation 'longHelp' => 'custom/modules/Ord_Orders/clients/base/api/help/UpdateOrder.html', ), ); }
Hi Rodrigo Manara
Below is my URI and and request structure
URI : http://{{URL}}/sugarcrm/rest/v10/Ord_Orders/UpdateOrderMethod
JSON Request :
{ "o_id": "53", "custAccount": "C59" }
Register API Function :
public function registerApiRest() { return array( 'MyGetEndpoint' => array( //request type 'reqType' => 'PUT', //set authentication 'noLoginRequired' => false, //endpoint path 'path' => array('Ord_Orders','UpdateOrderMethod'), //endpoint variables 'pathVars' => array('', ''), //method to call 'method' => 'UpdateOrderMethod', //short help string to be displayed in the help documentation 'shortHelp' => 'updating an order in SugarCRM', //long help to be displayed in the help documentation 'longHelp' => 'custom/modules/Ord_Orders/clients/base/api/help/UpdateOrder.html', ), ); }
did you try to test this call on POSTMAN ? copy the php version and test it , check if gives the same error
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara
In Postman it is working in both http and https server.
In both server its working fine sugarCRM hosted server and calling sugarCRM API server also working.
Hi Rodrigo Manara
Can you elaborate what is "Copy the PHP version and test it", Since I am new to sugarCRM.
FYI, The other application is developed in javascript.
the call is made via JS, then you need to ensure you are send via JS the correct parameters.
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara
FYI,i am exposing the API and the request is coming from another server.
the request params which are working in postman has been mirrored in the application and the request reaches sugarCRM then return with invalid_parameter[422:ERROR CODE].
please refer below link which i posted for help regarding the Invalid parameter issue.I was debugging the https would create problem.
(+) Invalid Parameter : Custom Endpoint - Enterprise & Professional Answers & Best Practices - Enterprise & Professional - SugarClub (sugarcrm.com)
it the request is coming from a different server , sure the request paramenters are not sent correctly, or is something wrong on the custom api that is not able to read the resquest.
I did you try to make a call from the server where the request come is in HTTPS and see you are able to do dump the request ?
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara
If my understanding is correct? If My custom API has issues then it will not work in postman, correct? But its working in another server of postman and also for me its working in postman as well as in my CRM application.
Yes i try to do the var_dump in my API. But when the request comes from another server application, it doesn't hit my API page. The CRM application throws 422 error code.
Ok, Rajnikanth BS but I really don't know more how to help you. Hope you find a solution
Rodrigo Manara
Sr. Developer
Hi Rodrigo Manara
Thanks for the valuable information.
But i have one question . Where else can i dump/print the request body and the headers other than my API page. This will help to debug the request and headers coming from another server
You Should use Logs and trace the logs on your sugarcrm.log on your serve
Rodrigo Manara
Sr. Developer