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.
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:
- The query, SELECT * FROM DBC.DBCInfo to the system with the alias "mysystem"
- The username and password "dbc" (ZGJjOmRiYw== is "dbc:dbc" Base64 encoded)
- The format for response ("format": "array")
- The request to include column information ("includeColumns": true)
Responses to SQL requests are synchronous, meaning the HTTP response to the HTTP request contains the SQL request results.