[#780] Im always getting 404 using REST API

Migrated from Redmine #780 | Author: CAS Log
Status: New | Priority: High, I’m very impatient | Created: 2021-09-10


Hello everyone! Been using simplybook.me for more than a year and we love it. We just started using the API.

Here is my problem:
I am using google scripts apps to use the REST API
I can get the token without problem

But then if i make any request i get an 404 html page

If i make the same request with a wrong token on porpouse i get the correct response stating that im not authorised

For example im calling https://user-api-v2.simplybook.me/admin/calendar-notes
with this parameters

var datacall = {
“provider_id”: 2,
“service_id”: null,
“start_date_time”: “2020-09-06 15:00:00”,
“end_date_time”: “2020-09-06 15:30:00”,
“note_type_id”: “1”,
“note”: “note body”,
“mode”: “provider”,
“time_blocked”: true
};

var payload = JSON.stringify(datacall);

var headers = {

"accept": "application/json" ,
"X-Company-Login": simplyLogin ,
"X-Token": tokenEntity.token
};

var options = {
“contentType”: “application/json”,
“method”: “post”,
“payload”: payload,
“headers”: headers,
};

var response = UrlFetchApp.fetch(“https://user-api-v2.simplybook.me/admin/calendar-notes”, options);

What am i doing wrong??

Thanks everyone!

CAS Log wrote:

I found the error just after i posted. In case it helps anyone here is my mistake

for the x-company-login i was using the user login instead of the company loging . Once i used the componay login it worked

CAS Log wrote:

Hello everyone! Been using simplybook.me for more than a year and we love it. We just started using the API.

Here is my problem:
I am using google scripts apps to use the REST API
I can get the token without problem

But then if i make any request i get an 404 html page

If i make the same request with a wrong token on porpouse i get the correct response stating that im not authorised

For example im calling https://user-api-v2.simplybook.me/admin/calendar-notes
with this parameters

var datacall = {
“provider_id”: 2,
“service_id”: null,
“start_date_time”: “2020-09-06 15:00:00”,
“end_date_time”: “2020-09-06 15:30:00”,
“note_type_id”: “1”,
“note”: “note body”,
“mode”: “provider”,
“time_blocked”: true
};

var payload = JSON.stringify(datacall);

var headers = {

"accept": "application/json" ,
"X-Company-Login": simplyLogin ,
"X-Token": tokenEntity.token
};

var options = {
“contentType”: “application/json”,
“method”: “post”,
“payload”: payload,
“headers”: headers,
};

var response = UrlFetchApp.fetch(“https://user-api-v2.simplybook.me/admin/calendar-notes”, options);

What am i doing wrong??

Thanks everyone!