PureBasic / Zoom API / Update registration questions
Back to Collection Items
IncludeFile "CkJsonArray.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttpRequest.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
req.i = CkHttpRequest::ckCreate()
If req.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttpRequest::setCkHttpVerb(req, "PATCH")
CkHttpRequest::setCkPath(req, "/v2/meetings/:meetingId/registrants/questions")
CkHttpRequest::setCkContentType(req, "multipart/form-data")
jsonFormData1.i = CkJsonArray::ckCreate()
If jsonFormData1.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonArray::ckAddObjectAt(jsonFormData1,-1)
jsonObj_1.i = CkJsonArray::ckObjectAt(jsonFormData1,CkJsonArray::ckSize(jsonFormData1) - 1)
CkJsonObject::ckUpdateString(jsonObj_1,"field_name","address")
CkJsonObject::ckUpdateBool(jsonObj_1,"required",0)
CkJsonObject::ckDispose(jsonObj_1)
CkJsonArray::ckAddObjectAt(jsonFormData1,-1)
jsonObj_1 = CkJsonArray::ckObjectAt(jsonFormData1,CkJsonArray::ckSize(jsonFormData1) - 1)
CkJsonObject::ckUpdateString(jsonObj_1,"field_name","phone")
CkJsonObject::ckUpdateBool(jsonObj_1,"required",0)
CkJsonObject::ckDispose(jsonObj_1)
CkHttpRequest::ckAddStringForUpload2(req,"questions","",jsonFormData1,"utf-8","application/json")
jsonFormData2.i = CkJsonArray::ckCreate()
If jsonFormData2.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonArray::ckAddObjectAt(jsonFormData2,-1)
jsonObj_1.i = CkJsonArray::ckObjectAt(jsonFormData2,CkJsonArray::ckSize(jsonFormData2) - 1)
CkJsonObject::ckUpdateString(jsonObj_1,"field_name","address")
CkJsonObject::ckUpdateBool(jsonObj_1,"required",0)
CkJsonObject::ckDispose(jsonObj_1)
CkJsonArray::ckAddObjectAt(jsonFormData2,-1)
jsonObj_1 = CkJsonArray::ckObjectAt(jsonFormData2,CkJsonArray::ckSize(jsonFormData2) - 1)
CkJsonObject::ckUpdateString(jsonObj_1,"field_name","phone")
CkJsonObject::ckUpdateBool(jsonObj_1,"required",0)
CkJsonObject::ckDispose(jsonObj_1)
CkHttpRequest::ckAddStringForUpload2(req,"custom_questions","",jsonFormData2,"utf-8","application/json")
CkHttpRequest::ckAddHeader(req,"Authorization","Bearer <access_token>")
resp.i = CkHttp::ckSynchronousRequest(http,"api.zoom.us",443,1,req)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkHttpRequest::ckDispose(req)
CkJsonArray::ckDispose(jsonFormData1)
CkJsonArray::ckDispose(jsonFormData2)
ProcedureReturn
EndIf
respStatusCode.i = CkHttpResponse::ckStatusCode(resp)
Debug "Response Status Code = " + Str(respStatusCode)
If respStatusCode <> 204
Debug "Response Header:"
Debug CkHttpResponse::ckHeader(resp)
Debug "Response Body:"
Debug CkHttpResponse::ckBodyStr(resp)
Debug "Failed."
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkHttpRequest::ckDispose(req)
CkJsonArray::ckDispose(jsonFormData1)
CkJsonArray::ckDispose(jsonFormData2)
ProcedureReturn
EndIf
CkHttpResponse::ckDispose(resp)
Debug "Success."
CkHttp::ckDispose(http)
CkHttpRequest::ckDispose(req)
CkJsonArray::ckDispose(jsonFormData1)
CkJsonArray::ckDispose(jsonFormData2)
ProcedureReturn
EndProcedure
Curl Command
curl -X PATCH
-H "Authorization: Bearer <access_token>"
-H "Content-Type: multipart/form-data"
--form 'questions=[{"field_name":"address","required":false},{"field_name":"phone","required":false}]'
--form 'custom_questions=[{"field_name":"address","required":false},{"field_name":"phone","required":false}][{"title":"commodo","type":"single","required":true,"answers":["magna aute nostrud id proident","pariatur aliquip"]},{"title":"id nisi reprehenderit esse","type":"short","required":false,"answers":["amet pariatur Lorem ullamco","Ut cillum"]}]'
https://api.zoom.us/v2/meetings/:meetingId/registrants/questions
Postman Collection Item JSON
{
"name": "Update registration questions",
"request": {
"auth": {
"type": "oauth2"
},
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "questions",
"value": "[{\"field_name\":\"address\",\"required\":false},{\"field_name\":\"phone\",\"required\":false}]",
"description": "undefined",
"type": "text"
},
{
"key": "custom_questions",
"value": "[{\"title\":\"commodo\",\"type\":\"single\",\"required\":true,\"answers\":[\"magna aute nostrud id proident\",\"pariatur aliquip\"]},{\"title\":\"id nisi reprehenderit esse\",\"type\":\"short\",\"required\":false,\"answers\":[\"amet pariatur Lorem ullamco\",\"Ut cillum\"]}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/meetings/:meetingId/registrants/questions",
"host": [
"{{baseUrl}}"
],
"path": [
"meetings",
":meetingId",
"registrants",
"questions"
],
"variable": [
{
"key": "meetingId",
"value": "68423085",
"description": "(Required) The meeting's ID. \n\n When storing this value in your database, you must store it as a **long** format integer and **not** an integer. Meeting IDs can exceed 10 digits."
}
]
},
"description": "Update registration questions that will be displayed to users while [registering for a meeting](https://support.zoom.us/hc/en-us/articles/211579443-Registration-for-Meetings).<br><br>\n**Scopes:** `meeting:write`, `meeting:write:admin`<br>\n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Light`\n \n\n"
},
"response": [
{
"name": "**HTTP Status Code:** `204`<br>\nMeeting Registrant Questions Updated",
"originalRequest": {
"method": "PATCH",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "questions",
"value": "[{\"field_name\":\"comments\",\"required\":true},{\"field_name\":\"phone\",\"required\":false}]",
"description": "undefined",
"type": "text"
},
{
"key": "custom_questions",
"value": "[{\"title\":\"incididunt in\",\"type\":\"single\",\"required\":true,\"answers\":[\"voluptate labore\",\"deserunt \"]},{\"title\":\"fugia\",\"type\":\"short\",\"required\":false,\"answers\":[\"min\",\"dolore in sint \"]}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/meetings/:meetingId/registrants/questions",
"host": [
"{{baseUrl}}"
],
"path": [
"meetings",
":meetingId",
"registrants",
"questions"
],
"variable": [
{
"key": "meetingId",
"value": "68423085",
"description": "(Required) The meeting's ID. \n\n When storing this value in your database, you must store it as a **long** format integer and **not** an integer. Meeting IDs can exceed 10 digits."
}
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "**HTTP Status Code:** `404`<br>\nMeeting not found.",
"originalRequest": {
"method": "PATCH",
"header": [
{
"description": "Added as a part of security scheme: oauth2",
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "questions",
"value": "[{\"field_name\":\"comments\",\"required\":true},{\"field_name\":\"phone\",\"required\":false}]",
"description": "undefined",
"type": "text"
},
{
"key": "custom_questions",
"value": "[{\"title\":\"incididunt in\",\"type\":\"single\",\"required\":true,\"answers\":[\"voluptate labore\",\"deserunt \"]},{\"title\":\"fugia\",\"type\":\"short\",\"required\":false,\"answers\":[\"min\",\"dolore in sint \"]}]",
"description": "undefined",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/meetings/:meetingId/registrants/questions",
"host": [
"{{baseUrl}}"
],
"path": [
"meetings",
":meetingId",
"registrants",
"questions"
],
"variable": [
{
"key": "meetingId",
"value": "68423085",
"description": "(Required) The meeting's ID. \n\n When storing this value in your database, you must store it as a **long** format integer and **not** an integer. Meeting IDs can exceed 10 digits."
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}