Getting rest API error

I will do local setup of sugar crm when i run the URL i am getting rest API error. i will set .htaccess and config file.

http://localhost/sugar_2021/rest/v11_13/oauth2/token?platform=base

{"error":"no_method","error_message":"Could not find a route with 2 elements"}

  • did you check the php logs of your local server? This should clearly state why that 500 error is thrown. 

  • There is nothing in Sugar log file

  • And the PHP  log file? That is where these kind of errors are logged 

  • as per this image here, I believe you're using our docker container to execute your local dev environment correct? if so, make sure all your containers are up and in the same network, you should have them all in a composer, they are totally dependent and will fail if any of those guys are down.

    Rafael Fernandes

    Staff Developer Advocate | SugarCRM

  • It looks like you are trying to get an oauth2 token with a GET request.

    oauth2 is a POST request with a request body with five parameters, so you have to specify a body:

    POST <your_path_to_sugar>/rest/v11_13/oauth2/token BODY

    {
      "grant_type": "password",
      "client_id": "...",
      "client_secret": "",
      "username": "....",
      "password": "....",
      "platform": "...."
    }