Utilizziamo cookie di servizi di terze parti per attività di marketing e per offrirti una migliore esperienza. Leggi come utilizziamo i cookie e come puoi controllarli facendo clic su "Preferenze sulla privacy"


Preferenze sulla privacy

Support

API

Introduzione

Le REST API di Bookaclass.net sono accessibili all'indirizzo https://api.bookaclass.net/api

Le Rest API forniscono l'accesso ai dati dei Corsi pubblicati da un Editore su Bookaclass.net.
Grazie alle REST API è possibile inserire nel sito dell'Editore riferimenti dinamici a Corsi, Eventi, Abbonamenti e Istruttori, aggiornati in tempo reale con quelli presenti su Bookaclass.net.
In questa documentazione sono presenti esempi in C# e PHP ma, essendo le API sviluppate rispettando gli standard REST, sono accessibili con qualsiasi linguaggio di programmazione.

Autenticazione

L'accesso alle REST API è garantito previa autenticazione al servizio.
Possono accedere alle API tutti gli utenti con un account editore attivo, ai quali vengono rilasciate due chiavi per l'autenticazione.
L'autenticaztione al servizio avviene con il rilascio di un token Jwt, valido per 20 minuti dal momento dell'autenticazione.
Per approfondimenti sul funzionamento del token JWT consultare la documentazione all'indirizzo: https://jwt.io/

Per l'autenticazione si utilizzano la chiave pubblica e la chiave privata dell'editore, disponibili nel profilo utente nel sito per gli editori all'indirizzo: https://publisher.bookaclass.net/user_apikeys.aspx

Una volta ricevuto il token JWT, questo deve essere utilizzato per effettuare tutte le richieste al servizio REST API, inserendolo nell'header alla chiave 'Authorization', preceduto dalla parola 'Bearer'.
Per ottenre le migliori prestazioni è consigliabile struttrare il codice in modo da riutilizzare il token per tutte le richieste fino alla sua scadenza, evitando di effettuare l'autenticazione ad ogni richiesta.

Ecco alcuni esempi di codice per effettuare l'autenticazione alle REST API, e lo schema Json dell'oggetto restituito dal servizio

POST

https://api.bookaclass.net/api/JwtToken
        
private string BACBaseAdress="https://api.bookaclass.net/api/";
private string BACPublicKey = "mypublickey";
private string BACPrivateKey = "myprivatekey";

public class ApiLogin
{
    public string pubkey { get; set; }
    public string pkey { get; set; }
}

public async Task<bool> RestLogin()
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Accept.Add(
            new MediaTypeWithQualityHeaderValue("application/json"));
        var post = httpClient.PostAsJsonAsync<ApiLogin>("JwtToken", new ApiLogin { pubkey = BACPublicKey, pkey = BACPrivateKey });
        post.Wait();
        var responseMessage = post.Result;
        responseMessage.EnsureSuccessStatusCode();
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        authToken = jObject.GetValue("token").ToString();
        var expdate = jObject.GetValue("expireDate").ToString();
        if (DateTime.TryParse(expdate, out DateTime exp))
            tokenExpire = exp;
        return true;
    }
    catch (HttpRequestException he)
    {
        //LogException(he, "APIException");
        return false;
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return false;
    }
}
       

function RestLogin($pubkey, $privatekey) {
    $url = 'https://api.bookaclass.net/api/JwtToken';
    $data = [
      'pubkey' => '$pubkey',
      'pkey' => '$privatekey'
    ];

    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));

    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Content-Type: application/json'
    ]);
    $response = curl_exec($curl);
    curl_close($curl);
}
          
        
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiIyNjM2ODA4ZS01MzE3LTRjYjUtYTc1My01YWY1M2IzNjc4YjgiLCJpYXQiOiIxMy8xMC8yMDIxIDE5OjUyOjU1IiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDE1NTk3NSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.vo5xMiG3F2NGVUVbij5raenLfj7_se3kqDDT6iLYWLA",
"expireDate": "2021-10-13T20:12:55.9003709Z",
"loginDate": "2021-10-13T19:52:56.1852742Z"
}
         
        
{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The Autenthication object",
    "description": "The Authentication schema.",
    "default": {},
    "examples": [
        {
            "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiIyNjM2ODA4ZS01MzE3LTRjYjUtYTc1My01YWY1M2IzNjc4YjgiLCJpYXQiOiIxMy8xMC8yMDIxIDE5OjUyOjU1IiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDE1NTk3NSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.vo5xMiG3F2NGVUVbij5raenLfj7_se3kqDDT6iLYWLA",
            "expireDate": "2021-10-13T20:12:55.9003709Z",
            "loginDate": "2021-10-13T19:52:56.1852742Z"
        }
    ],
    "required": [
        "token",
        "expireDate",
        "loginDate"
    ],
    "properties": {
        "token": {
            "$id": "#/properties/token",
            "type": "string",
            "title": "The token schema",
            "description": "This is the JWT token to be used for accessing the other REST API services",
            "default": "",
            "examples": [
   "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiIyNjM2ODA4ZS01MzE3LTRjYjUtYTc1My01YWY1M2IzNjc4YjgiLCJpYXQiOiIxMy8xMC8yMDIxIDE5OjUyOjU1IiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDE1NTk3NSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.vo5xMiG3F2NGVUVbij5raenLfj7_se3kqDDT6iLYWLA"
            ]
        },
        "expireDate": {
            "$id": "#/properties/expireDate",
            "type": "string",
            "title": "The expireDate schema",
            "description": "The expiration date of the token. The date is UTC",
            "default": "",
            "examples": [
   "2021-10-13T20:12:55.9003709Z"
            ]
        },
        "loginDate": {
            "$id": "#/properties/loginDate",
            "type": "string",
            "title": "The loginDate schema",
            "description": "The authentiction date. The date is UTC",
            "default": "",
            "examples": [
   "2021-10-13T19:52:56.1852742Z"
            ]
        }
    },
    "additionalProperties": true
}
         

Corsi (oggetto: Class)

Questo servizio permette di accedere ai Corsi attivi dell'editore, ovvero quei corsi per cui esistono pianificazioni con eventi futuri.

L'oggetto 'Class' rappresenta un Corso, e contiene i dati descrittivi, e le pianificazioni attive (Schedule).


