Introduction
Welcome to the TimeOps API! This API's goal is to help your end to end testing with complex logic that is hard to mock.
This API's idea emerged while I was implementing a circuit breaker for an serverless application. How do I test? Mocking locally? Sure, but I wasn't confident it would work on a real world use case.
You can use this API for your testing, or not. I just hope it helps someone out there.
This API is free, and cost me in hosting, time and domain. You can "buy me a coffee" if you feel like it.
Made with <3 by a developer for developers.
Endpoints
HTTP statuses
curl "https://api.timeops.io/status/400"
The API will answer with this kind of message:
{
"code": 400,
"message": "Bad Request"
}
This endpoint let you get any HTTP status code back, with the corresponding description.
HTTP Request
GET https://api.timeops.io/status/:statusCode
URL Parameters
Parameter | Description |
---|---|
statusCode | The HTTP status code wanted |
Timeout
curl "https://api.timeops.io/timeout/2"
You will receive a 504 Gateway Timeout at the end of the x seconds.
{
"code": 504,
"message": "Gateway Timeout"
}
This endpoint will literally timeout for the number of seconds you give as URL parameter.
HTTP Request
GET https://api.timeops.io/timeout/:seconds
URL Parameters
Parameter | Description | Value range |
---|---|---|
seconds | Number of seconds the endpoint will wait before returning 504 Gateway Timeout. | [0; 60] |
Fail randomly
curl "https://api.timeops.io/failure/random/50"
In case of success:
{
"code": 200,
"message": "OK"
}
In case of failure:
{
"code": 500,
"message": "Internal Server Error"
}
This endpoint will fail randomly given a percentage of failure.
HTTP Request
GET https://api.timeops.io/failure/random/:percentage
URL Parameters
Parameter | Description | Value range |
---|---|---|
percentage | Percentage of chance to fail | [0; 100] |
API limits
curl "https://api.timeops.io/limit/12f3b771-e96b-4db4-9268-cfb632bfa942/50"
In case of success:
{
"code": 200,
"message": "OK",
"requests": 5,
"limit": 50,
"session_expiration": "2018-11-22T20:14:29.416108+07:00"
}
When you reach the API limit:
{
"code": 429,
"message": "Too Many Requests",
"requests": 51,
"limit": 50,
"session_expiration": "2018-11-22T20:14:29.416108+07:00"
}
This endpoint will counts the number of requests received for the given hash, and will start failing if it's above the limit given. The number of requests is only stored for 5 minutes, after which the counter will reset itself.
HTTP Request
GET https://api.timeops.io/limit/:hash/:limit
URL Parameters
Parameter | Description | Value range |
---|---|---|
limit | Number of requests limit for the given Hash to start failing | [0; 500] |
hash | Unique hash to count with | We recommend sending us a UUIDv4 or something unique so you don't collide with other users. |
Mirroring
curl "https://api.timeops.io/mirror" -X POST \
-d '{"test":"test"}' \
-H "Content-Type: application/json"
Response will be the exact same you send:
{
"test": "test"
}
This endpoint will send you back the exact same body you POST with the same Content-Type.
HTTP Request
POST https://api.timeops.io/mirror
Mirroring Websocket
wss://api.timeops.io/mirror/ws
Response will be the exact same you send:
This endpoint will send you back the exact same text you send through the websocket.
HTTP Request
GET wss://api.timeops.io/mirror/ws
CORS for Front-End
This CORS issue will only apply to frontend/websites. Any cURL/Postman/API2API call will respond with a 200 OK.
For more information about CORS, please refer to this link.
fetch("https://api.timeops.io/no-cors").then(function(response){
console.log(response);
});
You will experience a CORS issue on your front-end since this endpoint specifically Allow Origins on nothing.
HTTP Request
GET https://api.timeops.io/no-cors
Invalid SSL certificates
You can test all our endpoints with invalid SSL certificates, since it happens quite often despite free and easy SSL certs providers nowadays.
Just use this subdomain: