ResBin is a service for creating mock API responses. You supply the response status and response body and ResBin will generate a unique endpoint your mock API response.
There are many use cases for a mock API service like ResBin, but here are the two most common utilizations:
- Often you want to build the frontend before the backend. ResBin lets you create mock API responses to use in your frontend before your backend is built to make for an easier transition later on.
- When running tests you need stable responses (of non-production) data to ensure that your tests are running correctly and it is not just a data error.
You could of course use ResBin for anything you want. If you have an interesting use-case for our service let us know!
To get started with ResBin, you need to create your first bin. Here are the simple steps to get you bin up and running:
- Navigate to the ResBin homepage.
- In the "Response status" field, enter the status you want your mock API response to return. For example, use 200 to mock successful responses, or 500 to mock error responses.
- In the "Response body" field, enter the content you want your mock API response to return. This can be any text or JSON data.
- Click the "Create bin" button to submit your response data and generate your mock API endpoint.
- You will be navigated to your mock API endpoint page that contains a review of the data you submitted as well as a new unique "API endpoint" URL.
- Make a HTTP GET request to your new API endpoint to retrieve your mock API data. The response status and body will reflect the data you entered.
Each field in a bin has certain requirements and expectations. If they are not met, they will throw errors on bin creation.
- resStatus (response status) — Integer between 100 and 600.
- resBody (response body) — String less than 1000 characters.
- recaptcha (ReCAPTCHA) — Valid ReCATPCHA
In order to discern between actual errors and purposefully set error responses, ResBin utilizes custom header attributes to send response results. Every bin response will contain two headers:
- resBinSuccess — Either `true` or `false`, indicating if there was an internal ResBin error. i.e. a 404 response is a REAL 404 response.
- resBinMessage — A human readable message to help determine what the error is.
Because Resbin is a free service it operated under certain restrictions and limitations. These are the current limitations of ResBin bins.
- Rate limit — Requests to a bin are limited to 10 requests in 10 second window. Every request beyond that window receive a 429 response.
- TTL — Bins will automatically expire after 90 days. Requests after 90 days will receive a 404 response.
If you feel like any of these limitations are too low, or you need an extension, let us know and we will do our best to extend it. These limitations are hopefully temporary and will be expanded or removed once ResBin grows.