0

I am trying to access some data using "customer-api" for an XTRF server but I get below:

"status":401,"
errorMessage":"You are not authenticated or given credentials are incorrect, please re authenticate.",
"detailedMessage":null

I do have a token to access data through home-api for the same XTRF server. I access customer-api with the same token and got the error.

I used "curl" to access data as below:

curl -X GET -H "X-AUTH-ACCESS-TOKEN: MYTOKEN" "https://SERVER_ADDRESS/customer-api/quotes/5558"

I get the error message once I run the command above.

Anshu
  • 1,277
  • 2
  • 13
  • 28

1 Answers1

0

There's a different token for Customer API as it is meant for different kind of user.

There are few ways to obtain token for Customer API:

  • Using login and password To get login and password go to Client profile in Home Portal, go to "Main data" and then "System Accounts". From here you can send welcome e-mail then set-up the account for it. (You can also choose "Sign in as this Partner" and by using developer console in your browser extract JSESSIONID - that's the token).

Once you have an account, you can do the following request to obtain token:

POST /system/login HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Type: application/json
{
 "username": "my login",
 "password": "my password"
}
  • Using token from Home Portal On Home Portal API you can use POST /customers/persons/accessToken with the following body:
{
  "loginOrEmail": "personLogin"
}

to obtain pre-auth token for customer contact person. Then by doing

POST /system/loginWithToken HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Type: application/json
{
 "accessToken": "qwertyuiop"
}

on the Customer API you can obtain actual JSESSIONID that you can use as a token for Customer API requests.

netsatan
  • 1
  • 2