[#1211] How to get the class start time and end time for a "class on special days only"

Migrated from Redmine #1211 | Author: Jagan Pandurangan
Status: New | Priority: High, I’m very impatient | Created: 2024-04-12


Hi, we have a class which is available on special days only as seen in the screenshot.

The getEventList or getClassesList API do not provide this information. May I know how to get this?

Jagan Pandurangan wrote:

Hi, we have a class which is available on special days only.

The getEventList or getClassesList API do not provide this information. May I know how to get this?

I am unable to add files/screenshot. It is throwing 404 error.

Redmine Admin wrote:

hi, please provide raw http request and response

Jagan Pandurangan wrote:

Redmine Admin wrote:

hi, please provide raw http request and response


var data = JSON.stringify({
  jsonrpc: "2.0",
  method: "getClassesList",
  params: [],
  id: 1,
});

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    let response = JSON.parse(this.responseText);
    console.log("list of classes", response);
  }
});

xhr.open("POST", "https://user-api.simplybook.it");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-Company-Login", "mercedesbenzmena");
xhr.setRequestHeader("X-Token", token);

xhr.send(data);

Does this help?

Redmine Admin wrote:

this doesn’t looks like http request and I see no method call related to getEventList or getClassesList

Jagan Pandurangan wrote:

!https://lh3.googleusercontent.com/drive-viewer/AKGpihbDPE-vKjPA4RYb7wTpqF6N6biRCIkB4Z3q9E8aqw1p8t47mMN6WzyWWgRM6T0e_3O-F1A3v75uUU4rDYg6L_FeNLKPZUuEGQ=w2182-h1812-v0!

!https://lh3.googleusercontent.com/drive-viewer/AKGpihYoKwBDmmgIruedrLjMXPfTfnp3PHZGWRw4MXmHss50eQ0TtaJ5gZTebtqIIwArAG_WIHnqmUfbZLmek3pJEoH9aglXdvm4Kqo=w2182-h1812-v0!

These are the screenshots of the information I want in the api response. May be the images will disappear after a while (might be short lived urls)

Jagan Pandurangan wrote:

Redmine Admin wrote:

this doesn’t looks like http request and I see no method call related to getEventList or getClassesList

That’s a XMLHTTP request and there is the method “getClassesList” in the third line. :slight_smile:

Does a curl help you?

Redmine Admin wrote:

curl is fine

(Short original content)

Jagan Pandurangan wrote:


curl --location 'https://user-api.simplybook.it' \
--header 'X-Company-Login: mercedesbenzmena' \
--header 'X-Token: 71cf5f812f13948eb92f443ddbca6498395d1ff49906b3a951558f24b895f802' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "getClassesList",
    "params": [],
    "id": 1
}'

This is the curl command

Redmine Admin wrote:

it seems you don’t have available days for this class

Val Komarov wrote:

If I understood you correctly, you need to know the fact, that the class works on special days only. That means, all week days are disabled in the class schedule.
We do not have this in API, you can only get class schedule for certain dates

Jagan Pandurangan wrote:

Val Komarov wrote:

If I understood you correctly, you need to know the fact, that the class works on special days only. That means, all week days are disabled in the class schedule.
We do not have this in API, you can only get class schedule for certain dates

Not exactly. I would like to know when all a class is available.
For example,


{
  "class1": {
    "2021-01-01": { "from": "09:00", "to": "03:00" },
    "2021-02-01": { "from": "03:00", "to": "11:00" }
  }
}

Jagan Pandurangan wrote:

Redmine Admin wrote:

it seems you don’t have available days for this class

The class in the screenshot is available on 24th April from 14:00 to 22:00. I would like to fetch this information through any api.

Val Komarov wrote:

In that case, you can find ‘event_id’ field of the required class, and use that value to query the schedule for corresponding service (getWorkDaysInfo() method)

Jagan Pandurangan wrote:

Val Komarov wrote:

In that case, you can find ‘event_id’ field of the required class, and use that value to query the schedule for corresponding service (getWorkDaysInfo() method)

Cool, thank you. Also you mentioned “you can only get class schedule for certain dates”.

If I understood it right, I can get what all events are available from “2024-01-01” to “2024-02-01” .

May I know which api to use for this?

Jagan Pandurangan wrote:

Jagan Pandurangan wrote:

Val Komarov wrote:

In that case, you can find ‘event_id’ field of the required class, and use that value to query the schedule for corresponding service (getWorkDaysInfo() method)

Cool, thank you. Also you mentioned “you can only get class schedule for certain dates”.

If I understood it right, I can get what all events are available from “2024-01-01” to “2024-02-01” .

May I know which api to use for this?

I guess “getWorkDaysInfo” itself will do both. Thank you!