HTTPS request for endpoint

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 ?

Parents
  • 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

    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

    Below is my URI and and request structure

    URI : http://{{URL}}/sugarcrm/rest/v10/Ord_Orders/UpdateOrderMethod

    JSON Request :

    Fullscreen
    1
    2
    3
    4
    {
    "o_id": "53",
    "custAccount": "C59"
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Register API Function :

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    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',
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 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

    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

    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. 

    Screenshot-2021-06-09-at-15-32-31 hosted at ImgBB

    ImgBB
    Image Screenshot-2021-06-09-at-15-32-31 hosted on ImgBB
     

    Rodrigo Manara

    Sr. Developer

  • Hi 

    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

    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,   but I really don't know more how to help you. Hope you find a solution

    Rodrigo Manara

    Sr. Developer

Reply Children