Chilkat Online Tools

SQL Server / Datadog API Collection / Update a powerpack

Back to Collection Items

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    -- Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    -- The following JSON is sent in the request body.

    -- {
    --   "data": {
    --     "attributes": {
    --       "group_widget": {
    --         "definition": {
    --           "widgets": [
    --             {
    --               "definition": {
    --                 "mollit12": {}
    --               },
    --               "layout": {
    --                 "x": "<long>",
    --                 "y": "<long>",
    --                 "width": "<long>",
    --                 "height": "<long>"
    --               }
    --             },
    --             {
    --               "definition": {
    --                 "ut0_3": {}
    --               },
    --               "layout": {
    --                 "x": "<long>",
    --                 "y": "<long>",
    --                 "width": "<long>",
    --                 "height": "<long>"
    --               }
    --             }
    --           ],
    --           "layout_type": "<string>",
    --           "type": "<string>",
    --           "show_title": "<boolean>",
    --           "title": "<string>"
    --         },
    --         "layout": {
    --           "x": "<long>",
    --           "y": "<long>",
    --           "width": "<long>",
    --           "height": "<long>"
    --         }
    --       },
    --       "name": "<string>",
    --       "description": "<string>",
    --       "tags": [
    --         "<string>",
    --         "<string>"
    --       ],
    --       "template_variables": [
    --         {
    --           "name": "<string>",
    --           "defaults": [
    --             "<string>",
    --             "<string>"
    --           ]
    --         },
    --         {
    --           "name": "<string>",
    --           "defaults": [
    --             "<string>",
    --             "<string>"
    --           ]
    --         }
    --       ]
    --     },
    --     "id": "<string>",
    --     "relationships": {
    --       "author": {
    --         "email": "<string>",
    --         "handle": "<string>",
    --         "name": "<string>"
    --       }
    --     },
    --     "type": "<string>"
    --   }
    -- }

    DECLARE @json int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'data.attributes.group_widget.definition.widgets[0].definition.mollit12'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[0].layout.x', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[0].layout.y', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[0].layout.width', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[0].layout.height', '<long>'
    EXEC sp_OAMethod @json, 'UpdateNewObject', @success OUT, 'data.attributes.group_widget.definition.widgets[1].definition.ut0_3'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[1].layout.x', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[1].layout.y', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[1].layout.width', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.widgets[1].layout.height', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.layout_type', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.type', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.show_title', '<boolean>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.definition.title', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.layout.x', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.layout.y', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.layout.width', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.group_widget.layout.height', '<long>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.name', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.description', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.tags[0]', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.tags[1]', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.template_variables[0].name', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.template_variables[0].defaults[0]', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.template_variables[0].defaults[1]', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.template_variables[1].name', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.template_variables[1].defaults[0]', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.attributes.template_variables[1].defaults[1]', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.id', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.relationships.author.email', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.relationships.author.handle', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.relationships.author.name', '<string>'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'data.type', '<string>'

    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'

    DECLARE @sbRequestBody int
    -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbRequestBody OUT

    EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PTextSb', @resp OUT, 'PATCH', 'https://api.app.ddog-gov.com/api/v2/powerpacks/:powerpack_id', @sbRequestBody, 'utf-8', 'application/json', 0, 0
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbRequestBody
        RETURN
      END

    DECLARE @sbResponseBody int
    -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody

    DECLARE @jResp int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @resp

        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        EXEC @hr = sp_OADestroy @sbRequestBody
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      END
    EXEC @hr = sp_OADestroy @resp

    -- Sample JSON response:
    -- (Sample code for parsing the JSON response is shown below)

    -- {
    --   "data": {
    --     "attributes": {
    --       "group_widget": {
    --         "definition": {
    --           "widgets": [
    --             {
    --               "definition": {
    --                 "aliquip_83": {}
    --               },
    --               "layout": {
    --                 "x": "<long>",
    --                 "y": "<long>",
    --                 "width": "<long>",
    --                 "height": "<long>"
    --               }
    --             },
    --             {
    --               "definition": {
    --                 "etc": {},
    --                 "ut_a6": {},
    --                 "et5d": {}
    --               },
    --               "layout": {
    --                 "x": "<long>",
    --                 "y": "<long>",
    --                 "width": "<long>",
    --                 "height": "<long>"
    --               }
    --             }
    --           ],
    --           "layout_type": "<string>",
    --           "type": "<string>",
    --           "show_title": "<boolean>",
    --           "title": "<string>"
    --         },
    --         "layout": {
    --           "x": "<long>",
    --           "y": "<long>",
    --           "width": "<long>",
    --           "height": "<long>"
    --         }
    --       },
    --       "name": "<string>",
    --       "description": "<string>",
    --       "tags": [
    --         "<string>",
    --         "<string>"
    --       ],
    --       "template_variables": [
    --         {
    --           "name": "<string>",
    --           "defaults": [
    --             "<string>",
    --             "<string>"
    --           ]
    --         },
    --         {
    --           "name": "<string>",
    --           "defaults": [
    --             "<string>",
    --             "<string>"
    --           ]
    --         }
    --       ]
    --     },
    --     "id": "<string>",
    --     "relationships": {
    --       "author": {
    --         "email": "<string>",
    --         "handle": "<string>",
    --         "name": "<string>"
    --       }
    --     },
    --     "type": "<string>"
    --   },
    --   "included": [
    --     {
    --       "attributes": {
    --         "created_at": "<dateTime>",
    --         "disabled": "<boolean>",
    --         "email": "<string>",
    --         "handle": "<string>",
    --         "icon": "<string>",
    --         "modified_at": "<dateTime>",
    --         "name": "<string>",
    --         "service_account": "<boolean>",
    --         "status": "<string>",
    --         "title": "<string>",
    --         "verified": "<boolean>"
    --       },
    --       "id": "<string>",
    --       "relationships": {
    --         "org": {
    --           "data": {
    --             "id": "<string>",
    --             "type": "orgs"
    --           }
    --         },
    --         "other_orgs": {
    --           "data": [
    --             {
    --               "id": "<string>",
    --               "type": "orgs"
    --             },
    --             {
    --               "id": "<string>",
    --               "type": "orgs"
    --             }
    --           ]
    --         },
    --         "other_users": {
    --           "data": [
    --             {
    --               "id": "<string>",
    --               "type": "users"
    --             },
    --             {
    --               "id": "<string>",
    --               "type": "users"
    --             }
    --           ]
    --         },
    --         "roles": {
    --           "data": [
    --             {
    --               "id": "<string>",
    --               "type": "roles"
    --             },
    --             {
    --               "id": "<string>",
    --               "type": "roles"
    --             }
    --           ]
    --         }
    --       },
    --       "type": "users"
    --     },
    --     {
    --       "attributes": {
    --         "created_at": "<dateTime>",
    --         "disabled": "<boolean>",
    --         "email": "<string>",
    --         "handle": "<string>",
    --         "icon": "<string>",
    --         "modified_at": "<dateTime>",
    --         "name": "<string>",
    --         "service_account": "<boolean>",
    --         "status": "<string>",
    --         "title": "<string>",
    --         "verified": "<boolean>"
    --       },
    --       "id": "<string>",
    --       "relationships": {
    --         "org": {
    --           "data": {
    --             "id": "<string>",
    --             "type": "orgs"
    --           }
    --         },
    --         "other_orgs": {
    --           "data": [
    --             {
    --               "id": "<string>",
    --               "type": "orgs"
    --             },
    --             {
    --               "id": "<string>",
    --               "type": "orgs"
    --             }
    --           ]
    --         },
    --         "other_users": {
    --           "data": [
    --             {
    --               "id": "<string>",
    --               "type": "users"
    --             },
    --             {
    --               "id": "<string>",
    --               "type": "users"
    --             }
    --           ]
    --         },
    --         "roles": {
    --           "data": [
    --             {
    --               "id": "<string>",
    --               "type": "roles"
    --             },
    --             {
    --               "id": "<string>",
    --               "type": "roles"
    --             }
    --           ]
    --         }
    --       },
    --       "type": "users"
    --     }
    --   ]
    -- }

    -- Sample code for parsing the JSON response...
    -- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    DECLARE @layoutX nvarchar(4000)

    DECLARE @layoutY nvarchar(4000)

    DECLARE @layoutWidth nvarchar(4000)

    DECLARE @layoutHeight nvarchar(4000)

    DECLARE @strVal nvarchar(4000)

    DECLARE @name nvarchar(4000)

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @Created_at nvarchar(4000)

    DECLARE @Disabled nvarchar(4000)

    DECLARE @attributesEmail nvarchar(4000)

    DECLARE @attributesHandle nvarchar(4000)

    DECLARE @Icon nvarchar(4000)

    DECLARE @Modified_at nvarchar(4000)

    DECLARE @attributesName nvarchar(4000)

    DECLARE @Service_account nvarchar(4000)

    DECLARE @Status nvarchar(4000)

    DECLARE @attributesTitle nvarchar(4000)

    DECLARE @Verified nvarchar(4000)

    DECLARE @id nvarchar(4000)

    DECLARE @DataId nvarchar(4000)

    DECLARE @DataType nvarchar(4000)

    DECLARE @v_type nvarchar(4000)

    DECLARE @Layout_type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Layout_type OUT, 'data.attributes.group_widget.definition.layout_type'
    DECLARE @v_Type nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_Type OUT, 'data.attributes.group_widget.definition.type'
    DECLARE @Show_title nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Show_title OUT, 'data.attributes.group_widget.definition.show_title'
    DECLARE @Title nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Title OUT, 'data.attributes.group_widget.definition.title'
    DECLARE @X nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @X OUT, 'data.attributes.group_widget.layout.x'
    DECLARE @Y nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Y OUT, 'data.attributes.group_widget.layout.y'
    DECLARE @Width nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Width OUT, 'data.attributes.group_widget.layout.width'
    DECLARE @Height nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Height OUT, 'data.attributes.group_widget.layout.height'
    DECLARE @Name nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'data.attributes.name'
    DECLARE @Description nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Description OUT, 'data.attributes.description'
    DECLARE @Id nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Id OUT, 'data.id'
    DECLARE @v_Email nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @v_Email OUT, 'data.relationships.author.email'
    DECLARE @Handle nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @Handle OUT, 'data.relationships.author.handle'
    DECLARE @AuthorName nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @AuthorName OUT, 'data.relationships.author.name'
    DECLARE @dataType nvarchar(4000)
    EXEC sp_OAMethod @jResp, 'StringOf', @dataType OUT, 'data.type'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'data.attributes.group_widget.definition.widgets'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @layoutX OUT, 'data.attributes.group_widget.definition.widgets[i].layout.x'
        EXEC sp_OAMethod @jResp, 'StringOf', @layoutY OUT, 'data.attributes.group_widget.definition.widgets[i].layout.y'
        EXEC sp_OAMethod @jResp, 'StringOf', @layoutWidth OUT, 'data.attributes.group_widget.definition.widgets[i].layout.width'
        EXEC sp_OAMethod @jResp, 'StringOf', @layoutHeight OUT, 'data.attributes.group_widget.definition.widgets[i].layout.height'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'data.attributes.tags'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'data.attributes.tags[i]'
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'data.attributes.template_variables'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @name OUT, 'data.attributes.template_variables[i].name'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'data.attributes.template_variables[i].defaults'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @strVal OUT, 'data.attributes.template_variables[i].defaults[j]'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END
    SELECT @i = 0
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'included'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @Created_at OUT, 'included[i].attributes.created_at'
        EXEC sp_OAMethod @jResp, 'StringOf', @Disabled OUT, 'included[i].attributes.disabled'
        EXEC sp_OAMethod @jResp, 'StringOf', @attributesEmail OUT, 'included[i].attributes.email'
        EXEC sp_OAMethod @jResp, 'StringOf', @attributesHandle OUT, 'included[i].attributes.handle'
        EXEC sp_OAMethod @jResp, 'StringOf', @Icon OUT, 'included[i].attributes.icon'
        EXEC sp_OAMethod @jResp, 'StringOf', @Modified_at OUT, 'included[i].attributes.modified_at'
        EXEC sp_OAMethod @jResp, 'StringOf', @attributesName OUT, 'included[i].attributes.name'
        EXEC sp_OAMethod @jResp, 'StringOf', @Service_account OUT, 'included[i].attributes.service_account'
        EXEC sp_OAMethod @jResp, 'StringOf', @Status OUT, 'included[i].attributes.status'
        EXEC sp_OAMethod @jResp, 'StringOf', @attributesTitle OUT, 'included[i].attributes.title'
        EXEC sp_OAMethod @jResp, 'StringOf', @Verified OUT, 'included[i].attributes.verified'
        EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'included[i].id'
        EXEC sp_OAMethod @jResp, 'StringOf', @DataId OUT, 'included[i].relationships.org.data.id'
        EXEC sp_OAMethod @jResp, 'StringOf', @DataType OUT, 'included[i].relationships.org.data.type'
        EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'included[i].type'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'included[i].relationships.other_orgs.data'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'included[i].relationships.other_orgs.data[j].id'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'included[i].relationships.other_orgs.data[j].type'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'included[i].relationships.other_users.data'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'included[i].relationships.other_users.data[j].id'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'included[i].relationships.other_users.data[j].type'
            SELECT @j = @j + 1
          END
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'included[i].relationships.roles.data'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @id OUT, 'included[i].relationships.roles.data[j].id'
            EXEC sp_OAMethod @jResp, 'StringOf', @v_type OUT, 'included[i].relationships.roles.data[j].type'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @json
    EXEC @hr = sp_OADestroy @sbRequestBody
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