{
    "ownerlink": "https://www.bookaclass.net/Publisher?tab=sub&id=40802f81b2e046cc96b6bc7e5d4bcd77",
    "classlink": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7",
    "name": "Running Conditioning",
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
    "timezoneoffset": 120.0,
    "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
    "id": "578791050a684f8580658837d74d6fbd",
    "tags": "inhome",
    "classimg": "https://www.bookaclass.net//images/dbimages/800x800_3f4e8568-821b-4dd1-a636-c64bb7f05a56.jpg?042036",
    "schedules": [
    {
        "startdate": "20200416",
        "enddate": "20220122",
        "singlesub": false,
        "ondemand": false,
        "lnkclass": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7",
        "languages": [],
        "details": [
        {
            "day": 1,
            "places": 70,
            "starttime": "09:00",
            "endtime": "10:00",
            "location": "Sunset Fitness Club",
            "trainers": [
            {
   "displayname": "Erika",
   "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?042036",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
   "role": "Personal Trainer",
   "tags": "inhome",
   "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
            },
            {
   "displayname": "Mike",
   "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?042036",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
   "role": "Personal Trainer",
   "id": "cff92d90dbe04d93848c7537494eedb7"
            }
            ],
            "linknextevent": "https://www.bookaclass.net/Event?id=e8742c34498643a7af1c007427623ded"
        },
        {
            "day": 4,
            "places": 50,
            "starttime": "18:00",
            "endtime": "19:10",
            "location": "City Fitness Center",
            "trainers": [
            {
   "displayname": "Mike",
   "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?042036",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
   "role": "Personal Trainer",
   "tags": "inhome",
   "id": "cff92d90dbe04d93848c7537494eedb7"
            }
            ],
            "linknextevent": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7"
        }
        ],
        "rates": [
        {
            "amount": 250.00,
            "currency": null,
            "incredit": true,
            "lastminuterate": null,
            "lastminutestart": null,
            "subscription": null
        },
        {
            "amount": 0.00,
            "currency": "EUR",
            "incredit": false,
            "lastminuterate": null,
            "lastminutestart": null,
            "subscription": "All Inclusive Annuale"
        }
        ]
    }
    ]
}
         

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The Class schema",
    "description": "The schema of the Class object",
    "default": {},
    "required": [
        "ownerlink",
        "classlink",
        "name",
        "description",
        "timezoneoffset",
        "timezone",
        "id",
        "tags",
        "classimg",
        "schedules"
    ],
    "properties": {
        "ownerlink": {
            "$id": "#/properties/ownerlink",
            "type": "string",
            "title": "The ownerlink schema",
            "description": "This is the link to the page of the publisher on Bookaclass.net",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Publisher?tab=sub&id=40802f81b2e046cc96b6bc7e5d4bcd77"
            ]
        },
        "classlink": {
            "$id": "#/properties/classlink",
            "type": "string",
            "title": "The classlink schema",
            "description": "This is the link to the page of the Class on Bookaclass.net",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Event?id=75ffe87194ff4e56a120b3e5241f815b"
            ]
        },
        "name": {
            "$id": "#/properties/name",
            "type": "string",
            "title": "The name schema",
            "description": "This the name of the Class.",
            "default": "",
            "examples": [
   "Running Conditioning"
            ]
        },
        "description": {
            "$id": "#/properties/description",
            "type": "string",
            "title": "The description schema",
            "description": "The desciption of the Class",
            "default": "",
            "examples": [
   "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
            ]
        },
        "timezoneoffset": {
            "$id": "#/properties/timezoneoffset",
            "type": "number",
            "title": "The timezoneoffset schema",
            "description": "The Offset, expressed in minutes, from UTC time",
            "default": 0.0,
            "examples": [
   120.0
            ]
        },
        "timezone": {
            "$id": "#/properties/timezone",
            "type": "string",
            "title": "The timezone schema",
            "description": "The name of the Timezone",
            "default": "",
            "examples": [
   "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna"
            ]
        },
        "tags": {
            "$id": "#/properties/tags",
            "type": "string",
            "title": "The tags schema",
            "description": "The comma separated list of the tags of the object.",
            "default": null,
            "examples": [
   "inhome,forweb,mytag"
            ]
        },
        "id": {
            "$id": "#/properties/id",
            "type": "string",
            "title": "The id schema",
            "description": "This is the unique ID of the Class.",
            "default": "",
            "examples": [
   "578791050a684f8580658837d74d6fbd"
            ]
        },
        "classimg": {
            "$id": "#/properties/classimg",
            "type": "string",
            "title": "The classimg schema",
            "description": "The link to the image of the Class",
            "default": "",
            "examples": [
   "https://www.bookaclass.net//images/dbimages/800x800_3f4e8568-821b-4dd1-a636-c64bb7f05a56.jpg?070511"
            ]
        },
        "schedules": {
            "$id": "#/properties/schedules",
            "type": "array",
            "title": "The schedules schema",
            "description": "The schedules of this class. Is An Array of Schedule object",
            "default": [],
            }
        }
    }
}

          

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "This represent a Schedule of a Class.",
    "default": {},
    "required": [
        "startdate",
        "enddate",
        "singlesub",
        "ondemand",
        "lnkclass",
        "languages",
        "details",
        "rates"
    ],
    "properties": {
        "startdate": {
            "$id": "#/properties/startdate",
            "type": "string",
            "title": "The startdate schema",
            "description": "When the Schedule start",
            "default": "",
            "examples": [
   "04/16/2020"
            ]
        },
        "enddate": {
            "$id": "#/properties/enddate",
            "type": "string",
            "title": "The enddate schema",
            "description": "When the Schedule end",
            "default": "",
            "examples": [
   "01/22/2022"
            ]
        },
        "singlesub": {
            "$id": "#/properties/singlesub",
            "type": "boolean",
            "title": "The singlesub schema",
            "description": "If this schedule is Single Subscription retunrn true, otherwise false",
            "default": false,
            "examples": [
   false
            ]
        },
        "ondemand": {
            "$id": "#/properties/ondemand",
            "type": "boolean",
            "title": "The ondemand schema",
            "description": "If this schedule is an OnDemand return true, otherwise false",
            "default": false,
            "examples": [
   false
            ]
        },
        "lnkclass": {
            "$id": "#/properties/lnkclass",
            "type": "string",
            "title": "The lnkclass schema",
            "description": "The link to the Event on Bookaclass.net",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Event?id=75ffe87194ff4e56a120b3e5241f815b"
            ]
        },
        "languages": {
            "$id": "#/properties/languages",
            "type": "array",
            "title": "The languages schema",
            "description": "An Array of the Languages of the Class",
            "default": [],
            "examples": [
   [Italian, English]
            ],
        },
        "details": {
            "$id": "#/properties/details",
            "type": "array",
            "title": "The details schema",
            "description": "This field contains the details of the schedules. Contains information about the time and day, the place and the trainer. Refer to Schedule Detail object",
            "default": [],
        },
        "rates": {
            "$id": "#/properties/rates",
            "type": "array",
            "title": "The rates schema",
            "description": "An Array of the Rates available for this Schedule Detail. Refer to the Rate object",
            "default": []
            }
        }
    }
}          

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "The root schema comprises the entire JSON document.",
    "default": {},
    "required": [
        "day",
        "places",
        "starttime",
        "endtime",
        "location",
        "trainers",
        "linknextevent"
    ],
    "properties": {
        "day": {
            "$id": "#/properties/day",
            "type": "integer",
            "title": "The day schema",
            "description": "The day of the Schedule Detail. The week start from Sunday so 0 is Sunday and 6 Saturday",
            "default": 0,
            "examples": [
   2
            ]
        },
        "places": {
            "$id": "#/properties/places",
            "type": "integer",
            "title": "The places schema",
            "description": "Places available for this Detail. 0 is for infinite.",
            "default": 0,
            "examples": [
   25
            ]
        },
        "starttime": {
            "$id": "#/properties/starttime",
            "type": "string",
            "title": "The starttime schema",
            "description": "Start time.",
            "default": "",
            "examples": [
   "09:30"
            ]
        },
        "endtime": {
            "$id": "#/properties/endtime",
            "type": "string",
            "title": "The endtime schema",
            "description": "End time.",
            "default": "",
            "examples": [
   "10:30"
            ]
        },
        "location": {
            "$id": "#/properties/location",
            "type": "string",
            "title": "The location schema",
            "description": "Name of the Location.",
            "default": "",
            "examples": [
   "Sunset Fitness Club"
            ]
        },
        "trainers": {
            "$id": "#/properties/trainers",
            "type": "array",
            "title": "The trainers schema",
            "description": "An array of the Trainers. Refer to the Trainer object",
            "default": [],
        "linknextevent": {
            "$id": "#/properties/linknextevent",
            "type": "string",
            "title": "The linknextevent schema",
            "description": "The link on Bookaclass.net site to the next event of this Schedule Details.",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Event?id=08c9d2a3d7ee4435a69f153cfdd836f2"
            ]
        }
    }
}          

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "This the Rate object. It represents a rate with which it is possible to register for an event/s",
    "default": {},
    "required": [
        "amount",
        "currency",
        "incredit",
        "lastminuterate",
        "lastminutestart",
        "subscription"
    ],
    "properties": {
        "amount": {
            "$id": "#/properties/amount",
            "type": "number",
            "title": "The amount schema",
            "description": "The amount of the Rate. ",
            "default": 0.0,
            "examples": [
   90.0
            ]
        },
        "currency": {
            "$id": "#/properties/currency",
            "type": "null",
            "title": "The currency schema",
            "description": "The currency",
            "default": null,
            "examples": [
   null
            ]
        },
        "incredit": {
            "$id": "#/properties/incredit",
            "type": "boolean",
            "title": "The incredit schema",
            "description": "If true this rate is expressed in credit, otherwise in the currency of the field 'currency'",
            "default": false,
            "examples": [
   true
            ]
        },
        "lastminuterate": {
            "$id": "#/properties/lastminuterate",
            "type": "string",
            "title": "The lastminuterate schema",
            "description": "Tha amount of the rate when the lastminute time is active",
            "default": "",
            "examples": [
   "80.0"
            ]
        },
        "lastminutestart": {
            "$id": "#/properties/lastminutestart",
            "type": "string",
            "title": "The lastminutestart schema",
            "description": "This field represents the minutes before the start of the event, in which the lastminute period is activated and the rate expressed in the 'lastminuterate' field will be used",
            "default": "",
            "examples": [
   "180"
            ]
        },
        "subscription": {
            "$id": "#/properties/subscription",
            "type": "null",
            "title": "The subscription schema",
            "description": "When filled, access to this rate will be allowed only to holders of this subscription.",
            "default": null,
            "examples": [
   null
            ]
        }
    }
}
          

