Use the Sort API to track issues in your Snowflake or Postgres data
The Sort API offers powerful tools to track, manage, and resolve data issues
Managing data issues is a critical aspect of maintaining the integrity and performance of your data systems. Whether you're working with Snowflake or PostgreSQL, the Sort API offers powerful tools to track, manage, and resolve issues efficiently. In this post, we'll explore how you can leverage the Sort API to streamline your data operations and ensure smooth workflows.
Why Use the Sort API?
The Sort API provides a comprehensive suite of endpoints to interact with your Sort databases. This includes querying data, creating and managing Issues, submitting Change Requests, and more. It's particularly useful for monitoring and addressing data inconsistencies, bugs, and other operational challenges in your databases.
Key Features:
Track Issues: Log and track data issues across Snowflake or Postgres databases.
Change Requests: Manage database changes in a structured manner.
Customizable Labels: Organize Issues with labels for better categorization.
Automated Workflows: Use API integrations to automate issue tracking and resolution.
Getting Started
Step 1: Get Your API Key
To begin, you'll need an API key. Visit the Sort Documentation to learn how to obtain your free API key. Once you have it, you can include it in your HTTP requests to authenticate your API calls.
Here’s how to include your API key in a request:
curl --request GET \
--url https://api.sort.xyz/v2/my/profile \
--header 'x-api-key: YOUR_API_KEY' \
--header 'accept: application/json'
Step 2: List Database Issues
To fetch all Issues related to a specific database, use the /issues
endpoint. This endpoint provides an overview of current data issues and their statuses.
Example Request:
curl --request GET \
--url https://api.sort.xyz/v2/orgs/ORG_SLUG/databases/DB_SLUG/issues \
--header 'x-api-key: YOUR_API_KEY'
Sample Response:
{
"type": "list_issues",
"payload": {
"issues": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"title": "Missing sales data",
"description": "Sales data for Q3 is incomplete.",
"status": "open",
"created_at": "2024-11-14T17:03:23.411Z",
"updated_at": "2024-11-14T17:03:23.411Z",
...
}
]
}
}
Step 3: Create a New Issue
To report a new data issue, you can use the POST /issues
endpoint. This helps document problems such as data discrepancies or inaccuracies.
Example Request:
curl --request POST \
--url https://api.sort.xyz/v2/orgs/ORG_SLUG/databases/DB_SLUG/issues \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data '{
"title": "Data mismatch in orders",
"description": "Order amounts do not match between source and target systems.",
"labels": ["high-priority", "bug"]
}'
Step 4: Update Issue Status
To change the status of an existing Issue (e.g., from "open" to "closed"), use the PATCH
method.
Example Request:
curl --request PATCH \
--url https://api.sort.xyz/v2/orgs/ORG_SLUG/databases/DB_SLUG/issues/1 \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data '{
"status": "closed"
}'
Advanced Workflows
Search Issues
Use the search/issues
endpoint to filter and find specific Issues based on their status, labels, or assignees.
curl --request GET \
--url https://api.sort.xyz/v2/orgs/ORG_SLUG/databases/DB_SLUG/search/issues?q=status:open&limit=5 \
--header 'x-api-key: YOUR_API_KEY'
Relating Issues to Change Requests
Change Requests enable changes to the data in your database. Relating Issues to Change Requests helps track the resolution journey and makes it easy to find out why the change was proposed.
curl --request POST \
--url https://api.sort.xyz/v2/orgs/ORG_SLUG/databases/DB_SLUG/change-requests/1/relations \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data '{
"issue_number": 1
}'
Conclusion
The Sort API empowers teams to efficiently track and resolve data issues in Snowflake or PostgreSQL. By integrating these capabilities into your workflows, you can enhance your data governance, improve operational efficiency, and ensure data reliability.
For more details, explore Sort’s API Reference Documentation. Happy debugging!
Your writing always inspires me! The way you emphasize a well-structured API design has encouraged me to refine my own approach. EchoAPI has been a valuable asset in this regard.