Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
// 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
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "name": "Devops Night Man Squad",
// "members": [
// "5df9d90aba2cb0c5a4f12d44"
// ]
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("name","Devops Night Man Squad")
loo_Json.UpdateString("members[0]","5df9d90aba2cb0c5a4f12d44")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Resp = loo_Http.PostJson3("https://api.squadcast.com/v3/squads","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Json
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-d '{
"name":"Devops Night Man Squad",
"members":[
"5df9d90aba2cb0c5a4f12d44"
]
}'
https://api.squadcast.com/v3/squads
Postman Collection Item JSON
{
"name": "Create Squad",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{sq_pb_auth_header}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\":\"Devops Night Man Squad\",\n\t\"members\":[\n \"5df9d90aba2cb0c5a4f12d44\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/squads",
"host": [
"{{baseUrl}}"
],
"path": [
"squads"
]
},
"description": "This endpoint is used to create a new squad.\nRequires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `squad-create` scope."
},
"response": [
{
"name": "201 Created",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\":\"Devops Night Man Squad\",\n\t\"members\":[\n \"5df9d90aba2cb0c5a4f12d44\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/squads",
"host": [
"{{baseUrl}}"
],
"path": [
"squads"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": null,
"cookie": [
],
"body": "{\n \"data\": {\n \"id\": \"5ed4e5977cc8a1daa90d56eb\",\n \"name\": \"Devops Night Man Squad\",\n \"slug\": \"devops-night-man-squad\",\n \"members\": [\n \"5df9d90aba2cb0c5a4f12d44\"\n ],\n \"organization\": {\n \"id\": \"5ea962e35734157d01594951\",\n \"name\": \"Avengers\",\n \"slug\": \"avengers\"\n }\n }\n}"
},
{
"name": "400 Bad Request",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\":\"Devops Night Man Squad\",\n\t\"members\":[\n \"5df9d90aba2cb0c5a4f12d44\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/squads",
"host": [
"{{baseUrl}}"
],
"path": [
"squads"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": null,
"cookie": [
],
"body": "{\n \"meta\": {\n \"status\": 400,\n \"error_message\": \"<string>\"\n }\n}"
},
{
"name": "401 Unauthorized",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\":\"Devops Night Man Squad\",\n\t\"members\":[\n \"5df9d90aba2cb0c5a4f12d44\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"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": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\":\"Devops Night Man Squad\",\n\t\"members\":[\n \"5df9d90aba2cb0c5a4f12d44\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"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": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n\t\"name\":\"Devops Night Man Squad\",\n\t\"members\":[\n \"5df9d90aba2cb0c5a4f12d44\"\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"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}"
}
]
}