Per ricevere la lista dei Corsi dell'editore presenti su Bookaclass.net utilizzare il seguente servizio

POST

https://api.bookaclass.net/api/Classes
        
public async Task<string> GetClasses()
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Classes");
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Classes");
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}
       

function GetClasses() {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Classes';
    $request_url = $url . '/' . $collection_name;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
}
         
        
{
  "classes": [
    {
      "ownerlink": "https://www.bookaclass.net/Publisher?tab=sub&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "classlink": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7",
      "name": "Running Conditioning",
      "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
      "tags": "forweb,inhome",
      "id": "578791050a684f8580658837d74d6fbd",
      "classimg": "https://www.bookaclass.net//images/dbimages/800x800_3f4e8568-821b-4dd1-a636-c64bb7f05a56.jpg?042036",
      "schedules": [
        {
          "startdate": "20200416",
          "enddate": "20220122",
          "singlesub": false,
          "ondemand": false,
          "lnkclass": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7",
          "languages": [],
          "details": [
            {
 "day": 1,
 "places": 70,
 "starttime": "09:00",
 "endtime": "10:00",
 "location": "Sunset Fitness Club",
 "trainers": [
   {
     "displayname": "Erika",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
   },
   {
     "displayname": "Mike",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "cff92d90dbe04d93848c7537494eedb7"
   }
 ],
 "linknextevent": "https://www.bookaclass.net/Event?id=e8742c34498643a7af1c007427623ded"
            },
            {
 "day": 4,
 "places": 50,
 "starttime": "18:00",
 "endtime": "19:10",
 "location": "City Fitness Center",
 "trainers": [
   {
     "displayname": "Mike",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "cff92d90dbe04d93848c7537494eedb7"
   }
 ],
 "linknextevent": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7"
            }
          ],
          "rates": [
            {
 "amount": 250.00,
 "currency": null,
 "incredit": true,
 "lastminuterate": null,
 "lastminutestart": null,
 "subscription": null
            },
            {
 "amount": 0.00,
 "currency": "EUR",
 "incredit": false,
 "lastminuterate": null,
 "lastminutestart": null,
 "subscription": "All Inclusive Annuale"
            }
          ]
        }
      ]
    },
    {
      "ownerlink": "https://www.bookaclass.net/Publisher?tab=sub&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "classlink": "https://www.bookaclass.net/Event?id=3d0e87a5305b43baa4e5dced486ba6da",
      "name": "TRX",
      "description": "Aenean posuere dapibus ex. Nam et feugiat purus. Vestibulum vel libero suscipit, porttitor nisl nec, ullamcorper dui. \r\nNam fermentum quam sed lectus hendrerit, nec viverra urna sodales. Sed lorem sapien, vulputate at interdum quis, posuere nec libero. \r\nQuisque semper tempus arcu eu scelerisque. Phasellus vulputate lorem a ex lacinia, a semper justo fringilla. Praesent elementum ipsum at pellentesque tincidunt.",
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
      "id": "058da02f1905411b93aad17d075b7287",
      "tags": "forweb",
      "classimg": "https://www.bookaclass.net//images/dbimages/800x800_247b2b92-5a4b-4e78-ab2b-5846fb3c406e.jpg?042036",
      "schedules": [
        {
          "startdate": "20200515",
          "enddate": "20220318",
          "singlesub": false,
          "ondemand": false,
          "lnkclass": "https://www.bookaclass.net/Event?id=3d0e87a5305b43baa4e5dced486ba6da",
          "languages": [
            "af",
            "am",
            "en",
            "fr",
            "it",
            "sq"
          ],
          "details": [
            {
 "day": 2,
 "places": 25,
 "starttime": "09:30",
 "endtime": "10:30",
 "location": "Sunset Fitness Club",
 "trainers": [
   {
     "displayname": "Erika",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
   },
   {
     "displayname": "Mike",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "cff92d90dbe04d93848c7537494eedb7"
   }
 ],
 "linknextevent": "https://www.bookaclass.net/Event?id=feae44d5fb9f489daa983de51d3b6481"
            },
            {
 "day": 4,
 "places": 25,
 "starttime": "15:50",
 "endtime": "16:50",
 "location": "Sunset Fitness Club",
 "trainers": [
   {
     "displayname": "Erika",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
   }
 ],
 "linknextevent": "https://www.bookaclass.net/Event?id=30d211bec43c43c78caee36fe894eeac"
            },
            {
 "day": 0,
 "places": 25,
 "starttime": "14:30",
 "endtime": "15:30",
 "location": "Sunset Fitness Club",
 "trainers": [
   {
     "displayname": "Mike",
     "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?042036",
     "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
     "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
     "role": "Personal Trainer",
     "tags": "inhome",
     "id": "cff92d90dbe04d93848c7537494eedb7"
   }
 ],
 "linknextevent": "https://www.bookaclass.net/Event?id=3d0e87a5305b43baa4e5dced486ba6da"
            }
          ],
          "rates": [
            {
 "amount": 0.00,
 "currency": "CHF",
 "incredit": false,
 "lastminuterate": null,
 "lastminutestart": null,
 "subscription": "All Inclusive Annuale"
            },
            {
 "amount": 90.00,
 "currency": null,
 "incredit": true,
 "lastminuterate": "80.0",
 "lastminutestart": "180",
 "subscription": null
            },
            {
 "amount": 50.00,
 "currency": "CHF",
 "incredit": false,
 "lastminuterate": "40.0",
 "lastminutestart": "180",
 "subscription": null
            }
          ]
        }
      ]
    },
  ]
}         

