POST contact_information/accept_consent

Available from CRM.COM R14.1.0

This method is used so that Contacts can accept Consent, providing an attachment on the Contact (optionally) representing the Consent Form. This Web API method requires a multipart/form-data post, as defined in RFC 1867. There are many libraries available that can be used in order to submit multipart/form-data posts (for example MultipartEntity in Java). A single attachment can be added through each call

Name

Type

Description

token

String

The token retrieved from the login method

contact_information_identifier

(mandatory)

Contact Information Identifier  

The identifier of the contact information that should be updated. The allowed contact information identifier fields are the following:

Name

Type

Description

id 

(semi-optional)

String

The ID of the contact information

id_number

(semi-optional)

String

The ID number of the contact information

Applicable only for contact information that represent PERSON

passport_number 

(semi-optional)

String

The passport number of the contact information

Applicable only for contact information that represent PERSON

social_security_number 

(semi-optional)

String

The social security number of the contact information

Applicable only for contact information that represent PERSON

vat_registration_number

(semi-optional)

String

The VAT registration number of the contact information

Applicable only for contact information that represent COMPANY

registration_number

(semi-optional)

String

The registration number of the contact information

Applicable only for contact information that represent COMPANY

Available from CRM.COM R14.0.0

attachment_id

(optional)

String

The ID of the attachment that should be added as the consent form on the Contact (applicable if a file is not provided). The attachment should already exist in the system's Attachments Library

 

file

(optional)

FileThe file that should be added as an attachment (applicable if attachment_id was not provided)

fields_set
(optional)

List of Strings, comma separated 

A list of fields that should be included in the results. If not specified then all the available fields will be returned

  • It is mandatory to specify one of the semi-optional parameters. Only one of those parameters is allowed to be specified.

 contact consent object response data

Name

Type

Description

id

String

The ID of the retrieved contact information

contact_consent_state

String

The state of the Contact's Consent. Applicable values are:

  • PENDING
  • ACCEPTED
  • REJECTED
  • WITHDRAWN
contact_consent_updated_dateDateThe updated date of the Contact's Consent
contact_consent_formAttachments Object

The Contact's accepted Consent Form. Applicable only if Consent State is ACCEPTED

Referred Objects Response Data

 Attachments object response data

Name

Type

Description

id

String

The ID of the retrieved attachment

entityString

The name of the entity related with the attachment. The supported entities are the following:

  • ACCOUNTSRECEIVABLE
  • ACTIVITIES
  • COMMUNICATIONS
  • COMMUNICATIONTEMPLATES
  • CONTACTINFORMATION
  • INSTALLEDITEMS
  • JOBS
  • LEADS
  • PRODUCTS
  • SERVICEREQUESTS
  • ATTACHMENTSLIBRARY

From CRM.COM R12.2.0, ATTACHMENTSLIBRARY is available

From CRM.COM R14.0.0, COMMUNICATIONTEMPLATES is available

entity_idStringThe ID of the entity related with the attachment.
urlStringThe attached URL. This information is empty if the attachment is a file.
notesStringThe comments related with the retrieved attachment
classificationAttachments Classification Object

The classification of the attachment

Available from CRM.COM R12.2.0

fileFile ObjectThe information of the attached file. This information is empty if the attachment is a URL.
log_informationLog Information ObjectThe log information of the retrieved attachment

Referred Objects Response Data

 classification object response data

 

NameTypeDescription

id

String

The id of the retrieved attachment classification

name

String

The name of the retrieved attachment classification

alternative_code

String

The alternative code of the retrieved attachment classification

 file object response data

 

Name

Type

Description

file_nameStringThe name of the file
file_content_urlStringThe url that can be used to access the actual content of the file
file_mime_typeStringThe mime type of the attached file

 log_information object response data

Name

Type

Description

created_date

Date

The date that the retrieved record was created

updated_date

Date

The last date that the retrieved record was updated

created_by_unit

Unit Object

The unit that created the retrieved record

From CRM.COM R14.1.0 and onward, group_name and community_name attributes will be returned as empty, if the related legacy compatibility setting is disabled

