Skip to end of banner
Go to start of banner

attachments

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

Available from CRM.COM R11.0.0


GET attachments/list

This method returns the attachments related with a specific entity. Multiple attachments are returned by each call.

Resource URL

Parameters

Name

Type

Description

token

String

The token retrieved from the login method

entity

(mandatory)

String

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

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

ATTACHMENTSLIBRARY is Available from CRM.COM R12.2.0

entity_id

(mandatory on conditions)

String

The ID of the entity related with the attachment, which is mandatory only if the entity is not set to ATTACHMENTSLIBRARY

The entity ID is mandatory up to CRM.COM R12.1.0


The entity ID is mandatory on conditions from CRM.COM R12.2.0


classification

(mandatory on conditions)

String

The classification of the attachment, which is mandatory only if the entity is set to ATTACHMENTSLIBRARY

Available from CRM.COM R12.2.0

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

Restrictions

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

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

Examples

 Example 1

HTTP Method: GET

 

Request:

Response:

 {
  "data": [
    {
      "comments": "polina",
      "file": {
        "file_name": "bill subscriber error.txt",
        "file_content_url": "/crm/FileDownloadServlet?id=01239852D674447D88374321FD922E7A",
        "file_mime_type": "text/plain"
      },
      "log_information": {
        "created_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "updated_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "created_date": "2016-11-03T13:42:06",
        "updated_date": "2016-11-03T13:42:06",
        "updated_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        },
        "created_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        }
      },
      "id": "01239852D674447D88374321FD922E7A",
      "entity_id": "10A149D60365488AB53DCB889CFD98F8",
      "entity": "ACCOUNTSRECEIVABLE",
      "url": null
    },
    {
      "notes": "polina",
      "file": {
        "file_name": "bill subscriber error.txt",
        "file_content_url": "/crm/FileDownloadServlet?id=479FAB4E732B44EAA66B41522A5AE126",
        "file_mime_type": "text/plain"
      },
      "log_information": {
        "created_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "updated_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "created_date": "2016-11-03T13:34:29",
        "updated_date": "2016-11-03T13:34:32",
        "updated_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        },
        "created_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        }
      },
      "id": "479FAB4E732B44EAA66B41522A5AE126",
      "entity_id": "10A149D60365488AB53DCB889CFD98F8",
      "entity": "ACCOUNTSRECEIVABLE",
      "url": null
    },
    {
      "notes": "test",
      "file": {
        "file_name": "bill subscriber error.txt",
        "file_content_url": "/crm/FileDownloadServlet?id=0B8B13EFADF34D9899F633639F6D460E",
        "file_mime_type": "text/plain"
      },
      "log_information": {
        "created_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "updated_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "created_date": "2016-11-03T13:26:08",
        "updated_date": "2016-11-03T13:28:06",
        "updated_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        },
        "created_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        }
      },
      "id": "0B8B13EFADF34D9899F633639F6D460E",
      "entity_id": "10A149D60365488AB53DCB889CFD98F8",
      "entity": "ACCOUNTSRECEIVABLE",
      "url": null
    },
    {
      "notes": null,
      "file": {
        "file_name": "bill subscriber error.txt",
        "file_content_url": "/crm/FileDownloadServlet?id=927EEC9B3C16495B9A76B0D4219687C2",
        "file_mime_type": "text/plain"
      },
      "log_information": {
        "created_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "updated_by_unit": {
          "alternative_code": "adminunit",
          "name": "Admin Unit",
          "description": "admin unit",
          "id": "1"
        },
        "created_date": "2016-11-02T13:21:04",
        "updated_date": "2016-11-02T13:21:06",
        "updated_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        },
        "created_by_user": {
          "person_name": "MPAdministrator",
          "id": "1",
          "username": "MPAdministrator"
        }
      },
      "id": "927EEC9B3C16495B9A76B0D4219687C2",
      "entity_id": "10A149D60365488AB53DCB889CFD98F8",
      "entity": "ACCOUNTSRECEIVABLE",
      "url": null
    }
  ],
  "status": {
    "code": "OK",
    "description": "",
    "message": ""
  }
}

Note:

To retrieve or display the actual image you need to construct the following URL

{{server}}{{file_content_url}}&token={{token}}  

for example

https://r11qa.crm.com/crm/FileDownloadServlet?id=927EEC9B3C16495B9A76B0D4219687C2&token=B18ECEE5918442A0A29B7C1B2D0A4260

POST attachments/add

This method is used to add attachments on an existing entity.  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

Resource URL

Parameters

Name

Type

Description

token

String

The token retrieved from the login method

entity

(mandatory)

String

The name of the entity related with the attachments that should be returned as a result. The supported entities are the following:

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

ATTACHMENTSLIBRARY is Available from CRM.COM R12.2.0

entity_id

(mandatory on conditions)

String

The ID of the entity related with the attachments that should be returned as a result, and is mandatory only if the entity is not set to ATTACHMENTSLIBRARY

The entity ID is mandatory up to CRM.COM R12.1.0


The entity ID is mandatory on conditions from CRM.COM R12.2.0


file

(semi-optional)

FileThe file that should be added as an attachment

url

(semi-optional)

StringThe URL that should be added as an attachment

classification

(mandatory on conditions)

String

The classification of the attachment, and is mandatory only if the entity is set to ATTACHMENTSLIBRARY

Available from CRM.COM R12.2.0

notes

(optional)

StringThe notes related with the attachment

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

Restrictions

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

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

Examples

 Example 1

cURL Example:

 curl --request POST \
  --url {{server}}/crmapi/rest/v2/attachments/add \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form entity=CONTACTINFORMATION \
  --form 'token={{token}}' \
  --form entity_id=18686813304341ECAFC8175A85594C9B \
  --form 'notes=My Web API notes' \
  --form url=www.crm.com \
  --form 'file=@[object Object]'

 

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"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

POST attachments/delete

This method is used to delete attachments.  A single attachment can be deleted through this method

Resource URL

Parameters

Name

Type

Description

token

String

The token retrieved from the login method

id

(mandatory)

String

The id of the attachment that should be deleted

 

Response Data

Not applicable

Examples

 Example 1

HTTP Method: POST

 

Request:

Body:

 {
"token":"{{token}}",
"id":"F7FF2E30AAD94720B844B1035B195955"
} 

 

Response:

Not applicable

  • No labels