Per ricevere un corso specifico usare il seguente servizio

POST

https://api.bookaclass.net/api/Classes/{id}
        
public async Task<string> GetClass(string id)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Classes/" + id);
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Classes/" + id);
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}
       

function GetClass( $classid) {
    $url = 'https://daniele.vci.locale/bacapi/api';
    $collection_name = 'Classes';
    $params = '/' . $classid;
    $request_url = $url . '/' . $collection_name . '/' $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
    "ownerlink": "https://www.bookaclass.net/Publisher?tab=sub&id=40802f81b2e046cc96b6bc7e5d4bcd77",
    "classlink": "https://www.bookaclass.net/Event?id=69c721f495b04430bc3bb9b2a7c59618",
    "name": "TRX",
    "description": "Aenean posuere dapibus ex. Nam et feugiat purus. Vestibulum vel libero suscipit, porttitor nisl nec, ullamcorper dui. \r\nNam fermentum quam sed lectus hendrerit, nec viverra urna sodales. Sed lorem sapien, vulputate at interdum quis, posuere nec libero. \r\nQuisque semper tempus arcu eu scelerisque. Phasellus vulputate lorem a ex lacinia, a semper justo fringilla. Praesent elementum ipsum at pellentesque tincidunt.",
    "id": "058da02f1905411b93aad17d075b7287",
    "classimg": "https://www.bookaclass.net//images/dbimages/800x800_247b2b92-5a4b-4e78-ab2b-5846fb3c406e.jpg?070409",
    "schedules": [
    {
        "startdate": "05/15/2020",
        "enddate": "03/18/2022",
        "singlesub": false,
        "ondemand": false,
        "lnkclass": "https://www.bookaclass.net/Event?id=69c721f495b04430bc3bb9b2a7c59618",
        "languages": [
        "af",
        "am",
        "en",
        "fr",
        "it",
        "sq"
        ],
        "details": [
        {
            "day": 2,
            "places": 25,
            "starttime": "09:30",
            "endtime": "10:30",
            "location": "Sunset Fitness Club",
            "trainers": [
            {
   "displayname": "Erika",
   "image": "https://www.bookaclass.net/images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?070409",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
   "role": "Personal Trainer"
   "tags": "inhome",
   "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
            },
            {
   "displayname": "Mike",
   "image": "https://www.bookaclass.net/images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?070409",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
   "role": "Personal Trainer"
   "tags": "inhome",
   "id": "8f7c2fb6b6e9eb6fc43e6cfa07beef68"
            }
            ],
            "linknextevent": "https://www.bookaclass.net/Event?id=08c9d2a3d7ee4435a69f153cfdd836f2"
        },
        {
            "day": 4,
            "places": 25,
            "starttime": "15:50",
            "endtime": "16:50",
            "location": "Sunset Fitness Club",
            "trainers": [
            {
   "displayname": "Erika",
   "image": "https://www.bookaclass.net/images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?070409",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
   "role": "Personal Trainer"
   "tags": "inhome",
   "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
            }
            ],
            "linknextevent": "https://www.bookaclass.net/Event?id=4710e59802954c29bdc38d05a9549992"
        },
        {
            "day": 0,
            "places": 25,
            "starttime": "14:30",
            "endtime": "15:30",
            "location": "Sunset Fitness Club",
            "trainers": [
            {
   "displayname": "Mike",
   "image": "https://www.bookaclass.net/images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?070409",
   "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
   "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
   "role": "Personal Trainer"
   "tags": "inhome",
   "id": "8f7c2fb6b6e9eb6fc43e6cfa07beef68"
            }
            ],
            "linknextevent": "https://www.bookaclass.net/Event?id=69c721f495b04430bc3bb9b2a7c59618"
        }
        ],
        "rates": [
        {
            "amount": 0.00,
            "currency": "CHF",
            "incredit": false,
            "lastminuterate": null,
            "lastminutestart": null,
            "subscription": "All Inclusive Annuale"
        },
        {
            "amount": 90.00,
            "currency": null,
            "incredit": true,
            "lastminuterate": "80.0",
            "lastminutestart": "180",
            "subscription": null
        },
        {
            "amount": 50.00,
            "currency": "CHF",
            "incredit": false,
            "lastminuterate": "40.0",
            "lastminutestart": "180",
            "subscription": null
        }
        ]
    }
    ]
}
         

