Okay
  Public Ticket #3652912
API – Timeslots endpoint returns too much data
Closed

Comments

  • Justo Enriquez started the conversation

    Hi, good morning.

    I am having issues with the Amelia API, specifically with the /slots endpoint. I am making my request as follows, exactly as described in the documentation:

    https://mywebsite.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/slots&locationId=1&serviceId=4&serviceDuration=3600&providerIds=1&persons=1&startDateTime=2024-05-23

    First of all, for some reason, the minimum and maximum dates appear like this in the response:

          "minimum":"2023-05-23 09:15",
          "maximum":"2025-05-22 09:15",

    This seems odd since the minimum date appears to be one year before the actual date of my request, and the maximum date seems to be exactly two years after it. However, the response data only includes the available slots starting from the date I specified (2024-05-23).

    Anyway, my main issue is that I am receiving a response with too much data, and I don't know how to limit the date range for the search. There is only the startDateTime parameter, but nothing similar to EndDateTime to define when I want the query to end.

    Additionally, I am also wondering what the structure of the response means, as it is not documented. For example, in this response:

    "slots":{
       "2024-05-23":{
          "10:00":[
             [
                1,
                1
             ]
          ]
       }

    I am not sure what the contents of the time slots refer to. That is, the slot at "10:00" has an array with the values [1,1]—what is that supposed to mean?

    Also, for occupied slots:

    "occupied":{
             "2024-05-23":{
                "20:00":[
                   [
                      1,
                      1,
                      0,
                      2
                   ]
                ]
             },
             "2024-08-16":{
                "12:00":[
                   [
                      1,
                      1,
                      0,
                      4
                   ]
                ]
             }
          }

    I see that for occupied slots, the values are [1, 1, 0, 2] and [1, 1, 0, 4]. I would also like to know what these values mean and why one has the value 2 at the end and the other 4.

    Lastly, I would like to understand why the serviceDuration parameter is required. From what I understand, it should be a value tied to the serviceId.

    That is basically my entire query. I look forward to your response and am attaching the JSON response from the /slots endpoint when making my request. As you can see, it returns available slots until 2025. Thank you.

    Attached files:  slotsResponse.json

  •  1,501
    Uroš replied

    Hello Justo,

    Thank you for reaching out to us.

    I have passed this issue to our developers and we will provide you with an update as soon as we have one.

    Thank you for your patience.

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1,501
    Uroš replied

    Hello Justo,

    You can add endDateTime as a URL param to reduce response.

    serviceDuration is not mandatory.

    [providerId, locationId, free-places, serviceId] 

    9634768028.png


    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables