[#772] API Authentication failed - Please advise

Migrated from Redmine #772 | Author: Rahim Ali
Status: New | Priority: High, I’m very impatient | Created: 2021-08-30


Support,

I am trying to get the token using following auth end point but getting error : Invalid type given

https://user-api-v2.simplybook.me/admin/auth

Even tried with end point(.plus domain) but no luck : https://user-api-v2.simplybook.plus/admin/auth

{“code”:400,“message”:“”,“data”:{“company”:[“Invalid type given, value should be float, string, or integer”],“login”:[“Invalid type given, value should be float, string, or integer”],“password”:[“Invalid type given, value should be float, string, or integer”]},“message_data”:}

I am attaching my postman collection as well for your review.

Redmine Admin wrote:

hi, it seems your http request is wrong, please provide raw http request

Rahim Ali wrote:

Here is the raw request

{
“company”: “aseast”,
“login”: “rahim.ali@mrm.com”,
“password”: “12345Op”
}

Redmine Admin wrote:

this doesent look like raw http request, please provide it in curl or any other common format

Rahim Ali wrote:

Here you go, i pull this from the Postman console of my collection

POST https://user-api-v2.simplybook.plus/admin/auth

POST /admin/auth HTTP/1.1
Content-Type: application/json
User-Agent: PostmanRuntime/7.28.4
Accept: /
Postman-Token: 8ad5f6d7-6096-4d0c-b05b-1db64b331b31
Host: user-api-v2.simplybook.plus
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 82

{
“company”: “aseast”,
“login”: “rahim.ali@mrm.com”,
“password”: “12345Op”
}

HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 30 Aug 2021 21:00:40 GMT
Content-Type: application/json
Content-Length: 78
Connection: keep-alive
Keep-Alive: timeout=20
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, PUT, DELETE, GET, OPTIONS
Access-Control-Allow-Headers: content-type, x-company-login, x-token, x-requested-with

{“code”:400,“message”:“Invalid login or password”,“data”:,“message_data”:}

Nicholas Alias wrote:

Please use the correct login and password for your company “aseast”

Rahim Ali wrote:

These are credentials which i am using to login to portal - https://altardstate.cluster.simplybook.plus/
Do we need a separate credential to make the Rest API call? if so where we can get new credentials?

Redmine Admin wrote:

you need to use your account name, its user login and password

Rahim Ali wrote:

Where i could find those credentials

Redmine Admin wrote:

you need to contact your cluster admin or account admin to get it.

Rahim Ali wrote:

Thanks for the response i was able to get the credentials from cluster admin and my auth end point is working now

I am trying to pull the all upcoming booking using end point - https://user-api-v2.simplybook.plus/admin/bookings?filter[upcoming_only]=1 but it is returning 0 booking but i can see the future booking under account: “aseast”, please advise

Here is complete request/response log

GET https://user-api-v2.simplybook.plus/admin/bookings?filter[upcoming_only]=1
200
30 ms
GET /admin/bookings?filter[upcoming_only]=1 HTTP/1.1
Content-Type: application/json
X-Company-Login: admin
X-Token: 26198b5733b9f3c459606c691a0ea3e32be9857cdfd59e7c5ae6c522c1c25d8d
User-Agent: PostmanRuntime/7.28.4
Accept: /
Postman-Token: 0d251bbc-4ab1-48ad-b2a1-de7b482ed1e9
Host: user-api-v2.simplybook.plus
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 31 Aug 2021 13:46:30 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=20
X-XSS-Protection: 1; mode=block

Redmine Admin wrote:

X-Company-Login: aseast

you need to use aseast as compoany login

Rahim Ali wrote:

Thanks for the feedback i am able to pull the data. one more question

Can we have one main account to access all the companies and return all the bookings under those companies?

Redmine Admin wrote:

it is possible to get access to all cluster accounts via cluster interface, please check this ticket Bug #749: Cluster account to get API key for individual company in company list using API - API - Simplybook.me support for developers

Rahim Ali wrote:

Thanks for the details

Do we have documentation link for cluster api. I don’t have key so will go with credentials, What kind of credentials needed for cluster API call?

We have following scenario. We have 6 companies in our account and we need the upcoming Booking of 4 companying, what is recommended way to get the upcoming bookings?

Another question, I have fetched few appointment objects through the rest api, is thee a way to get/generate hash like you are generating in the email for Example - Altar'd State | Scheduling and Booking Website

Redmine Admin wrote:

you need to call each account separately to get bookings

there is no API to make such link

Nicholas Alias wrote:

here you can generate api key

Nicholas Alias wrote:

https://altardstate.cluster.simplybook.plus/#/api

Rahim Ali wrote:

Thanks for the feedback.

On the 2nd question, i am already connected to specific company account.Let add some more details.

When a user made a booking he/she got an email and in email details - links have some hash key in it. for example

is three a way to get the same hash key through the rest api?

Redmine Admin wrote:

there is no API to get such links/hash