Mock call logs

GET https://api.getpostman.com/mocks/{{mock_uid}}/call-logs

Call logs contain request and response data that is exchanged during requests/calls that are made to the mock servers.

These call logs provide quick observability into how your mock servers are being used. This data can be used for debugging, testing, analysis, and much more depending upon your use case.

You can get a filtered list of call logs using these filters:

  • since
  • until
  • responseStatusCode
  • responseType
  • requestMethod
  • requestPath

You can sort the call logs using the sort and direction params.

You can use the limit param to define the number of call logs to be fetched in one API call. The allowed range for this argument is 1-100 and the default value is set to 100.

This API supports cursor-based pagination meaning if your mock server had more call logs than what could be returned in one API call then you can take the value of nextCursor property(which points to the next record to be fetched) from the API response and assign it to cursor param while making the next request to the call logs API.

You can get a maximum of 6.5MB worth of call logs or 100 call logs whichever limit is met first in one API call.

You can access call logs data using the Qodex UI as well.

Request Params

KeyDatatypeRequiredDescription
limitstringDefines the number of records that will be returned per page of the response. This field can take a value between 1 and 100, the default is set to 100.
cursorstringA pointer to the first record of the set of results to be retrieved.
sincestringOnly return call logs that have been created at and after this time. Time is represented using the ISO 8601 UTC date and time format(e.g: 2021-10-13T08:17:24.000Z).
untilstringOnly return call logs that have been created at and before this time. Time is represented using the ISO 8601 UTC date and time format(e.g: 2021-10-13T08:17:24.000Z).
responseStatusCodestringOnly return call logs that have matching HTTP response status code.
responseTypestringOnly return call logs that have matching response type i.e. success / error. Matching is case insensitive.
requestMethodstringOnly return call logs that have matching HTTP method. Matching is case insensitive.
requestPathstringOnly return call logs that have matching request's path. Matching is case insensitive. e.g: /animals?type=dog
sortstringSort the retrieved call logs based on a property. Currently, the logs can only be sorted by servedAt field. This param needs to be used in conjunction with the direction param.
directionstringThe sorting direction, which can be ascending or descending. The value can be asc to specify an ascending direction or desc to specify a descending direction. This param needs to be used in conjunction with the sort param. Matching is case insensitive.
includestringPopulate call log records with header and body information. Allowed values for this field are request.headers, request.body, response.headers and response.body. Also, a comma-separated combination of these allowed values can be sent while fetching the call logs.

RESPONSES

status: OK

{"call-logs":[{"id":"c4505a1e-7261-497c-91ff-db4bd51351a6-9545","responseName":"Double check your method and the request path and try again.","servedAt":"2022-01-17T06:19:30.000Z","request":{"method":"POST","path":"/animals","headers":[{"key":"content-length","value":"50"},{"key":"x-mock-match-request-body","value":"true"},{"key":"content-type","value":"application/json"}],"body":{"mode":"raw","data":"{\"type\":\"hamster\",\"breed\":\"Syrian Hamster\"}"}},"response":{"type":"error","statusCode":404,"headers":[],"body":{"data":"{\"error\":{\"name\":\"mockRequestNotFoundError\",\"message\":\"Double check your method and the request path and try again.\"}}"}}},{"id":"0f63f54d-665e-436a-95b4-c1302d7685a9-3925","responseName":"Bad request","servedAt":"2022-01-17T06:19:22.000Z","request":{"method":"POST","path":"/animals","headers":[{"key":"content-length","value":"69"},{"key":"x-mock-match-request-body","value":"true"},{"key":"content-type","value":"application/json"}],"body":{"mode":"raw","data":"{\"type\":\"hamster\",\"breed\":\"Syrian Hamster\",\"age\":\"1 month\"}"}},"response":{"type":"success","statusCode":400,"headers":[{"description":{"content":"","type":"text/plain"},"key":"Content-Type","value":"application/json"}],"body":{"data":"{\n\t\"message\": \"Malformed request. You need to send gender as part of the request.\"\n}"}}},{"id":"adab0d30-5c38-43bf-af90-4119925138e2-3795","responseName":"Successful addition of animals to the store","servedAt":"2022-01-17T06:19:16.000Z","request":{"method":"POST","path":"/animals","headers":[{"key":"content-length","value":"88"},{"key":"x-mock-match-request-body","value":"true"},{"key":"content-type","value":"application/json"}],"body":{"mode":"raw","data":"{\"type\":\"hamster\",\"breed\":\"Syrian Hamster\",\"age\":\"1 month\",\"gender\":\"male\"}"}},"response":{"type":"success","statusCode":200,"headers":[{"description":{"content":"","type":"text/plain"},"key":"Content-Type","value":"application/json"}],"body":{"data":"{\n\t\"message\": \"Animal added successfully to the store\"\n}"}}},{"id":"dae50669-f4c1-460a-b3a4-3a2445f4f39d-2468","responseName":"Get filtered list of Animals","servedAt":"2022-01-17T06:18:26.000Z","request":{"method":"GET","path":"/animals?type=dog","headers":[],"body":{}},"response":{"type":"success","statusCode":200,"headers":[{"description":{"content":"","type":"text/plain"},"key":"Content-Type","value":"application/json"}],"body":{"data":"[\n\t{\n\t\t\"type\": \"dog\",\n\t\t\"breed\": \"German Sheperd\",\n\t\t\"age\": \"6 months\",\n\t\t\"gender\": \"male\"\n\t},\n\t{\n\t\t\"type\": \"dog\",\n\t\t\"breed\": \"Bulldog\",\n\t\t\"age\": \"1 year\",\n\t\t\"gender\": \"female\"\n\t}\n]"}}},{"id":"a5330463-26e1-4812-a962-e44b569a2054-9894","responseName":"Get Animals","servedAt":"2022-01-17T06:18:06.000Z","request":{"method":"GET","path":"/animals","headers":[],"body":{}},"response":{"type":"success","statusCode":200,"headers":[{"description":{"content":"","type":"text/plain"},"key":"Content-Type","value":"application/json"}],"body":{"data":"[\n\t{\n\t\t\"type\": \"dog\",\n\t\t\"breed\": \"German Sheperd\",\n\t\t\"age\": \"6 months\",\n\t\t\"gender\": \"male\"\n\t},\n\t{\n\t\t\"type\": \"dog\",\n\t\t\"breed\": \"Bulldog\",\n\t\t\"age\": \"1 year\",\n\t\t\"gender\": \"female\"\n\t},\n\t{\n\t\t\"type\": \"cat\",\n\t\t\"breed\": \"Persian cat\",\n\t\t\"age\": \"3 months\",\n\t\t\"gender\": \"female\"\n\t}\n]"}}}],"meta":{"nextCursor":null}}