DataFlex / Braze Endpoints / User Profile Export by Global Control Group
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vJson
Handle hoJson
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
Boolean bTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "callback_endpoint": "",
// "fields_to_export": [
// "email",
// "braze_id"
// ],
// "output_format": "zip"
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get ComUpdateString Of hoJson "callback_endpoint" "" To iSuccess
Get ComUpdateString Of hoJson "fields_to_export[0]" "email" To iSuccess
Get ComUpdateString Of hoJson "fields_to_export[1]" "braze_id" To iSuccess
Get ComUpdateString Of hoJson "output_format" "zip" To iSuccess
Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
// Adds the "Authorization: Bearer {{api_key}}" header.
Set ComAuthToken Of hoHttp To "{{api_key}}"
Get pvComObject of hoJson to vJson
Get ComPostJson3 Of hoHttp "https://rest.iad-01.braze.com/users/export/global_control_group" "application/json" vJson To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln iTemp1
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
Send Destroy of hoResp
End_Procedure
Curl Command
curl -X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer {{api_key}}"
-d '{
"callback_endpoint" : "",
"fields_to_export" : ["email", "braze_id"],
"output_format" : "zip"
}'
https://rest.iad-01.braze.com/users/export/global_control_group
Postman Collection Item JSON
{
"name": "User Profile Export by Global Control Group",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Authorization",
"value": "Bearer {{api_key}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"callback_endpoint\" : \"\",\n \"fields_to_export\" : [\"email\", \"braze_id\"],\n \"output_format\" : \"zip\"\n}"
},
"url": {
"raw": "https://{{instance_url}}/users/export/global_control_group",
"protocol": "https",
"host": [
"{{instance_url}}"
],
"path": [
"users",
"export",
"global_control_group"
]
}
},
"response": [
]
}