Curl Command

curl -X PATCH
	-H "Content-Type: application/json"
	-H "Accept: application/json"
	-d '{
  "data": {
    "attributes": {
      "group_widget": {
        "definition": {
          "widgets": [
            {
              "definition": {
                "mollit12": {}
              },
              "layout": {
                "x": "<long>",
                "y": "<long>",
                "width": "<long>",
                "height": "<long>"
              }
            },
            {
              "definition": {
                "ut0_3": {}
              },
              "layout": {
                "x": "<long>",
                "y": "<long>",
                "width": "<long>",
                "height": "<long>"
              }
            }
          ],
          "layout_type": "<string>",
          "type": "<string>",
          "show_title": "<boolean>",
          "title": "<string>"
        },
        "layout": {
          "x": "<long>",
          "y": "<long>",
          "width": "<long>",
          "height": "<long>"
        }
      },
      "name": "<string>",
      "description": "<string>",
      "tags": [
        "<string>",
        "<string>"
      ],
      "template_variables": [
        {
          "name": "<string>",
          "defaults": [
            "<string>",
            "<string>"
          ]
        },
        {
          "name": "<string>",
          "defaults": [
            "<string>",
            "<string>"
          ]
        }
      ]
    },
    "id": "<string>",
    "relationships": {
      "author": {
        "email": "<string>",
        "handle": "<string>",
        "name": "<string>"
      }
    },
    "type": "<string>"
  }
}'
https://api.app.ddog-gov.com/api/v2/powerpacks/:powerpack_id