Questo metodo ritorna tutti gli eventi programmati (massimo 1 anno) per il Corso richiesto dalla data della richiesta.
Il parametro 'id' è il valore della proprietà 'id' dell'oggetto 'Class'.

POST

https://api.bookaclass.net/api/Classes/{id}/Calendar
        
public async Task<string> GetClassCalendar(string id)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Classes/" + id + "/Calendar");
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Classes/" + id + "/Calendar");
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}
       

function GetClassCalendar($classid) {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Classes';
    $params = '/' . $classid . '/Calendar';
    $request_url = $url . '/' . $collection_name . '/' . $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "events": [
    {
      "id": "1e5957b1bcc5406fa350d4960e3faa09",
      "title": "Yoga",
      "allDay": true,
      "start": "2021-10-14T12:00:00",
      "end": "2021-10-14T13:00:00",
      "description": null,
      "url": "https://www.bookaclass.net/Event?id=1e5957b1bcc5406fa350d4960e3faa09"
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
    },
    {
      "id": "c322e4fd7ed64b21bc2d68b139b0190e",
      "title": "Yoga",
      "allDay": false,
      "start": "2021-10-15T14:30:00",
      "end": "2021-10-15T15:30:00",
      "description": "Corsi Online",
      "url": "https://www.bookaclass.net/Event?id=c322e4fd7ed64b21bc2d68b139b0190e"
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
    },
    {
      "id": "91a42e9f4c014023b0a40376d2d99040",
      "title": "Yoga",
      "allDay": false,
      "start": "2021-10-20T13:25:00",
      "end": "2021-10-20T14:30:00",
      "description": "Corsi Online",
      "url": "https://www.bookaclass.net/Event?id=91a42e9f4c014023b0a40376d2d99040"
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
    },
    {
      "id": "7dc99295988842e1a59ad74bba7f4888",
      "title": "Yoga",
      "allDay": false,
      "start": "2021-10-22T14:30:00",
      "end": "2021-10-22T15:30:00",
      "description": "Corsi Online",
      "url": "https://www.bookaclass.net/Event?id=7dc99295988842e1a59ad74bba7f4888"
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
    }
 ]
}
          

Istruttori (oggetto: Trainer)

Questo servizio permette di accedere agli Istruttori dei corsi dell'editore ed agli eventi in cui è presente l'istruttore scelto.

L'oggetto 'Trainer' viene utilizzato anche in risultati di altri servizi.


{
    "displayname": "Erika",
    "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?033838",
    "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
    "role": "Personal Trainer",
    "tags": "inhome",
    "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
} 
          

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "This is the Trainer object",
    "default": {},
    "required": [
        "displayname",
        "image",
        "link",
        "description",
        "role",
        "tags",
        "id"
    ],
    "properties": {
        "displayname": {
            "$id": "#/properties/displayname",
            "type": "string",
            "title": "The displayname schema",
            "description": "The name of the Trainer",
            "default": "",
            "examples": [
   "Erika"
            ]
        },
        "image": {
            "$id": "#/properties/image",
            "type": "string",
            "title": "The image schema",
            "description": "The link to the image of the Trainer",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?070409"
            ]
        },
        "link": {
            "$id": "#/properties/link",
            "type": "string",
            "title": "The link schema",
            "description": "The link to the Trainer's page on Bookaclass.net",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77"
            ]
        },
        "description": {
            "$id": "#/properties/description",
            "type": "string",
            "title": "The description schema",
            "description": "The description of the Trainer",
            "default": "",
            "examples": [
   "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
            ]
        },
        "role": {
            "$id": "#/properties/role",
            "type": "string",
            "title": "The role schema",
            "description": "The role of the Trainer",
            "default": "",
            "examples": [
   "Personal Trainer"
            ]
        },
        "tags": {
            "$id": "#/properties/tags",
            "type": "string",
            "title": "The tags schema",
            "description": "The comma separated list of the tags of the object.",
            "default": null,
            "examples": [
   "inhome,forweb,mytag"
            ]
        },
        "id": {
            "$id": "#/properties/id",
            "type": "string",
            "title": "The id schema",
            "description": "The id of the Trainer",
            "default": "",
            "examples": [
   "Personal Trainer"
            ]
        }
    }
}
          

Questo metodo restituisce tutti gli Istruttori collegati all'editore

