• Post category:Файлы
  • Запись изменена:03.11.2022

POST api/2.0/crm/{entityType}/{entityid}/files

Для этой функции требуется аутентификация. 

Описание
Прикрепляет выбранный файл(ы) к сущности, указанной в запросе.

Параметры

Название Описание Тип Пример
entityType

sent in url
Тип сущности строковый текст
entityid

sent in url
Идентификатор сущности номер 1234
fileids

sent in body
Список идентификаторов файлов Collection of numbers

collection
1234
Пример
POST api/2.0/crm/some+text/1234/files
Host: yourportal.r7-office.ru
Content-Type: application/json
Accept: application/json

{
  "fileids": [
    1234
  ]
}
Возвращает

Сущность с прикрепленными файлами

Пример ответа

application/json

{
  "status": 0,
  "response": {
    "createBy": {
      "id": "00000000-0000-0000-0000-000000000000",
      "displayName": "Mike Zanyatski",
      "title": "Manager",
      "avatarSmall": "url to small avatar",
      "profileUrl": ""
    },
    "created": "2022-10-08T15:03:33.3675267Z",
    "content": "Agreed to meet at lunch and discuss the client commercial offer",
    "category": {
      "imagePath": "path to image",
      "title": "Lunch",
      "description": "",
      "color": "",
      "sortOrder": 10,
      "id": 30
    },
    "contact": {
      "smallFotoUrl": "url to foto",
      "displayName": "Tadjeddine Bachir",
      "isCompany": false,
      "isPrivate": true,
      "isShared": false,
      "shareType": 0,
      "currency": null,
      "canEdit": false,
      "canDelete": false,
      "id": 0
    },
    "entity": {
      "entityType": "opportunity",
      "entityId": 123445,
      "entityTitle": "Household appliances internet shop"
    },
    "canEdit": true,
    "files": [
      {
        "folderId": 12334,
        "version": 3,
        "versionGroup": 1,
        "contentLength": "12.06 KB",
        "pureContentLength": 12345,
        "fileStatus": 2,
        "viewUrl": "http:\/\/www.Р7.com\/viewfile?fileid=2221",
        "fileType": 7,
        "fileExst": ".txt",
        "comment": null,
        "id": 2074802387,
        "title": "Some titile.txt",
        "access": 1,
        "shared": false,
        "rootFolderType": 2,
        "updatedBy": {
          "id": "00000000-0000-0000-0000-000000000000",
          "displayName": "Mike Zanyatski",
          "title": "Manager",
          "avatarSmall": "url to small avatar",
          "profileUrl": ""
        },
        "created": "2022-10-08T15:03:33.3675267Z",
        "createdBy": {
          "id": "00000000-0000-0000-0000-000000000000",
          "displayName": "Mike Zanyatski",
          "title": "Manager",
          "avatarSmall": "url to small avatar",
          "profileUrl": ""
        },
        "updated": "2022-10-08T15:03:33.3675267Z"
      }
    ],
    "id": 0
  }
}

text/xml

<result>
  <status>0</status>
  <response>
    <createBy>
      <id>00000000-0000-0000-0000-000000000000</id>
      <displayName>Mike Zanyatski</displayName>
      <title>Manager</title>
      <avatarSmall>url to small avatar</avatarSmall>
      <profileUrl></profileUrl>
    </createBy>
    <created>2022-10-08T15:03:33.3675267Z</created>
    <content>Agreed to meet at lunch and discuss the client commercial offer</content>
    <category>
      <imagePath>path to image</imagePath>
      <title>Lunch</title>
      <description></description>
      <color></color>
      <sortOrder>10</sortOrder>
      <id>30</id>
    </category>
    <contact>
      <smallFotoUrl>url to foto</smallFotoUrl>
      <displayName>Tadjeddine Bachir</displayName>
      <isCompany>false</isCompany>
      <isPrivate>true</isPrivate>
      <isShared>false</isShared>
      <shareType>0</shareType>
      <currency />
      <canEdit>false</canEdit>
      <canDelete>false</canDelete>
      <id>0</id>
    </contact>
    <entity>
      <entityType>opportunity</entityType>
      <entityId>123445</entityId>
      <entityTitle>Household appliances internet shop</entityTitle>
    </entity>
    <canEdit>true</canEdit>
    <files>
      <folderId>12334</folderId>
      <version>3</version>
      <versionGroup>1</versionGroup>
      <contentLength>12.06 KB</contentLength>
      <pureContentLength>12345</pureContentLength>
      <fileStatus>2</fileStatus>
      <viewUrl>http://www.Р7.com/viewfile?fileid=2221</viewUrl>
      <fileType>7</fileType>
      <fileExst>.txt</fileExst>
      <comment />
      <id>2074802387</id>
      <title>Some titile.txt</title>
      <access>1</access>
      <shared>false</shared>
      <rootFolderType>2</rootFolderType>
      <updatedBy>
        <id>00000000-0000-0000-0000-000000000000</id>
        <displayName>Mike Zanyatski</displayName>
        <title>Manager</title>
        <avatarSmall>url to small avatar</avatarSmall>
        <profileUrl></profileUrl>
      </updatedBy>
      <created>2022-10-08T15:03:33.3675267Z</created>
      <createdBy>
        <id>00000000-0000-0000-0000-000000000000</id>
        <displayName>Mike Zanyatski</displayName>
        <title>Manager</title>
        <avatarSmall>url to small avatar</avatarSmall>
        <profileUrl></profileUrl>
      </createdBy>
      <updated>2022-10-08T15:03:33.3675267Z</updated>
    </files>
    <id>0</id>
  </response>
</result>