Postman Collection Item JSON

{
  "name": "Update a powerpack",
  "request": {
    "method": "PATCH",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"data\": {\n    \"attributes\": {\n      \"group_widget\": {\n        \"definition\": {\n          \"widgets\": [\n            {\n              \"definition\": {\n                \"mollit12\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            },\n            {\n              \"definition\": {\n                \"ut0_3\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            }\n          ],\n          \"layout_type\": \"<string>\",\n          \"type\": \"<string>\",\n          \"show_title\": \"<boolean>\",\n          \"title\": \"<string>\"\n        },\n        \"layout\": {\n          \"x\": \"<long>\",\n          \"y\": \"<long>\",\n          \"width\": \"<long>\",\n          \"height\": \"<long>\"\n        }\n      },\n      \"name\": \"<string>\",\n      \"description\": \"<string>\",\n      \"tags\": [\n        \"<string>\",\n        \"<string>\"\n      ],\n      \"template_variables\": [\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        },\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        }\n      ]\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"author\": {\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"name\": \"<string>\"\n      }\n    },\n    \"type\": \"<string>\"\n  }\n}",
      "options": {
        "raw": {
          "headerFamily": "json",
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/api/v2/powerpacks/:powerpack_id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "v2",
        "powerpacks",
        ":powerpack_id"
      ],
      "variable": [
        {
          "key": "powerpack_id",
          "value": "<string>"
        }
      ]
    },
    "description": "Update a powerpack."
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"data\": {\n    \"attributes\": {\n      \"group_widget\": {\n        \"definition\": {\n          \"widgets\": [\n            {\n              \"definition\": {\n                \"mollit12\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            },\n            {\n              \"definition\": {\n                \"ut0_3\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            }\n          ],\n          \"layout_type\": \"<string>\",\n          \"type\": \"<string>\",\n          \"show_title\": \"<boolean>\",\n          \"title\": \"<string>\"\n        },\n        \"layout\": {\n          \"x\": \"<long>\",\n          \"y\": \"<long>\",\n          \"width\": \"<long>\",\n          \"height\": \"<long>\"\n        }\n      },\n      \"name\": \"<string>\",\n      \"description\": \"<string>\",\n      \"tags\": [\n        \"<string>\",\n        \"<string>\"\n      ],\n      \"template_variables\": [\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        },\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        }\n      ]\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"author\": {\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"name\": \"<string>\"\n      }\n    },\n    \"type\": \"<string>\"\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/powerpacks/:powerpack_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "powerpacks",
            ":powerpack_id"
          ],
          "variable": [
            {
              "key": "powerpack_id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"data\": {\n    \"attributes\": {\n      \"group_widget\": {\n        \"definition\": {\n          \"widgets\": [\n            {\n              \"definition\": {\n                \"aliquip_83\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            },\n            {\n              \"definition\": {\n                \"etc\": {},\n                \"ut_a6\": {},\n                \"et5d\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            }\n          ],\n          \"layout_type\": \"<string>\",\n          \"type\": \"<string>\",\n          \"show_title\": \"<boolean>\",\n          \"title\": \"<string>\"\n        },\n        \"layout\": {\n          \"x\": \"<long>\",\n          \"y\": \"<long>\",\n          \"width\": \"<long>\",\n          \"height\": \"<long>\"\n        }\n      },\n      \"name\": \"<string>\",\n      \"description\": \"<string>\",\n      \"tags\": [\n        \"<string>\",\n        \"<string>\"\n      ],\n      \"template_variables\": [\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        },\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        }\n      ]\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"author\": {\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"name\": \"<string>\"\n      }\n    },\n    \"type\": \"<string>\"\n  },\n  \"included\": [\n    {\n      \"attributes\": {\n        \"created_at\": \"<dateTime>\",\n        \"disabled\": \"<boolean>\",\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"icon\": \"<string>\",\n        \"modified_at\": \"<dateTime>\",\n        \"name\": \"<string>\",\n        \"service_account\": \"<boolean>\",\n        \"status\": \"<string>\",\n        \"title\": \"<string>\",\n        \"verified\": \"<boolean>\"\n      },\n      \"id\": \"<string>\",\n      \"relationships\": {\n        \"org\": {\n          \"data\": {\n            \"id\": \"<string>\",\n            \"type\": \"orgs\"\n          }\n        },\n        \"other_orgs\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            }\n          ]\n        },\n        \"other_users\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            }\n          ]\n        },\n        \"roles\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            }\n          ]\n        }\n      },\n      \"type\": \"users\"\n    },\n    {\n      \"attributes\": {\n        \"created_at\": \"<dateTime>\",\n        \"disabled\": \"<boolean>\",\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"icon\": \"<string>\",\n        \"modified_at\": \"<dateTime>\",\n        \"name\": \"<string>\",\n        \"service_account\": \"<boolean>\",\n        \"status\": \"<string>\",\n        \"title\": \"<string>\",\n        \"verified\": \"<boolean>\"\n      },\n      \"id\": \"<string>\",\n      \"relationships\": {\n        \"org\": {\n          \"data\": {\n            \"id\": \"<string>\",\n            \"type\": \"orgs\"\n          }\n        },\n        \"other_orgs\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"orgs\"\n            }\n          ]\n        },\n        \"other_users\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"users\"\n            }\n          ]\n        },\n        \"roles\": {\n          \"data\": [\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            },\n            {\n              \"id\": \"<string>\",\n              \"type\": \"roles\"\n            }\n          ]\n        }\n      },\n      \"type\": \"users\"\n    }\n  ]\n}"
    },
    {
      "name": "Bad Request",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"data\": {\n    \"attributes\": {\n      \"group_widget\": {\n        \"definition\": {\n          \"widgets\": [\n            {\n              \"definition\": {\n                \"mollit12\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            },\n            {\n              \"definition\": {\n                \"ut0_3\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            }\n          ],\n          \"layout_type\": \"<string>\",\n          \"type\": \"<string>\",\n          \"show_title\": \"<boolean>\",\n          \"title\": \"<string>\"\n        },\n        \"layout\": {\n          \"x\": \"<long>\",\n          \"y\": \"<long>\",\n          \"width\": \"<long>\",\n          \"height\": \"<long>\"\n        }\n      },\n      \"name\": \"<string>\",\n      \"description\": \"<string>\",\n      \"tags\": [\n        \"<string>\",\n        \"<string>\"\n      ],\n      \"template_variables\": [\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        },\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        }\n      ]\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"author\": {\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"name\": \"<string>\"\n      }\n    },\n    \"type\": \"<string>\"\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/powerpacks/:powerpack_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "powerpacks",
            ":powerpack_id"
          ],
          "variable": [
            {
              "key": "powerpack_id"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"errors\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}"
    },
    {
      "name": "Powerpack Not Found",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"data\": {\n    \"attributes\": {\n      \"group_widget\": {\n        \"definition\": {\n          \"widgets\": [\n            {\n              \"definition\": {\n                \"mollit12\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            },\n            {\n              \"definition\": {\n                \"ut0_3\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            }\n          ],\n          \"layout_type\": \"<string>\",\n          \"type\": \"<string>\",\n          \"show_title\": \"<boolean>\",\n          \"title\": \"<string>\"\n        },\n        \"layout\": {\n          \"x\": \"<long>\",\n          \"y\": \"<long>\",\n          \"width\": \"<long>\",\n          \"height\": \"<long>\"\n        }\n      },\n      \"name\": \"<string>\",\n      \"description\": \"<string>\",\n      \"tags\": [\n        \"<string>\",\n        \"<string>\"\n      ],\n      \"template_variables\": [\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        },\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        }\n      ]\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"author\": {\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"name\": \"<string>\"\n      }\n    },\n    \"type\": \"<string>\"\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/powerpacks/:powerpack_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "powerpacks",
            ":powerpack_id"
          ],
          "variable": [
            {
              "key": "powerpack_id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_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": "PATCH",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "DD-API-KEY",
            "value": "<API Key>"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"data\": {\n    \"attributes\": {\n      \"group_widget\": {\n        \"definition\": {\n          \"widgets\": [\n            {\n              \"definition\": {\n                \"mollit12\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            },\n            {\n              \"definition\": {\n                \"ut0_3\": {}\n              },\n              \"layout\": {\n                \"x\": \"<long>\",\n                \"y\": \"<long>\",\n                \"width\": \"<long>\",\n                \"height\": \"<long>\"\n              }\n            }\n          ],\n          \"layout_type\": \"<string>\",\n          \"type\": \"<string>\",\n          \"show_title\": \"<boolean>\",\n          \"title\": \"<string>\"\n        },\n        \"layout\": {\n          \"x\": \"<long>\",\n          \"y\": \"<long>\",\n          \"width\": \"<long>\",\n          \"height\": \"<long>\"\n        }\n      },\n      \"name\": \"<string>\",\n      \"description\": \"<string>\",\n      \"tags\": [\n        \"<string>\",\n        \"<string>\"\n      ],\n      \"template_variables\": [\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        },\n        {\n          \"name\": \"<string>\",\n          \"defaults\": [\n            \"<string>\",\n            \"<string>\"\n          ]\n        }\n      ]\n    },\n    \"id\": \"<string>\",\n    \"relationships\": {\n      \"author\": {\n        \"email\": \"<string>\",\n        \"handle\": \"<string>\",\n        \"name\": \"<string>\"\n      }\n    },\n    \"type\": \"<string>\"\n  }\n}",
          "options": {
            "raw": {
              "headerFamily": "json",
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/api/v2/powerpacks/:powerpack_id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "v2",
            "powerpacks",
            ":powerpack_id"
          ],
          "variable": [
            {
              "key": "powerpack_id"
            }
          ]
        }
      },
      "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}"
    }
  ]
}