POST

https://api.bookaclass.net/api/Trainers
      
public async Task<string> GetTrainers()
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Trainers");
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Trainers");
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}

       

function GetTrainers() {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Trainers';
    $request_url = $url . '/' . $collection_name;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "trainers": [
    {
      "displayname": "Erika",
      "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?033838",
      "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
      "role": "Personal Trainer",
      "tags": "inhome",
      "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
    },
    {
      "displayname": "Mike",
      "image": "https://www.bookaclass.net//images/dbimages/800x800_e47ff9d4-3645-44fb-9c8b-20427459f688.jpg?033838",
      "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "description": "Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
      "role": "Personal Trainer",
      "tags": "inhome",
      "id": "cff92d90dbe04d93848c7537494eedb7"
    }
  ]
}          

Questo metodo restituisce l'Istruttore con l'id richiesto.)

POST

https://api.bookaclass.net/api/Trainers/{id}
      
public async Task<string> GetTrainer(string id)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Trainers/" + id);
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Trainers/" + id);
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}

       

function GetTrainer($trainerid) {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Trainers';
    $params = '/' . $trainerid;
    $request_url = $url . '/' . $collection_name . '/' $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
    "displayname": "Erika",
    "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?033838",
    "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
    "role": "Personal Trainer",
    "tags": "inhome",
    "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d"
}

Questo metodo restituisce tutti gli eventi futuri in cui l'istruttore è presente. Gli eventi sono un array di oggetti 'Event' inseriti nella proprietà 'events' aggiunta all'oggetto 'Trainer'

POST

https://api.bookaclass.net/api/Trainers/{id}/Events
        
public async Task<string> GetTrainerEvents(string id)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Trainers/" + id + "/Events");
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Trainers/" + id+ "/Events");
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}
       

function GetTrainerEvents($classid) {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Classes';
    $params = '/' . $classid . '/Events';
    $request_url = $url . '/' . $collection_name . '/' . $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "displayname": "Erika",
  "image": "https://www.bookaclass.net//images/dbimages/800x800_d758c39d-139b-4a32-9836-8d76a98d6522.jpg?041121",
  "link": "https://www.bookaclass.net/Publisher?tab=5&id=40802f81b2e046cc96b6bc7e5d4bcd77",
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
  "role": "Personal Trainer",
  "tags": "inhome",
  "id": "8f7c2fb6b6e9494c9e0fe4e9633ef53d",
  "events": [
    {
      "id": "c322e4fd7ed64b21bc2d68b139b0190e",
      "title": "Yoga",
      "allDay": false,
      "start": "2021-10-15T14:30:00",
      "end": "2021-10-15T15:30:00",
      "description": "Corsi Online",
      "url": "https://www.bookaclass.net/Event?id=c322e4fd7ed64b21bc2d68b139b0190e",
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna"
    },
    {
      "id": "167dd07752de4b28afbd2b1e6397da1f",
      "title": "H.I.I.T.",
      "allDay": false,
      "start": "2021-10-15T19:00:00",
      "end": "2021-10-15T20:15:00",
      "description": "Whatsapp",
      "url": "https://www.bookaclass.net/Event?id=167dd07752de4b28afbd2b1e6397da1f",
      "timezoneoffset": 120.0,
      "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna"
    }
 ]
}         

Abbonamenti (oggetto: Subscription)

Questo servizio permette di accedere gli Abbonamenti attivi offerti dall'Editore.
I metodi ritornano gli Abbonamenti e la vendita di Crediti.

L'oggetto Subscription contiene i dati dell'abbonamento ed il link per accedere all'acquisto su Bookaclass.net


{
    "ownerlink": "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77",
    "buylink": "https://www.bookaclass.net/BuySub?id=8988548a6d644626a0eadb8ef7bc84a5",
    "name": "Fitness + Corsi",
    "description": "Nunc pharetra molestie lorem, et eleifend lacus congue maximus. Duis ligula lacus, pulvinar ac sollicitudin condimentum, porttitor id urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer finibus",
    "price": 270.00,
    "currency": "EUR",
    "autorenew": true,
    "duration": 30,
    "tags": "inhome,forweb"
}
          

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "Subscription object.",
    "default": {},
    "required": [
        "ownerlink",
        "buylink",
        "name",
        "description",
        "price",
        "currency",
        "autorenew",
        "tags",
        "duration"
    ],
    "properties": {
        "ownerlink": {
            "$id": "#/properties/ownerlink",
            "type": "string",
            "title": "The ownerlink schema",
            "description": "The link to the page of the Publisher on Bookaclass.net",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77"
            ]
        },
        "buylink": {
            "$id": "#/properties/buylink",
            "type": "string",
            "title": "The buylink schema",
            "description": "The link to the page on Bookaclass.net where the Subscription csan be Bought",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/BuySub?id=8988548a6d644626a0eadb8ef7bc84a5"
            ]
        },
        "name": {
            "$id": "#/properties/name",
            "type": "string",
            "title": "The name schema",
            "description": "The name of the SUbscriptions",
            "default": "",
            "examples": [
   "Fitness + Corsi"
            ]
        },
        "description": {
            "$id": "#/properties/description",
            "type": "string",
            "title": "The description schema",
            "description": "The description of the Subscription.",
            "default": "",
            "examples": [
   "Nunc pharetra molestie lorem, et eleifend lacus congue maximus. Duis ligula lacus, pulvinar ac sollicitudin condimentum, porttitor id urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer finibus"
            ]
        },
        "price": {
            "$id": "#/properties/price",
            "type": "number",
            "title": "The price schema",
            "description": "The Price of the Subscription",
            "default": 0.0,
            "examples": [
   270.0
            ]
        },
        "currency": {
            "$id": "#/properties/currency",
            "type": "string",
            "title": "The currency schema",
            "description": "The currency of the Price.",
            "default": "",
            "examples": [
   "EUR"
            ]
        },
        "autorenew": {
            "$id": "#/properties/autorenew",
            "type": "boolean",
            "title": "The autorenew schema",
            "description": "If 'true' the Subcription can be renewed automatically. Present only when the object is Subscription.",
            "default": false,
            "examples": [
   true
            ]
        },
        "credits": {
            "$id": "#/properties/credits",
            "type": "number",
            "title": "The credits schema",
            "description": "The number of Credits sold. Present only when the Subscriptions is a sold of Credits.",
            "default": 0.0,
            "examples": [
   true
            ]
        },
        "duration": {
            "$id": "#/properties/duration",
            "type": "integer",
            "title": "The duration schema",
            "description": "The duration of the subscription in days",
            "default": 0,
            "examples": [
   30
            ]
        }
        "tags": {
            "$id": "#/properties/tags",
            "type": "string",
            "title": "The tags schema",
            "description": "The comma spearated list of the tags of the object",
            "default": null,
            "examples": [
   "forweb,inhome,mytags"
            ]
        }
    }
}
          

