MockThis is a command-line interface (CLI) tool for managing publicly available mock API endpoints. It allows users to create, update, delete, and list mock endpoints for testing and development purposes.
- User authentication (login and registration)
- Create new mock endpoints
- Delete endpoints
- List all created endpoints
- Get details of specific endpoints
To install MockThis on macOS using Homebrew, follow these steps:
-
First, tap the repository:
brew tap nicobistolfi/carbon -
Then, install MockThis:
brew install mockthis
The general syntax for using MockThis is:
mockthis [command] [flags]
create: Create a new mock endpointdelete: Remove an endpointlist: Display all created endpointsget: Retrieve details of a specific endpointlogin: Authenticate userregister: Create a new user accountcompletion: Generate shell autocompletion scripts
For detailed information on each command, use:
mockthis [command] --help
To register a new user account, use the register command. You can provide your email as an argument or enter it when prompted.
mockthis register
To log in to MockThis, use the login command. You can either provide your email as an argument or enter it when prompted.
mockthis login {email}
If you don't provide an email, you will be prompted to enter it.
To create a new mock endpoint, use the create command. You can provide the endpoint details as arguments or enter them when prompted.
mockthis create -m GET -s 200 -b '{"message": "Hello, World!"}'
Comand line output will include the endpoint details, such as the method, status, body, and path.
Endpoint created successfully!
Mock URL: https://api.mockthis.io/m/c35f0f6-af9d-4976-8ff9-d45e1dee8832
| Field | Value |
+---------------------+--------------------------------------+
| ID | c35f0f6-af9d-4976-8ff9-d45e1dee8832 |
| Method | GET |
| Status | 200 |
| ResponseContentType | application/json |
| ResponseBody | {"message": "Hello, World!"} |
| CreatedAt | 2024-09-17T02:29:45Z |
| Charset | UTF-8 |
The roadmap may change witouth notice.
- Include JSON schema and validate schema for endpoint creation using
—file - Enable
mockthis updateto update already existing endpoints - Update
mockthis getto use the get endpoint instead of list - Allow the use of
—schemato ensure the response body matches the schema - Allow the use of
—request-schemato ensure the request body matches the schema - Implement header
X-Mock-Dynamic: truein the request and use the schema to generate a dynamic response