[#632] API

Migrated from Redmine #632 | Author: Ed Horrocks
Status: Feedback | Priority: High, I’m very impatient | Created: 2020-12-30


Hi
Can the API be called from client side technologies eg. javascript / jQuery or
do you have to use server side stuff like PHP or Java

Dmytro Bondarev wrote:

You can call it from client side, but you have to keep credentials in secure place.

Ed Horrocks wrote:

Hi Dmitry
Do you have a client side code snippet for this to get me started please

Ed

Dmytro Bondarev wrote:

In case you are using JSON RPC, then please look here API documentation | SimplyBook.me Online Scheduling
And we do not have such explorer for REST API at this moment.

Ed Horrocks wrote:

Is that using .net ?

I’m using javascript / jQuery

Do I have an alternative. PHP on the server side3

Redmine Admin wrote:

you can use whatever you like and need

Ed Horrocks wrote:

testing: function () {
var dat = {},j;

        dat.login = "edmund.horrocks@bthft.nhs.uk";
        dat.password = "testpassword";
		dat.company = "bradfordroyalinfirmary";

			//Content-Type: application/json
        $.ajax({
            dataType: "application/json",
            type: "POST",
            data: dat,
            url: "https://user-api-v2.simplybook.me/admin/auth",
            success: function (data) {
                window.console.data;

            },
            error: function (jqXHR, textStatus, errorThrown) {
                window.console(textStatus);
            }
        });



},

=============
This fairly simple jQuery function fails returning a code:400 ‘company’ invalid type etc
I’ve tried vanilla javascript as well and that fails

Dmytro Bondarev wrote:

We usually do not provide support about programming languages and frameworks, but here you have to set:
dataType: “json”,
data: JSON.stringify(dat),

and probably you have to use different server address.