To submit a SQL request to a Teradata Database using Query Service, send a POST request to the /system/[systemName]/queries endpoint, replacing [systemName] with the preconfigured alias of the system. The request contains credentials required to access the Teradata Database.
POST /systems/mysystem/queries HTTP/1.1 Authorization: Basic ZGJjOmRiYw==
Accept: application/vnd.com.teradata.rest-v1.0+json Content-Type: application/json
{
"query”:”SELECT * FROM DBC.DBCInfo”,
"format":”array", "includeColumns":true
}
The request includes:
- SELECT * FROM DBC.DBCInfo: The query to the system with the alias "mysystem".
- "format": "array": The format for response.
- "includeColumns": true: The request to include column information.
Responses to SQL requests are synchronous, meaning the HTTP response to the HTTP request contains the SQL request results.