API URL
When you want to use the API yourself you can use the following endpoints to retrieve your service status.
Endpoint
https://ismyapponline.vercel.app/api/appstatus?url={url}&response={response}
When a POST
request is made to this API enpoint it will return the status of your app which can be destructured in JavaScript like this:
const response = await fetch(apihost + `/api/appstatus?url=${encodeURIComponent(app.url)}&response=${app.response}`, {
method: 'POST'
});
const { status } = await response.json();
console.log(status) // logs "online" or "offline"
The types for the response are:
Response Type | URL value | Description |
---|---|---|
Not Responding | nothing | The app is marked as offline if the server doesn't respond |
Code 500 | 500 | The app is marked as offline if the server responds with a code 500 |
Both | both | The app is marked as offline if one of the above states is true |
Custom Status
When the provided URL returns values for a custom status the status can be destructured in JavaScript like this:
const response = await fetch(apihost + `/api/appstatus?url=${encodeURIComponent(app.url)}&response=${app.response}`, {
method: 'POST'
});
const { status } = await response.json();
if (typeof status == "object") {
const { color, statusText } = status;
console.log(color) // logs the custom color. When using script.js: "green" | "red" | "orange"
console.log(statusText) // logs the custom status text
}
Forwarding Links
Find out more on how to use script.js or the custom status: