Unicode C++ / Zoho CRM REST APIs / Send GDPR-related data
        
        Back to Collection Items
        
void ChilkatSample(void)
    {
    json.UpdateString(L"data[0].from.user_name",L"Patricia Boyle");    json.UpdateString(L"data[0].from.email",L"p.boyle@abc.com");    json.UpdateString(L"data[0].to[0].user_name",L"user1");    json.UpdateString(L"data[0].to[0].email",L"user1email@zoho.com");    json.UpdateString(L"data[0].subject",L"Mail subject");    json.UpdateString(L"data[0].content",L"<br><a href=\"${ConsentForm.en_US}\" id=\"ConsentForm\" class=\"en_US\" target=\"_blank\">Consent form link</a><br><br><br><br><br><h3><span style=\"background-color: rgb(254, 255, 102)\">REGARDS,</span></h3><div><span style=\"background-color: rgb(254, 255, 102)\">AZ</span></div><div><span style=\"background-color: rgb(254, 255, 102)\">ADMIN</span></div> <div></div>");    json.UpdateBool(L"data[0].consent_email",true);    json.UpdateString(L"data[0].mail_format",L"html");    json.UpdateString(L"data[0].data_subject_request.id",L"{{data_subject_request_id}}");    json.UpdateString(L"data[0].data_subject_request.type",L"access");    http.put_AuthToken(L"<access_token>");    success = http.HttpJson(L"POST",L"https://domain.com/crm/v2.1/Leads/{{record_id}}/actions/send_mail",json,L"application/json",resp);
    }
        Curl Command
        curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
    "data": [
        {
            "from": {
                "user_name": "Patricia Boyle",
                "email": "p.boyle@abc.com"
            },
            "to": [
                {
                    "user_name": "user1",
                    "email": "user1email@zoho.com"
                }
            ],
            "subject": "Mail subject",
            "content": "<br><a href=\"${ConsentForm.en_US}\" id=\"ConsentForm\" class=\"en_US\" target=\"_blank\">Consent form link</a><br><br><br><br><br><h3><span style=\"background-color: rgb(254, 255, 102)\">REGARDS,</span></h3><div><span style=\"background-color: rgb(254, 255, 102)\">AZ</span></div><div><span style=\"background-color: rgb(254, 255, 102)\">ADMIN</span></div> <div></div>",
            "consent_email": true,
            "mail_format": "html",
            "data_subject_request": {
                "id": "{{data_subject_request_id}}",
                "type": "access"
            }
        }
    ]
}'
https://domain.com/crm/v2.1/Leads/{{record_id}}/actions/send_mail
        Postman Collection Item JSON
        {
  "name": "Send GDPR-related data",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{access-token}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"data\": [\n        {\n            \"from\": {\n                \"user_name\": \"Patricia Boyle\",\n                \"email\": \"p.boyle@abc.com\"\n            },\n            \"to\": [\n                {\n                    \"user_name\": \"user1\",\n                    \"email\": \"user1email@zoho.com\"\n                }\n            ],\n            \"subject\": \"Mail subject\",\n            \"content\": \"<br><a href=\\\"${ConsentForm.en_US}\\\" id=\\\"ConsentForm\\\" class=\\\"en_US\\\" target=\\\"_blank\\\">Consent form link</a><br><br><br><br><br><h3><span style=\\\"background-color: rgb(254, 255, 102)\\\">REGARDS,</span></h3><div><span style=\\\"background-color: rgb(254, 255, 102)\\\">AZ</span></div><div><span style=\\\"background-color: rgb(254, 255, 102)\\\">ADMIN</span></div> <div></div>\",\n            \"consent_email\": true,\n            \"mail_format\": \"html\",\n            \"data_subject_request\": {\n                \"id\": \"{{data_subject_request_id}}\",\n                \"type\": \"access\"\n            }\n        }\n    ]\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{api-domain}}/crm/v2.1/Leads/{{record_id}}/actions/send_mail",
      "host": [
        "{{api-domain}}"
      ],
      "path": [
        "crm",
        "v2.1",
        "Leads",
        "{{record_id}}",
        "actions",
        "send_mail"
      ]
    },
    "description": "Use the following keys when you have enabled GDPR compliance settings, and want to send an email asking for the user's consent or request data. Note that it is mandatory to send the consent form in the email's \"content\" key, when you ask for the lead's/contact's consent.\n\n"
  },
  "response": [
    {
      "name": "OAUTH_SCOPE_MISMATCH",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"data\": [\n        {\n            \"from\": {\n                \"user_name\": \"Patricia Boyle\",\n                \"email\": \"p.boyle@abc.com\"\n            },\n            \"to\": [\n                {\n                    \"user_name\": \"user1\",\n                    \"email\": \"user1email@zoho.com\"\n                }\n            ],\n            \"subject\": \"Mail subject\",\n            \"content\": \"<br><a href=\\\"${ConsentForm.en_US}\\\" id=\\\"ConsentForm\\\" class=\\\"en_US\\\" target=\\\"_blank\\\">Consent form link</a><br><br><br><br><br><h3><span style=\\\"background-color: rgb(254, 255, 102)\\\">REGARDS,</span></h3><div><span style=\\\"background-color: rgb(254, 255, 102)\\\">AZ</span></div><div><span style=\\\"background-color: rgb(254, 255, 102)\\\">ADMIN</span></div> <div></div>\",\n            \"consent_email\": true,\n            \"mail_format\": \"html\",\n            \"data_subject_request\": {\n                \"id\": \"{{data_subject_request_id}}\",\n                \"type\": \"access\"\n            }\n        }\n    ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2.1/Leads/{{record_id}}/actions/send_mail",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2.1",
            "Leads",
            "{{record_id}}",
            "actions",
            "send_mail"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Thu, 13 May 2021 08:21:44 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "113"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-Download-Options",
          "value": "noopen"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"code\": \"OAUTH_SCOPE_MISMATCH\",\n    \"details\": {},\n    \"message\": \"invalid oauth scope to access this URL\",\n    \"status\": \"error\"\n}"
    }
  ]
}