Get API by Code
The api query in admin lets you retrieve one API definition by using a search filter.
This is useful when you need to inspect:
- API metadata (
code,label) - API-level advisories (
adviseMessage) - Error catalog and available operations for that API
Query Overviewβ
Path: admin/get-api/
GraphQL root:
admin {
api(where: {searchBy: CODE, search: "hotel"}) {
...
}
}
Unlike allAccesses, allSuppliers, and allClients, this query returns a single api node (not a connection).
API Requestβ
Returned fields:
adviseMessage(code,description,level)apiData.codeapiData.labelapiData.errorCatalog(code,description,type,level)apiData.operations.edges.node.operationData(code,label,types)
Complete Query Exampleβ
Here is a complete example of the api query with all fields included:
admin {
api(where: {searchBy: CODE, search: "hotel"}) {
adviseMessage {
code
description
level
}
apiData {
code
label
errorCatalog {
code
description
type
level
}
operations {
edges {
node {
operationData {
code
label
types
}
}
}
}
}
}
}
Query Exampleβ
Simple Requestβ
This example retrieves metadata for a specific API using its code.
query {
admin {
api(where: {searchBy: CODE, search: "hotel"}) {
apiData {
code
label
errorCatalog {
code
description
type
level
}
operations {
edges {
node {
operationData {
code
label
types
}
}
}
}
}
}
}
}
Variables Exampleβ
This query does not require variables.
{}
Response Exampleβ
Here is an example of the response:
{
"data": {
"admin": {
"api": {
"apiData": {
"code": "api-code",
"label": "api-label",
"errorCatalog": [
{
"code": "error-code",
"description": "error-description",
"type": "error-type",
"level": "error-level"
}
],
"operations": {
"edges": [
{
"node": {
"operationData": {
"code": "operation-code",
"label": "operation-label",
"types": ["operation-type"]
}
}
}
]
}
}
}
}
}
}
Response Considerationsβ
searchBy: CODE+search: "hotel"filters the API by its code.errorCatalogis useful for mapping business/technical errors expected for that API.operationshelps you discover which operation types are available before implementing flows.
Common Use Casesβ
- Inspect API Information: Retrieve data such as
codeandlabelfor specific APIs. - Analyze API Error Catalogs: Access error codes and descriptions to troubleshoot API issues.
- Validate API Operations: Check available operations for an API to ensure compatibility with your integration.