I was recently given some advise on how I should retrieve a token using the “admin/auth” endpoint.
We were using the simpybook endpoint “user-api.simplybook.cc” to retrieve our bookings. However, the endpoint “user-api.simplybook.cc” does not work when using “admin/auth”.
The endpoint “user-api-v2.simplybook.cc” will allow me to call admin/auth and I get a valid response.
Has the endpoint “user-api.simplybook.cc” been deprecated at some point and we must use “user-api-v2.simplybook.cc” from now on?
No, user-api.simplybook.cc is not deprecated. The two hosts serve two different APIs:
https://user-api.simplybook.cc is the JSON-RPC API, which includes getUserToken and all the methods you use to retrieve bookings. Keep using this host for your existing RPC calls.
https://user-api-v2.simplybook.cc is the REST API. The /admin/auth endpoint exists only on this host, which is why it fails on user-api.
You don’t need to move everything to user-api-v2. Use it only for authentication.
On the header request I am adding “X-Company-Login” with our company login and “X-Token” is the value of the token provided when I call https://user-api-v2.simplybook.cc/admin/auth. I tried both the token and the refresh token but I still get the same response.
Sorry, my earlier reply named the wrong header. For the admin JSON-RPC endpoint (https://user-api.simplybook.cc/admin), the user token must be sent in the X-User-Token header, not X-Token:
X-Company-Login:
X-User-Token: <token from POST /admin/auth>
X-Token is only for the company-level token returned by getToken(companyLogin, apiKey), which is why your request was rejected with “Access denied”.