Status API
Endpoint
Send a HTTP GET request to Onehouse REST API using the endpoint:
https://api.onehouse.ai/v1/status/{requestId}
{requestId} to be be replaced with 'requestId' received in SQL Command API response.
Required Headers
Name | Description |
---|---|
x-onehouse-account-uid | ID of the account. Find this in the Onehouse UI within the account console as AccountId when you click your profile in the top right. |
x-onehouse-project-uid | ID of the project. Find this in the Onehouse UI for the selected project as ProjectID when you click your profile in the top right. |
x-onehouse-api-key | Public key for your access token. Find this on the 'Tokens' tab of your service principal in the Onehouse console. |
x-onehouse-api-secret | Secret key for your access token. Find this when you create a new access token on the 'Tokens' tab of your service principal in the Onehouse console. |
x-onehouse-link-uid | Find this in the Onehouse UI for the selected project as RequestID when you click your profile in the top right. |
x-onehouse-region | Region for the project. Find this in the Onehouse UI on the project selector at the top of the screen. Example format: us-west-1 or us-west1 (all lowercase). |
x-onehouse-uuid | Your user ID. Find this in the Onehouse UI as UserID when you click your profile in the top right. You must be an admin in the Onehouse project or use a service principal. |
Sample Request
For example, you would query: GET https://api.onehouse.ai/v1/status/<id-from-previous-command>
. You may leave the body empty.
Sample Response
{
"apiStatus": "API_OPERATION_STATUS_SUCCESS"
"apiResponse": {
<api-response-payload>
}
}
apiStatus
Possible values for apiStatus
field:
API_OPERATION_STATUS_INVALID
: Semantic or Syntax Error in SQL Command API payload statementAPI_OPERATION_STATUS_PENDING
: Operation pendingAPI_OPERATION_STATUS_SUCCESS
: Operation completed successfullyAPI_OPERATION_STATUS_FAILED
: Operation failed when being executed by controller
apiResponse
apiResponse
field depends on the SQL Command API executed.
Rate Limiting
All projects have 10 queries per second. Reach out if you require a higher rate limit.
Python Example
This example checks the status of a specified request id. You can replace the request id with the one returned by your Onehoues SQL API command.
import requests
import json
base_url = "https://api.onehouse.ai/v1/status/"
api_key = "k+m3rTghtLXCVHwBEJAzMQ=="
api_secret = "fRpxkqwUBMN9yjT6+DmPL24zxfhSaWuvKnsBzHG1Bpq="
request_id = "8c3f2e9d-7a16-4d80-5b72-195e783a912f"
# Full URL for the status check
url = f"{base_url}{request_id}"
# Headers (reusing from your previous request, ensure these are correct)
headers = {
'x-onehouse-account-uid': '92e5f1ab-4c3a-4b81-b1fa-ec9c2e14d3f2',
'x-onehouse-project-uid': '3afe72cd-b841-4135-a673-1289c992edf7',
'x-onehouse-api-key': api_key,
'x-onehouse-api-secret': api_secret,
'x-onehouse-link-uid': 'da56fe8b-cde4-532a-9fbb-5edca787b459',
'x-onehouse-region': 'us-west-2',
'x-onehouse-uuid': 'fYxkwR3lzTXWe12g4hvcwFvLx7q2',
'x-onehouse-link-uid': 'da56fe8b-cde4-532a-9fbb-5edca787b459',
'x-onehouse-region': 'us-west-2',
'x-onehouse-uuid': 'fYxkwR3lzTXWe12g4hvcwFvLx7q2',
'Content-Type': 'application/json'
}
try:
print("Sending status check request...")
response = requests.get(url, headers=headers)
print(f"Status code: {response.status_code}")
print("Response headers:")
print(json.dumps(dict(response.headers), indent=2))
print("Response text:")
print(response.text)
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
print("Script completed.")