Deprecated from CRM.COM R18.0.0

created_by_business_unit

Unit Object

The unit that created the retrieved record

From CRM.COM R14.1.0 and onward, group_name and community_name attributes will be returned as empty, if the related legacy compatibility setting is disabled

Available from CRM.COM R18.0.0

created_by_user

User Object

The user that created the retrieved record

From CRM.COM R14.1.0 and onward, person_name and email attributes will be returned as empty, if the related legacy compatibility setting is disabled

updated_by_unit

Unit Object

The last unit that updated the retrieved record

From CRM.COM R14.1.0 and onward, group_name and community_name attributes will be returned as empty, if the related legacy compatibility setting is disabled

Deprecated from CRM.COM R18.0.0

updated_by_business_unit

Unit Object

The last unit that updated the retrieved record

Available from CRM.COM R18.0.0

updated_by_user

User Object

The last user that updated the retrieved record

From CRM.COM R14.1.0 and onward, person_name and email attributes will be returned as empty, if the related legacy compatibility setting is disabled

Referred Objects Response Data

 unit object response data

Name

Type

Description

id

String

The ID of the retrieved unit

name

String

The name of the retrieved unit

group_name

String

The name of the group that the retrieved unit belongs to

community_name

String

The name of the community that the retrieved unit belongs to

alternative_code

String

The alternative code of the retrieved unit

description

String

The description of the retrieved unit

 business unit object response data

Name

Type

Description

id

String

The ID of the retrieved business unit

name

String

The name of the retrieved business unit

codeStringThe code of the retrieved business unit
unified_codeString

The unified code of the retrieved business unit

description

String

The description of the retrieved business unit

parent_business_unit_nameStringThe name of the parent business unit that the retrieved business unit belongs to

 user object response data

Name

Type

Description

id

String

The ID of the retrieved user

username

String

The user name of the retrieved user

person_name

String

The full name of the retrieved user

email

String

The email of the retrieved user

 Example 1

cURL Example:

curl --request POST \
  --url {{server}}/crmapi/rest/v2/contact_information/accept_consent \
  --header 'accept-encoding: multipart/form-data' \
  --header 'cache-control: no-cache' \
  --header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  --header 'postman-token: a644b39e-f387-b0fd-fd8c-2a89b98b6a2c' \
  --form token={{token}} \
  --form contact_information_identifier=534EA7598CB64527A17206877AA545F0 \
  --form attachment_id=FB1D8C73D0AD4D98A9630D2CDD4737C9

 

PHP Example:

 <?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "{{server}}/crmapi/rest/v2/attachments/list?token={{token}}&entity=CONTACTINFORMATION&entity_id=18686813304341ECAFC8175A85594C9B",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json"
  ),
));<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_PORT => "808",
  CURLOPT_URL => "http://cyn1docker002:808/crmapi/rest/v2/contact_information/accept_consent",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"token\"\r\n\r\neyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c3IiOiJNUEFkbWluaXN0cmF0b3IiLCJvcmciOiJwc19kZXYiLCJvdW4iOiIxIiwiZXhwIjoiMTUyMDUwODQ4MyIsImlhdCI6IjE1MjA1MDEyODMiLCJqdGkiOiI4NDc5NkY2NzZEREQ0REM0QUY3NDhBMjA1M0NERkYyQyJ9.qFoZNXNXYSbjQCPFjJ6dHX9P1vwFLyHWnz0tXmrTG-I\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"contact_information_identifier\"\r\n\r\n534EA7598CB64527A17206877AA545F0 \r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"attachment_id\"\r\n\r\nFB1D8C73D0AD4D98A9630D2CDD4737C9\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "accept-encoding: multipart/form-data",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
    "postman-token: e422af2f-0cfc-91f7-1127-d6ca4d900a0e"
  ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


Response:

