Search code examples
postpostman

Postman API Invalid Credentials


I am trying to figure out how to do an API call to a site called Ongage using Postman with the POST method.

Basically, it's an API call that will send out a transactional message from Ongage.

Per the available link here: https://ongage.atlassian.net/wiki/spaces/HELP/pages/947486763/Transactional+Mailing+API+Methods#TransactionalMailingAPIMethods-POST/api/transactional

Under the section that reads "POST /api/transactional", I have to use the following:

POST URL: https://api.ongage.net/<list_id>/api/transactional

So in Postman, I used POST and entered the URL above with a list_id I was provided, but I am getting back the below message:

{
"metadata": {
    "error": true
},
"payload": {
    "code": 401,
    "errors": [],
    "message": "Invalid Credentials. Please provide valid x_username, x_password and x_account_code 
    headers. x_account_code as displayed in the \"Account Profile\" page in your Ongage account."
  }
}

I used Postman before for simple API requests, but none where I have to enter username and password.

I'm not sure where I should enter it.

I was able to click on Body, and then I clicked raw so that I could enter JSON values for the username, password, and account_code, like this:

{
  "username": "username1",
  "password": "password2",
  "account_code": "account_code3"
}

But I am still getting the same message as before, stating Invalid Credentials.

Are the credentials just invalid, or am I doing this wrong?

Here is a screenshot of how I set the headers:

enter image description here


Solution

  • This is covered in the FAQ

    https://ongage.atlassian.net/wiki/spaces/HELP/pages/70418454/API+FAQ

    *2. These are the credentials you'll need to send in the request header:

    X_USERNAME: your_ongage_username

    X_PASSWORD: your_ongage_password

    X_ACCOUNT_CODE: your_ongage_account_code*