Questo metodo restituisce tutti gli Abbonamenti attivi dell'editore)

POST

https://api.bookaclass.net/api/Subscriptions
      
public async Task<string> GetSubscriptions()
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Subscriptions");
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Subscriptions");
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}
       

function GetSubscriptions() {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Subscriptions';
    $request_url = $url . '/' . $collection_name;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "subscriptions": [
    {
      "ownerlink": "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "buylink": "https://www.bookaclass.net/BuySub?id=8988548a6d644626a0eadb8ef7bc84a5",
      "name": "Fitness + Corsi",
      "description": "Nunc pharetra molestie lorem, et eleifend lacus congue maximus. Duis ligula lacus, pulvinar ac sollicitudin condimentum, porttitor id urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer finibus",
      "price": 270.00,
      "currency": "EUR",
      "autorenew": true,
      "duration": 30
      "tags": "inhome,forweb"
    },
    {
      "ownerlink": "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "buylink": "https://www.bookaclass.net/BuySub?id=738ecc2863884742b5c585f7920bd2dc",
      "name": "Fitness off peak",
      "description": "Nullam pulvinar, sem vel lobortis ornare, arcu nulla euismod justo, a euismod quam tortor ac est. Etiam dignissim lorem ac efficitur semper. Pellentesque elementum leo eu ex vestibulum, vitae efficitur tortor efficitur. Morbi egestas nisi et ornare c",
      "price": 200.00,
      "currency": "CHF",
      "autorenew": true,
      "duration": 30
      "tags": null;
    },
 ]
}
          

Questo metodo restituisce tutti gli Abbonamenti in Crediti messi in vendita dall'editore

POST

https://api.bookaclass.net/api/Subscriptions/Credits
      
public async Task<string> GetCredits()
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Subscriptions/Credits");
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Subscriptions");
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}
       

function GetSubscriptions() {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Subscriptions/Credits';
    $request_url = $url . '/' . $collection_name;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "subscriptions": [
    {
      "ownerlink": "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "buylink": "https://www.bookaclass.net/BuySub?id=8988548a6d644626a0eadb8ef7bc84a5",
      "name": "200 Credits",
      "description": "Nunc pharetra molestie lorem, et eleifend lacus congue maximus. Duis ligula lacus, pulvinar ac sollicitudin condimentum, porttitor id urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer finibus",
      "price": 300.00,
      "currency": "EUR",
      "credits": 200,
      "duration": 30
      "tags": "inhome,forweb"
    },
    {
      "ownerlink": "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77",
      "buylink": "https://www.bookaclass.net/BuySub?id=738ecc2863884742b5c585f7920bd2dc",
      "name": "300  redits",
      "description": "Nullam pulvinar, sem vel lobortis ornare, arcu nulla euismod justo, a euismod quam tortor ac est. Etiam dignissim lorem ac efficitur semper. Pellentesque elementum leo eu ex vestibulum, vitae efficitur tortor efficitur. Morbi egestas nisi et ornare c",
      "price": 40.00,
      "currency": "CHF",
      "credits": 50,
      "duration": 30
      "tags": null;
    },
 ]
}
          

Questo metodo restituisce l'Abbonamento con l'id richiesto.

POST

https://api.bookaclass.net/api/Subscriptions/{id}
      
public async Task<string> GetSubscription(string id)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Subscriptions/" + id);
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Subscriptions/"+ id);
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}

       

function GetSubscription($subid) {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Subscriptions';
    $params = '/' . $subid;
    $request_url = $url . '/' . $collection_name . '/' $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
    "ownerlink": "https://www.bookaclass.net/Publisher?tab=3&id=40802f81b2e046cc96b6bc7e5d4bcd77",
    "buylink": "https://www.bookaclass.net/BuySub?id=8988548a6d644626a0eadb8ef7bc84a5",
    "name": "Fitness + Corsi",
    "description": "Nunc pharetra molestie lorem, et eleifend lacus congue maximus. Duis ligula lacus, pulvinar ac sollicitudin condimentum, porttitor id urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer finibus",
    "price": 270.00,
    "currency": "EUR",
    "autorenew": true,
    "duration": 30
}

Eventi (oggetto: Event)

Questo servizio permette di accedere ai dettagli di un Evento specifico, e a tutti gli eventi dell'Editore in un periodo specifico.


{
  "id": "c322e4fd7ed64b21bc2d68b139b0190e",
  "title": "Yoga",
  "allDay": false,
  "start": "2021-10-15T14:30:00",
  "end": "2021-10-15T15:30:00",
  "description": "Corsi Online",
  "url": "https://www.bookaclass.net/Event?id=c322e4fd7ed64b21bc2d68b139b0190e",
  "timezoneoffset": 120.0,
  "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
  "rates": [],
  "trainers": []
}          
        
