Data Management

Metadata API | Request History

Summary

Hey there! In this guide, we'll explore how to use Xano's new metadata API to retrieve and filter your application's request history. This powerful feature allows you to access and analyze your request data in a way that suits your needs, giving you better visibility and control over your application's performance.

Browsing Request History

The first endpoint we'll look at is the `GET` endpoint that allows us to browse the entire request history for a particular workspace. To use this endpoint, you'll need to provide your workspace ID, like so:

GET https://api.xano.io/metadata/v1/workspaces/{workspaceId}/requests

This will return the complete request history for the specified workspace, with no filtering applied. However, you can use various query parameters to refine the results:

  • `page` and `perPage`: Specify which page of results to retrieve and how many items per page.
  • `branchId`: Filter results by a specific branch ID.
  • `apiId`: Filter results by a specific API ID.
  • `queryId`: Filter results by a specific query ID.
  • `includeOutput`: Include the response output in the results (defaults to `false`).

Here's an example of how you might use this endpoint with some additional filtering:

GET https://api.xano.io/metadata/v1/workspaces/{workspaceId}/requests?page=1&perPage=20&branchId=abc123&apiId=def456&queryId=ghi789&includeOutput=true

This request would retrieve the first 20 results from the request history, filtered by a specific branch, API, and query, and include the response output in the results.

Searching Request History

The second endpoint we'll explore is the `POST` endpoint that allows you to search your request history based on specific criteria. To use this endpoint, you'll need to provide your workspace ID and a search object:

POST https://api.xano.io/metadata/v1/workspaces/{workspaceId}/requests/search

The search object can include various properties to filter the results, such as `status`, `method`, `path`, and more. For example, let's say you want to search for all requests that returned a 200 status code:

json { "status": 200 }

You can then send this search object as the request body:

POST https://api.xano.io/metadata/v1/workspaces/{workspaceId}/requests/search Content-Type: application/json { "status": 200 }

This will return all requests from the specified workspace that had a status of 200.

You can also combine multiple search criteria to further refine your results. For instance, to find all `GET` requests to a specific path that returned a 400 status code:

json { "status": 400, "method": "GET", "path": "/api/users" }

This endpoint also supports the `page`, `perPage`, `branchId`, `apiId`, and `queryId` query parameters, just like the browsing endpoint.

Use Cases

Being able to access and filter your request history opens up a wide range of possibilities. Here are a few examples of how you might leverage this functionality:

  • Error Monitoring: Search for requests with non-200 status codes to identify and investigate errors in your application.
  • Performance Monitoring: Analyze response times and identify slow-performing endpoints or queries.
  • Auditing: Track and log user activities or changes to sensitive data.
  • Debugging: Recreate and investigate issues reported by users by examining the request data.
  • Analytics: Gain insights into user behavior, traffic patterns, and usage trends.

Conclusion

Xano's metadata API provides a powerful way to access and work with your application's request history. By leveraging these endpoints, you can gain deeper insights into your application's performance, identify and resolve issues more efficiently, and unlock new possibilities for monitoring, analytics, and optimization.

Keep an eye out for more updates and new features in the metadata API, as Xano continues to expand its capabilities. Happy coding (or no-coding, as the case may be)!

This transcript was AI generated to allow users to quickly answer technical questions about Xano.

Was this helpful?

I found it helpful

I need more support
Sign up for XanoSign up for Xano

Build without limits on a secure, scalable backend.

Unblock your team's progress and create a backend that will scale for free.

Start building for free