Solved

API login syntax - Error returned, what am I missing?

  • 30 November 2021
  • 4 replies
  • 112 views

Hello all!

I’m in a company that have worked in GoodData platform for a few months now, and to prepare our switching to the Growth plan (we are in free plan from now), I was trying to make the API calls work with a local software : Postman.


Yet, despite the detailed documentation about APIs I found here : https://help.gooddata.com/doc/enterprise/en/expand-your-gooddata-platform/api-reference#section/Use-Cases, I was not able to even log in with Postman. I suppose something is missing, I receive an answer 400 - Bad request, but I’m not understanding what. Does somebody has an idea? Thanks in advance, I’ll help me a lot understanding what are the basics of the GoodData API I’m missing!

 

NB : I’m precising that I’m the administrator of the Free Domain

 

What I’m trying to call :

Method : POST

URL : https://<my_company_domain>.on.gooddata.com/gdc/account/login

Headers :

   - Content-Type = application/json

   - Accept = application/json

   - User-Agent = PostmanRuntime-Login/7.28.0

Body :

{
    "postUserLogin": {
        "login""<my_mail_adress>",
        "password""<my_password>",
        "remember""0",
        "verify_level"0
    }
}

 

Thanks for your help!

 

NB : the exact error message answered :

{
    "error": {
        "errorClass""BadRequestHttpException",
        "trace""",
        "message""The request could not be understood by the server due to malformed syntax.",
        "component""auth-service",
        "errorId""<error_id_code>",
        "errorCode""gdc.http.client.status.400",
        "parameters": []
    }
}

 

icon

Best answer by Moises Morales 30 November 2021, 10:30

View original

4 replies

Userlevel 2

Hi Quentin, 

 

This error usually indicates that the code in your body request is incorrect. Can you please make sure you are not missing any brackets and avoid any formatting between the double quotes for the value in “login” and “password”?

 

If the request is not successful again, please send over here the error_id so we can look further into it. 

 

Best regards,

 

-Moises

Hello,

Thanks for your answer! I’ve checked the number of brackets, they are correct, and except the “@” of the mail adress, there is neither space or special character in the login string. Still it doesn’t work.

 

I’ve received the following error_id when I tried again :

046b259b-2523-43d0-8343-1e3a1a83a6fc
 
Best regards
Userlevel 2

I can see your request is failing with this error: 

[ERROR - A request body is required but none found.: []]

 

Can you please make sure it looks as follow (you must use your own domain): 

 

 

Thanks. 

 

-Moises

Ok it works, thanks for your help! I compared the number of headers, and my error was coming from that.

 

For the rest of the community who may face the same issue : An additional header is required for the query to work :

   - Content-Length = <number_of_characters in your body (integer)>

   - Host = <autogenerated by Postman> : it was necessary to make the API understand that the login was expected on the domain sent in the URL

 

Thanks!

Reply