{
    "data": {
        "contact_consent_updated_date": "2018-03-08T14:36:03",
        "id": "534EA7598CB64527A17206877AA545F0",
        "contact_consent_form": {
            "notes": null,
            "file": {
                "file_name": "Consent Form3.pdf",
                "file_content_url": "/crm/FileDownloadServlet?id=FB1D8C73D0AD4D98A9630D2CDD4737C9",
                "file_mime_type": "application/pdf"
            },
            "log_information": {
                "created_by_unit": {
                    "alternative_code": "adminunit",
                    "group_name": "Main Group",
                    "name": "Admin Unit",
                    "description": "admin unit",
                    "id": "1"
                },
                "updated_by_unit": {
                    "alternative_code": "adminunit",
                    "group_name": "Main Group",
                    "name": "Admin Unit",
                    "description": "admin unit",
                    "id": "1"
                },
                "created_date": "2018-03-05T16:51:55",
                "updated_date": "2018-03-05T16:51:57",
                "updated_by_user": {
                    "person_name": "MPAdministrator",
                    "id": "1",
                    "username": "MPAdministrator"
                },
                "created_by_user": {
                    "person_name": "MPAdministrator",
                    "id": "1",
                    "username": "MPAdministrator"
                }
            },
            "id": "FB1D8C73D0AD4D98A9630D2CDD4737C9",
            "entity_id": null,
            "classification": {
                "alternative_code": "AL",
                "name": "Attachments Library",
                "id": "480710C4BDED4A9C94786EFBDF94AC1F"
            },
            "entity": "ATTACHMENTSLIBRARY",
            "url": null
        },
        "contact_consent_state": "ACCEPTED"
    },
    "status": {
        "code": "OK",
        "description": "",
        "message": ""
    }
}


 Example 2

cURL Example:

curl --request POST \
  --url {{server}}/crmapi/rest/v2/contact_information/accept_consent \
  --header 'accept-encoding: multipart/form-data' \
  --header 'cache-control: no-cache' \
  --header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  --header 'postman-token: 0d059702-2e53-d8be-b407-75503aff0297' \
  --form token={{token}} \
  --form contact_information_identifier=id=4332E26DB0F74607980F2A9972B2B561

 

PHP Example:

 <?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_PORT => "808",
  CURLOPT_URL => "{{server}}/crmapi/rest/v2/contact_information/accept_consent",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"token\"\r\n\r\n{{token}}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"contact_information_identifier\"\r\n\r\nid=4332E26DB0F74607980F2A9972B2B561\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
  CURLOPT_HTTPHEADER => array(
    "accept-encoding: multipart/form-data",
    "cache-control: no-cache",
    "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
    "postman-token: e10288bd-f2e5-07cd-ea82-7738a9c9454f"
  ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}


Response:

{
    "data": {
        "contact_consent_updated_date": "2018-03-08T14:20:23",
        "id": "4332E26DB0F74607980F2A9972B2B561",
        "contact_consent_form": {
            "notes": null,
            "file": {
                "file_name": "Consent Form3.pdf",
                "file_content_url": "/crm/FileDownloadServlet?id=FB1D8C73D0AD4D98A9630D2CDD4737C9",
                "file_mime_type": "application/pdf"
            },
            "log_information": {
                "created_by_unit": {
                    "alternative_code": "adminunit",
                    "group_name": "Main Group",
                    "name": "Admin Unit",
                    "description": "admin unit",
                    "id": "1"
                },
                "updated_by_unit": {
                    "alternative_code": "adminunit",
                    "group_name": "Main Group",
                    "name": "Admin Unit",
                    "description": "admin unit",
                    "id": "1"
                },
                "created_date": "2018-03-05T16:51:55",
                "updated_date": "2018-03-05T16:51:57",
                "updated_by_user": {
                    "person_name": "MPAdministrator",
                    "id": "1",
                    "username": "MPAdministrator"
                },
                "created_by_user": {
                    "person_name": "MPAdministrator",
                    "id": "1",
                    "username": "MPAdministrator"
                }
            },
            "id": "FB1D8C73D0AD4D98A9630D2CDD4737C9",
            "entity_id": null,
            "entity": "ATTACHMENTSLIBRARY",
            "url": null
        },
        "contact_consent_state": "ACCEPTED"
    },
    "status": {
        "code": "OK",
        "description": "",
        "message": ""
    }
}