Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcDash_name
LOCAL lcDash_url
LOCAL lcEmbed_id
LOCAL lcGraph_title
LOCAL lcHtml
LOCAL lnRevoked
LOCAL lnShared_by
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
loHttp.SetRequestHeader("Accept","application/json")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://api.app.ddog-gov.com/api/v1/graph/embed/:embed_id",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "dash_name": "proident ut commodo",
* "dash_url": "sint elit",
* "embed_id": "velit",
* "graph_title": "Excepteur ea consectetur sunt sint",
* "html": "non cupidatat in veniam",
* "revoked": false,
* "shared_by": 76702863
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcDash_name = loJResp.StringOf("dash_name")
lcDash_url = loJResp.StringOf("dash_url")
lcEmbed_id = loJResp.StringOf("embed_id")
lcGraph_title = loJResp.StringOf("graph_title")
lcHtml = loJResp.StringOf("html")
lnRevoked = loJResp.BoolOf("revoked")
lnShared_by = loJResp.IntOf("shared_by")
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X GET
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v1/graph/embed/:embed_id
Postman Collection Item JSON
{
"name": "Get specific embed",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/graph/embed/:embed_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"graph",
"embed",
":embed_id"
],
"variable": [
{
"key": "embed_id",
"value": "tempor Ut sed velit"
}
]
},
"description": "Get the HTML fragment for a previously generated embed with `embed_id`."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/graph/embed/:embed_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"graph",
"embed",
":embed_id"
],
"variable": [
{
"key": "embed_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"dash_name\": \"proident ut commodo\",\n \"dash_url\": \"sint elit\",\n \"embed_id\": \"velit\",\n \"graph_title\": \"Excepteur ea consectetur sunt sint\",\n \"html\": \"non cupidatat in veniam\",\n \"revoked\": false,\n \"shared_by\": 76702863\n}"
},
{
"name": "Authentication Error",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/graph/embed/:embed_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"graph",
"embed",
":embed_id"
],
"variable": [
{
"key": "embed_id"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Not found",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/graph/embed/:embed_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"graph",
"embed",
":embed_id"
],
"variable": [
{
"key": "embed_id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Too many requests",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v1/graph/embed/:embed_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"graph",
"embed",
":embed_id"
],
"variable": [
{
"key": "embed_id"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
}
]
}