Chilkat Online Tools

SQL Server / Squadcast API V3 / Get All Squads

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

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'

    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 @http, 'QuickGetSb', @success OUT, 'https://api.squadcast.com/v3/squads', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END


    EXEC sp_OAGetProperty @http, 'LastStatus', @iTmp0 OUT
    PRINT 'Response status code = ' + @iTmp0
    EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
    PRINT @sTmp0

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody


END
GO

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api.squadcast.com/v3/squads

Postman Collection Item JSON

{
  "name": "Get All Squads",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{sq_pb_auth_header}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/squads",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "squads"
      ]
    },
    "description": "This endpoint is used to get all the squads details of your organization.\nRequires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-read` scope."
  },
  "response": [
    {
      "name": "Get All Squads",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/squads",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "squads"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"data\": [\n        {\n            \"id\": \"5dfa3451ba2cb0c5a4f12d48\",\n            \"name\": \"frontend\",\n            \"slug\": \"frontend\",\n            \"members\": [\n                \"5df9d90aba2cb0c5a4f12d44\",\n                \"5df9d8f1ba2cb0c5a4f12d43\"\n            ]\n        },\n        {\n            \"id\": \"5e26a998c0652d9f474480f7\",\n            \"name\": \"The Iron Man\",\n            \"slug\": \"team-iron-man\",\n            \"members\": [\n                \"5db927bbf8d4da1473169537\",\n                \"5e26a976c0652d9f474480f6\",\n                \"5df9d8f1ba2cb0c5a4f12d43\"\n            ]\n        },\n        {\n            \"id\": \"5ea5dc4fa081c55885d01cba\",\n            \"name\": \"Backend\",\n            \"slug\": \"backend\",\n            \"members\": [\n                \"5df9d90aba2cb0c5a4f12d44\"\n            ]\n        },\n        {\n            \"id\": \"5ea5df70a081c55885d01cc3\",\n            \"name\": \"Batman\",\n            \"slug\": \"batman\",\n            \"members\": [\n                \"5db927bbf8d4da1473169537\"\n            ]\n        }\n    ]\n}"
    },
    {
      "name": "401 Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/squads",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "squads"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 401,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "403 Forbidden",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/squads",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "squads"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 403,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "500 Internal Server Error",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/squads",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "squads"
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 500,\n        \"error_message\": \"<string>\"\n    }\n}"
    }
  ]
}