PowerBuilder / Datadog API Collection / Get all service definitions
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Github_html_url
string ls_Ingested_schema_version
string ls_Ingestion_source
string ls_Last_modified_time
string ls_Origin
string ls_Origin_detail
string ls_Schema_version
string ls_Dd_service
string ls_Description
string ls_Display_name
string ls_Service_tier
string ls_V_Email
string ls_Slack
string ls_Pagerduty
string ls_Application
string ls_Team
string ls_Id
string ls_V_type
integer j
integer li_Count_j
string ls_Instance_location
string ls_Keyword_location
string ls_Message
string ls_Name
string ls_Url
string ls_StrVal
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateInt("page[size]",10)
loo_QueryParams.UpdateInt("page[number]",0)
loo_QueryParams.UpdateString("schema_version","v1")
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.QuickRequestParams("GET","https://api.app.ddog-gov.com/api/v2/services/definitions",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "data": [
// {
// "attributes": {
// "meta": {
// "github-html-url": "<string>",
// "ingested-schema-version": "<string>",
// "ingestion-source": "<string>",
// "last-modified-time": "<string>",
// "origin": "<string>",
// "origin-detail": "<string>",
// "warnings": [
// {
// "instance-location": "<string>",
// "keyword-location": "<string>",
// "message": "<string>"
// },
// {
// "instance-location": "<string>",
// "keyword-location": "<string>",
// "message": "<string>"
// }
// ]
// },
// "schema": {
// "schema-version": "v1",
// "info": {
// "dd-service": "<string>",
// "description": "<string>",
// "display-name": "<string>",
// "service-tier": "<string>"
// },
// "contact": {
// "email": "<email>",
// "slack": "<string>"
// },
// "extensions": {
// "ut_a": {},
// "consequat_894": {}
// },
// "external-resources": [
// {
// "name": "<string>",
// "type": "url",
// "url": "<string>"
// },
// {
// "name": "<string>",
// "type": "repo",
// "url": "<string>"
// }
// ],
// "integrations": {
// "pagerduty": "<string>"
// },
// "org": {
// "application": "<string>",
// "team": "<string>"
// },
// "tags": [
// "<string>",
// "<string>"
// ]
// }
// },
// "id": "<string>",
// "type": "<string>"
// },
// {
// "attributes": {
// "meta": {
// "github-html-url": "<string>",
// "ingested-schema-version": "<string>",
// "ingestion-source": "<string>",
// "last-modified-time": "<string>",
// "origin": "<string>",
// "origin-detail": "<string>",
// "warnings": [
// {
// "instance-location": "<string>",
// "keyword-location": "<string>",
// "message": "<string>"
// },
// {
// "instance-location": "<string>",
// "keyword-location": "<string>",
// "message": "<string>"
// }
// ]
// },
// "schema": {
// "schema-version": "v1",
// "info": {
// "dd-service": "<string>",
// "description": "<string>",
// "display-name": "<string>",
// "service-tier": "<string>"
// },
// "contact": {
// "email": "<email>",
// "slack": "<string>"
// },
// "extensions": {
// "dolor1_9": {},
// "ea_7c": {},
// "consequat_a": {}
// },
// "external-resources": [
// {
// "name": "<string>",
// "type": "oncall",
// "url": "<string>"
// },
// {
// "name": "<string>",
// "type": "code",
// "url": "<string>"
// }
// ],
// "integrations": {
// "pagerduty": "<string>"
// },
// "org": {
// "application": "<string>",
// "team": "<string>"
// },
// "tags": [
// "<string>",
// "<string>"
// ]
// }
// },
// "id": "<string>",
// "type": "<string>"
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
i = 0
li_Count_i = loo_JResp.SizeOfArray("data")
do while i < li_Count_i
loo_JResp.I = i
ls_Github_html_url = loo_JResp.StringOf("data[i].attributes.meta.github-html-url")
ls_Ingested_schema_version = loo_JResp.StringOf("data[i].attributes.meta.ingested-schema-version")
ls_Ingestion_source = loo_JResp.StringOf("data[i].attributes.meta.ingestion-source")
ls_Last_modified_time = loo_JResp.StringOf("data[i].attributes.meta.last-modified-time")
ls_Origin = loo_JResp.StringOf("data[i].attributes.meta.origin")
ls_Origin_detail = loo_JResp.StringOf("data[i].attributes.meta.origin-detail")
ls_Schema_version = loo_JResp.StringOf("data[i].attributes.schema.schema-version")
ls_Dd_service = loo_JResp.StringOf("data[i].attributes.schema.info.dd-service")
ls_Description = loo_JResp.StringOf("data[i].attributes.schema.info.description")
ls_Display_name = loo_JResp.StringOf("data[i].attributes.schema.info.display-name")
ls_Service_tier = loo_JResp.StringOf("data[i].attributes.schema.info.service-tier")
ls_V_Email = loo_JResp.StringOf("data[i].attributes.schema.contact.email")
ls_Slack = loo_JResp.StringOf("data[i].attributes.schema.contact.slack")
ls_Pagerduty = loo_JResp.StringOf("data[i].attributes.schema.integrations.pagerduty")
ls_Application = loo_JResp.StringOf("data[i].attributes.schema.org.application")
ls_Team = loo_JResp.StringOf("data[i].attributes.schema.org.team")
ls_Id = loo_JResp.StringOf("data[i].id")
ls_V_type = loo_JResp.StringOf("data[i].type")
j = 0
li_Count_j = loo_JResp.SizeOfArray("data[i].attributes.meta.warnings")
do while j < li_Count_j
loo_JResp.J = j
ls_Instance_location = loo_JResp.StringOf("data[i].attributes.meta.warnings[j].instance-location")
ls_Keyword_location = loo_JResp.StringOf("data[i].attributes.meta.warnings[j].keyword-location")
ls_Message = loo_JResp.StringOf("data[i].attributes.meta.warnings[j].message")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("data[i].attributes.schema.external-resources")
do while j < li_Count_j
loo_JResp.J = j
ls_Name = loo_JResp.StringOf("data[i].attributes.schema.external-resources[j].name")
ls_V_type = loo_JResp.StringOf("data[i].attributes.schema.external-resources[j].type")
ls_Url = loo_JResp.StringOf("data[i].attributes.schema.external-resources[j].url")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("data[i].attributes.schema.tags")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("data[i].attributes.schema.tags[j]")
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -G -d "page[size]=10"
-d "page[number]=0"
-d "schema_version=v1"
-H "Accept: application/json"
https://api.app.ddog-gov.com/api/v2/services/definitions
Postman Collection Item JSON
{
"name": "Get all service definitions",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/services/definitions?page[size]=10&page[number]=0&schema_version=v1",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"services",
"definitions"
],
"query": [
{
"key": "page[size]",
"value": "10",
"description": "Size for a given page. The maximum allowed value is 100."
},
{
"key": "page[number]",
"value": "0",
"description": "Specific page number to return."
},
{
"key": "schema_version",
"value": "v1",
"description": "The schema version desired in the response."
}
]
},
"description": "Get a list of all service definitions from the Datadog Service Catalog."
},
"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/v2/services/definitions?page[size]=10&page[number]=0&schema_version=v1",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"services",
"definitions"
],
"query": [
{
"key": "page[size]",
"value": "10",
"description": "Size for a given page. The maximum allowed value is 100."
},
{
"key": "page[number]",
"value": "0",
"description": "Specific page number to return."
},
{
"key": "schema_version",
"value": "v1",
"description": "The schema version desired in the response."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"attributes\": {\n \"meta\": {\n \"github-html-url\": \"<string>\",\n \"ingested-schema-version\": \"<string>\",\n \"ingestion-source\": \"<string>\",\n \"last-modified-time\": \"<string>\",\n \"origin\": \"<string>\",\n \"origin-detail\": \"<string>\",\n \"warnings\": [\n {\n \"instance-location\": \"<string>\",\n \"keyword-location\": \"<string>\",\n \"message\": \"<string>\"\n },\n {\n \"instance-location\": \"<string>\",\n \"keyword-location\": \"<string>\",\n \"message\": \"<string>\"\n }\n ]\n },\n \"schema\": {\n \"schema-version\": \"v1\",\n \"info\": {\n \"dd-service\": \"<string>\",\n \"description\": \"<string>\",\n \"display-name\": \"<string>\",\n \"service-tier\": \"<string>\"\n },\n \"contact\": {\n \"email\": \"<email>\",\n \"slack\": \"<string>\"\n },\n \"extensions\": {\n \"ut_a\": {},\n \"consequat_894\": {}\n },\n \"external-resources\": [\n {\n \"name\": \"<string>\",\n \"type\": \"url\",\n \"url\": \"<string>\"\n },\n {\n \"name\": \"<string>\",\n \"type\": \"repo\",\n \"url\": \"<string>\"\n }\n ],\n \"integrations\": {\n \"pagerduty\": \"<string>\"\n },\n \"org\": {\n \"application\": \"<string>\",\n \"team\": \"<string>\"\n },\n \"tags\": [\n \"<string>\",\n \"<string>\"\n ]\n }\n },\n \"id\": \"<string>\",\n \"type\": \"<string>\"\n },\n {\n \"attributes\": {\n \"meta\": {\n \"github-html-url\": \"<string>\",\n \"ingested-schema-version\": \"<string>\",\n \"ingestion-source\": \"<string>\",\n \"last-modified-time\": \"<string>\",\n \"origin\": \"<string>\",\n \"origin-detail\": \"<string>\",\n \"warnings\": [\n {\n \"instance-location\": \"<string>\",\n \"keyword-location\": \"<string>\",\n \"message\": \"<string>\"\n },\n {\n \"instance-location\": \"<string>\",\n \"keyword-location\": \"<string>\",\n \"message\": \"<string>\"\n }\n ]\n },\n \"schema\": {\n \"schema-version\": \"v1\",\n \"info\": {\n \"dd-service\": \"<string>\",\n \"description\": \"<string>\",\n \"display-name\": \"<string>\",\n \"service-tier\": \"<string>\"\n },\n \"contact\": {\n \"email\": \"<email>\",\n \"slack\": \"<string>\"\n },\n \"extensions\": {\n \"dolor1_9\": {},\n \"ea_7c\": {},\n \"consequat_a\": {}\n },\n \"external-resources\": [\n {\n \"name\": \"<string>\",\n \"type\": \"oncall\",\n \"url\": \"<string>\"\n },\n {\n \"name\": \"<string>\",\n \"type\": \"code\",\n \"url\": \"<string>\"\n }\n ],\n \"integrations\": {\n \"pagerduty\": \"<string>\"\n },\n \"org\": {\n \"application\": \"<string>\",\n \"team\": \"<string>\"\n },\n \"tags\": [\n \"<string>\",\n \"<string>\"\n ]\n }\n },\n \"id\": \"<string>\",\n \"type\": \"<string>\"\n }\n ]\n}"
},
{
"name": "Forbidden",
"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/v2/services/definitions?page[size]=10&page[number]=0&schema_version=v1",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"services",
"definitions"
],
"query": [
{
"key": "page[size]",
"value": "10",
"description": "Size for a given page. The maximum allowed value is 100."
},
{
"key": "page[number]",
"value": "0",
"description": "Specific page number to return."
},
{
"key": "schema_version",
"value": "v1",
"description": "The schema version desired in the response."
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\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/v2/services/definitions?page[size]=10&page[number]=0&schema_version=v1",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"services",
"definitions"
],
"query": [
{
"key": "page[size]",
"value": "10",
"description": "Size for a given page. The maximum allowed value is 100."
},
{
"key": "page[number]",
"value": "0",
"description": "Specific page number to return."
},
{
"key": "schema_version",
"value": "v1",
"description": "The schema version desired in the response."
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\n ]\n}"
}
]
}