Foxpro / Microsoft Graph / Update retentionLabel
        
        Back to Collection Items
        LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loResp
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.Http')
* Use this online tool to generate code from sample JSON: Generate Code to Create JSON
* The following JSON is sent in the request body.
* {
*   "descriptionForAdmins": "Updated description for Admins"
* }
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("descriptionForAdmins","Updated description for Admins")
* Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loSbRequestBody = CreateObject('Chilkat.StringBuilder')
loJson.EmitSb(loSbRequestBody)
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpSb("PATCH","https://graph.microsoft.com/beta/security/labels/retentionLabels/{{retentionLabelId}}",loSbRequestBody,"utf-8","application/json",loResp)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    RELEASE loSbRequestBody
    RELEASE loResp
    CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loResp
        Curl Command
        curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-d '{
    "descriptionForAdmins": "Updated description for Admins"
}'
https://graph.microsoft.com/beta/security/labels/retentionLabels/{{retentionLabelId}}
        Postman Collection Item JSON
        {
  "name": "Update retentionLabel",
  "request": {
    "method": "PATCH",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"descriptionForAdmins\": \"Updated description for Admins\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "https://graph.microsoft.com/beta/security/labels/retentionLabels/{{retentionLabelId}}",
      "protocol": "https",
      "host": [
        "graph",
        "microsoft",
        "com"
      ],
      "path": [
        "beta",
        "security",
        "labels",
        "retentionLabels",
        "{{retentionLabelId}}"
      ]
    }
  },
  "response": [
  ]
}