Whistles API

Design

The Whistles API is designed for Staylists developers who wish to attract our application’s attention (hence Whistles) in order that we perform a pre-agreed process.

Authentication

Whistles require authentication

Actions

Create a Whistle

Request

Make a POST request to the following endpoint:

https://app.staylists.com/api/v3/whistles

Parameters

instruction (required)

An instruction you wish the system perform (this maps to the code we’ve written on our side).

url (required)

The URL we need to hit in order to perform the instruction.

Response

When successful

We’ll return a 200 with a body that looks something like this:

{
    "object": "Whistle",
    "data": {
        "id": 59,
        "instruction": "fetch_property",
        "url": "https://mightyfinehotels.com/api/hotels/123.json"
        "started_at": "2020-08-12T10:42:18.000+01:00",
        "finished_at": "2020-08-12T10:42:25.000+01:00"
    }
}

When unsuccessful

We’ll return a 400 (bad request) for any of the following scenarios

Retrieve a Whistle

You may wish to poll our API to monitor a the status of a Whistle. This will tell you (through timestamps) if the request has been started and finished.

Request

Make a GET request to the following endpoint:

https://app.staylists.com/api/v3/whistles/{id}

replace {id} with the ID of the Whistle

When Whistle exists

We’ll return a 200 with a body that looks something like this:

{
    "object": "Whistle",
    "data": {
        "id": 59,
        "instruction": "fetch_property",
        "url": "https://mightyfinehotels.com/api/hotels/123.json"
        "started_at": "2020-08-12T10:42:18.000+01:00",
        "finished_at": "2020-08-12T10:42:25.000+01:00"
    }
}

Please note that started_at and finished_at could be be null. When you create a Whistle, the instruction is queued up. The started_at timestamp only gets updated when a worker picks up the job from the queue. The finished_at timestamp is the last thing the worker does. As such, if something has gone wrong during the process of us fetching information from you, the finished_at will remain null until the problem has been fixed and the Whistle retried.

When Whistle does not exist

We’ll return a 404.