Get Mock API
Endpoint
GET /apiops/projects/{projectName}/mockapis/{mockApiName}/
Authentication
Requires a Personal API Access Token.
Header
Authorization: Bearer YOUR_TOKEN
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {token} | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| mockApiName | string | Yes | Mock API name |
Response
Success Response (200 OK)
The requested Mock API is returned as the single element of resultList. The example below is shortened.
{
"status": "SUCCESS",
"resultList": [
{
"id": "66f1c0a2e4b0a1b2c3d4e5f6",
"name": "Customer Accounts",
"description": "Mock of the customer accounts service",
"version": "1.0.0",
"projectId": "66f1bf10e4b0a1b2c3d4e5a1",
"methodDefList": [
{
"id": "3f7c2a4e-7d0b-4a51-9a8e-0c1d2e3f4a5b",
"name": "/customers/{id}",
"description": "Returns one customer",
"httpMethod": "GET",
"summary": "Get customer",
"operationId": "getCustomer",
"tag": "Customers",
"parameterList": [
{
"name": "id",
"location": "path",
"type": "integer",
"required": true,
"example": "1",
"description": null
}
],
"requestBody": null,
"responseList": [
{
"uuid": "8b0e5f3a-2c4d-4e6f-8a1b-3c5d7e9f1a2b",
"httpStatusCode": "OK",
"headerList": [],
"description": "Customer found",
"exampleList": [
{
"uuid": "1d2e3f4a-5b6c-4d7e-8f9a-0b1c2d3e4f5a",
"name": null,
"responseContentType": "application/json",
"responseBody": "{\"id\": 1, \"name\": \"Customer 1\"}"
}
]
}
]
}
]
}
],
"resultCount": 1
}
Response Fields
| Field | Type | Description |
|---|---|---|
| id, name, description, version, projectId | string | Same as in List Mock APIs |
| methodDefList | array | Endpoints of the Mock API |
| methodDefList[].name | string | Path of the endpoint, for example /customers/{id} |
| methodDefList[].httpMethod | string | HTTP method, for example GET |
| methodDefList[].description | string | Endpoint description |
| methodDefList[].summary | string | Operation summary in the OpenAPI specification. When it is null, the specification uses the description. |
| methodDefList[].operationId | string | Operation ID in the OpenAPI specification. When it is null, the specification uses a generated value, for example get_customers. |
| methodDefList[].tag | string | Operation tag in the OpenAPI specification. When it is null, the specification uses the Mock API name. |
| methodDefList[].parameterList | array | Parameters of the endpoint. Each parameter has name, location (path, query, header, or cookie), type (string, integer, number, boolean, or array), required, example, and description. |
| methodDefList[].requestBody | object | Request body with mediaType, required, and schema (a JSON Schema as text). null when the endpoint has no request body. |
| methodDefList[].responseList | array | Responses of the endpoint. Each response has httpStatusCode (for example OK or NOT_FOUND), description, headerList (items with name and value), and exampleList. |
| methodDefList[].responseList[].exampleList | array | Examples of the response. Each example has name, responseContentType, responseBody, and policyCondition (the conditions of the example). An example without condition rules is the default example. |
Error Response (400 Bad Request)
The project has no Mock API with this name, or the user does not have the required permission.
{
"status": "FAILURE",
"resultMessage": "MockAPI (name: Customer Accounts) was not found!"
}
Error Response (401 Unauthorized)
The token is missing or not valid. For the error format, see Error Handling.
cURL Example
curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/mockapis/Customer%20Accounts/" \
-H "Authorization: Bearer YOUR_TOKEN"
Notes and Warnings
- Read-only: This endpoint does not modify anything and does not trigger a deployment
- Name lookup: The name must match the Mock API name exactly. Encode spaces and special characters in the URL.
- Reuse: You can send the returned object to Create or Update Mock API in another project or another Apinizer installation
Permissions
- User must have
API_CREATOR+VIEWpermission in the project
Related Documentation
- List Mock APIs - List all Mock APIs of a project
- Create or Update Mock API - Save a Mock API definition by name
- Creating Mock API with API Creator - Endpoints, responses, and examples in the Manager UI