{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "This object represent an Event of a Class.",
    "default": {},
    "required": [
        "id",
        "title",
        "allDay",
        "start",
        "end",
        "description",
        "url"
        "timezoneoffset",
        "timezone",
    ],
    "properties": {
        "id": {
            "$id": "#/properties/id",
            "type": "string",
            "title": "The id schema",
            "description": "The unique id of the Event",
            "default": "",
            "examples": [
   "f82413368a97418da8648727cd41dda7"
            ]
        },
        "title": {
            "$id": "#/properties/title",
            "type": "string",
            "title": "The title schema",
            "description": "The name of the Event",
            "default": "",
            "examples": [
   "Running Conditioning"
            ]
        },
        "allDay": {
            "$id": "#/properties/allDay",
            "type": "boolean",
            "title": "The allDay schema",
            "description": "If true this is an OnDemand Event, the start and end values should considered null and are always set to default values of 12:00/13:00.",
            "default": false,
            "examples": [
   false
            ]
        },
        "start": {
            "$id": "#/properties/start",
            "type": "string",
            "title": "The start schema",
            "description": "The start time.",
            "default": "",
            "examples": [
   "2021-10-14T18:00:00"
            ]
        },
        "end": {
            "$id": "#/properties/end",
            "type": "string",
            "title": "The end schema",
            "description": "An explanation about the purpose of this instance.",
            "default": "",
            "examples": [
   "2021-10-14T19:10:00"
            ]
        },
        "description": {
            "$id": "#/properties/description",
            "type": "string",
            "title": "The description schema",
            "description": "An explanation about the purpose of this instance.",
            "default": "",
            "examples": [
   "City Fitness Center"
            ]
        },
        "url": {
            "$id": "#/properties/url",
            "type": "string",
            "title": "The url schema",
            "description": "An explanation about the purpose of this instance.",
            "default": "",
            "examples": [
   "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7"
            ]
        },
        "timezoneoffset": {
            "$id": "#/properties/timezoneoffset",
            "type": "number",
            "title": "The timezoneoffset schema",
            "description": "The Offset, expressed in minutes, from UTC time",
            "default": 0.0,
            "examples": [
   120.0
            ]
        },
        "timezone": {
            "$id": "#/properties/timezone",
            "type": "string",
            "title": "The timezone schema",
            "description": "The name of the Timezone",
            "default": "",
            "examples": [
   "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna"
            ]
        },
    }
}          

Questo metodo restituisce i dettagli dell'Evento richiesto. All'oggetto Event sono accodate le proprieta 'trainers' e 'rates' che rappresentano rispettivamente un array di 'Trainer' ed una array di 'Rate' relativi all'evento

POST

https://api.bookaclass.net/api/Events/{id}
      
public async Task<string> GetEvent(string id)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Events/" + id);
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Events/"+ id);
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}

       

function GetEvent($eventid) {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Events';
    $params = '/' . $eventid;
    $request_url = $url . '/' . $collection_name . '/' $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "id": "c322e4fd7ed64b21bc2d68b139b0190e",
  "title": "Yoga",
  "allDay": false,
  "start": "2021-10-15T14:30:00",
  "end": "2021-10-15T15:30:00",
  "description": "Corsi Online",
  "url": "https://www.bookaclass.net/Event?id=c322e4fd7ed64b21bc2d68b139b0190e",
  "timezoneoffset": 120.0,
  "timezone": "(UTC+01:00) Amsterdam, Berlino, Berna, Roma, Stoccolma, Vienna",
  "rates": [],
  "trainers": []
}          

Questo metodo restituisce tutti gli Eventi dell'editore nel periodo di tempo richiesto. I parametri 'startdate' e 'enddate' devono essere nel formato 'yyyyMMdd'

POST

https://api.bookaclass.net/api/Events/{startdate}/{enddate}
      
public async Task<string> GetEvents(string startdate, string enddate)
{
    try
    {
        httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri(BACBaseAdress);
        httpClient.DefaultRequestHeaders.Accept.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var get = httpClient.GetAsync("Events/" + startdate + "/" + enddate);
        get.Wait();
        var responseMessage = get.Result;
        if (responseMessage.StatusCode == System.Net.HttpStatusCode.Unauthorized)
        {
            res = await RestLogin();
            if (!res)
   return new JObject().ToString();
            responseMessage = await httpClient.GetAsync("Events/"+ + startdate + "/" + enddate);
        }
        var responseJson = await responseMessage.Content.ReadAsStringAsync();
        var jObject = JObject.Parse(responseJson);
        return jObject.ToString();
    }
    catch (Exception ex)
    {
        //LogException(ex);
        return "";
    }
}

       

function GetEvent($startdate, $enddate) {
    $url = 'https://api.bookaclass.net/api';
    $collection_name = 'Events';
    $params = '/' . $eventid;
    $request_url = $url . '/' . $collection_name . '/' $params;

    $curl = curl_init($request_url);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb29rYUNsYXNzQWNjZXNzVG9rZW4iLCJqdGkiOiI5ODcxY2FmZC0yZGVhLTRlMmQtODUwMC02YzkzNWQ5YWUxODQiLCJpYXQiOiIxMi4xMC4yMDIxIDE1OjM2OjExIiwiRGlzcGxheU5hbWUiOiJTdW5zZXQgRml0bmVzcyBDbHViIiwiSUQiOiI0MDgwMmY4MWIyZTA0NmNjOTZiNmJjN2U1ZDRiY2Q3NyIsImV4cCI6MTYzNDA1NDE3MSwiaXNzIjoiaHR0cHM6Ly9hcGkuYm9va2FjbGFzcy5uZXQiLCJhdWQiOiJodHRwczovL2FwaS5ib29rYWNsYXNzLm5ldCJ9.Rv8KeZ6HH3f8DrxKSnUj0wFfSQ5Csqx-d08OZeQoiik',
      'Content-Type: application/json'
    ]);

    $response = curl_exec($curl);
    curl_close($curl);
}          
        
{
  "events": [
    {
      "id": "a28cf63176c14e3dbb33791085d268e0",
      "title": "Nuoto",
      "allDay": false,
      "start": "2021-10-14T11:55:00",
      "end": "2021-10-14T14:10:00",
      "description": "City Fitness Center",
      "url": "https://www.bookaclass.net/Event?id=a28cf63176c14e3dbb33791085d268e0"
    },
    {
      "id": "4710e59802954c29bdc38d05a9549992",
      "title": "TRX",
      "allDay": false,
      "start": "2021-10-14T15:50:00",
      "end": "2021-10-14T16:50:00",
      "description": "Sunset Fitness Club",
      "url": "https://www.bookaclass.net/Event?id=4710e59802954c29bdc38d05a9549992"
    },
    {
      "id": "f82413368a97418da8648727cd41dda7",
      "title": "Running Conditioning",
      "allDay": false,
      "start": "2021-10-14T18:00:00",
      "end": "2021-10-14T19:10:00",
      "description": "City Fitness Center",
      "url": "https://www.bookaclass.net/Event?id=f82413368a97418da8648727cd41dda7"
    }
 ]
}