Метод «Folder [ADD]» (POST)

Метод «Folder [ADD]» применяется для создания папки в системе, добавления файлов в папку, установки тэгов файлов и метаданных папки.

Дополнительные параметры запроса.

Все параметры данного метода добавляются в тело запроса. Все параметры обязательные.

  • photo1…photoN – файлы фотографий для помещения в папку (в теле запроса);
  • video1…videoN – видеофайлы для помещения в папку (в теле запроса);
  • payload – переменная, содержащая теги и метаданные. (в теле запроса).

Структура переменной «payload».

Переменная описывается в формате JSON.

Блок "folder:meta_data" содержит метаданные папки, записи и значения могут быть любыми в формате "запись": "значение".

Блок "media:tags" содержит тэги файлов в папке. Для правильной работы анализов файлы в системе обязательно должны иметь корректный тэг. Возможные значения тэгов в Системе.

Примеры запросов.

Пример выполнения метода «Folder [ADD]» в ПО «Postman»:

Примеры синтаксиса POST-запроса методом «Folder [ADD]» со следующими параметрами:

  • Добавление в папку 2х фото и 2х видео-файлов;
  • Добавление в метаданные записи "test" со значением "test11234567";
  • Добавление файлу photo1 тэга "photo_id";
  • Добавление файлу photo2 тэга "photo_selfie";
  • Добавление файлу video1 тэгов "video_selfie", "video_selfie_zoom_in", "orientation_portrait";
  • Добавление файлу video2 тэгов "video_selfie", "video_selfie_zoom_out", "orientation_portrait".

HTTP

Bash

Python

php

Java


POST /api/folders/ HTTP/1.1
Host: api-d.oz-services.ru
X-Forensic-Access-Token: 0ccbdb4627c9d07c6c5b8f6e6cca44b5f8cb0c54ad7659098fa336240d494b0f9035e14bc42fc461224a9719f105e41026fed0f6f14188d9107b8c3d697a0cb1
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: c6d49ae7-7e7c-4fc1-87fa-6eb621db96fe,5b6365b1-fe86-45e4-9a83-624edd41e799
Host: api-d.oz-services.ru
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 12292189
Connection: keep-alive
cache-control: no-cache


Content-Disposition: form-data; name="photo1"; filename="/X:/1.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="photo1"; filename="/X:/1.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="photo2"; filename="/X:/2.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="photo1"; filename="/X:/1.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="photo2"; filename="/X:/2.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="video1"; filename="/X:/372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="photo1"; filename="/X:/1.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="photo2"; filename="/X:/2.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="video1"; filename="/X:/372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="payload"

{
  "folder:meta_data": {
    "test": "test11234567"
  },
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_zoom_in",
      "orientation_portrait"
    ],
     "video2": [
      "video_selfie",
      "video_selfie_zoom_out",
      "orientation_portrait"
    ],
    "photo1": [
      "photo_id"
    ],
       "photo2": [
      "photo_selfie"
    ]
  }
}
------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="photo1"; filename="/X:/1.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="photo2"; filename="/X:/2.jpg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="video1"; filename="/X:/372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="payload"

{
  "folder:meta_data": {
    "test": "test11234567"
  },
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_zoom_in",
      "orientation_portrait"
    ],
     "video2": [
      "video_selfie",
      "video_selfie_zoom_out",
      "orientation_portrait"
    ],
    "photo1": [
      "photo_id"
    ],
       "photo2": [
      "photo_selfie"
    ]
  }
}
------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="video2"; filename="/X:/2c2177a1-ed2b-4443-b2c7-e489ab205fd4.mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW--


curl -X POST \
  https://api-d.oz-services.ru/api/folders/ \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 12292189' \
  -H 'Content-Type: multipart/form-data; boundary=--------------------------871104747068739662264204' \
  -H 'Host: api-d.oz-services.ru' \
  -H 'Postman-Token: c6d49ae7-7e7c-4fc1-87fa-6eb621db96fe,de42f6de-d236-4df5-bbfc-965b04c73b9f' \
  -H 'User-Agent: PostmanRuntime/7.15.2' \
  -H 'X-Forensic-Access-Token: 0ccbdb4627c9d07c6c5b8f6e6cca44b5f8cb0c54ad7659098fa336240d494b0f9035e14bc42fc461224a9719f105e41026fed0f6f14188d9107b8c3d697a0cb1' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F 'photo1=@/X:/1.jpg' \
  -F 'photo2=@/X:/2.jpg' \
  -F 'video1=@/X:/372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4' \
  -F 'payload={
  "folder:meta_data": {
    "test": "test11234567"
  },
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_zoom_in",
      "orientation_portrait"
    ],
     "video2": [
      "video_selfie",
      "video_selfie_zoom_out",
      "orientation_portrait"
    ],
    "photo1": [
      "photo_id"
    ],
       "photo2": [
      "photo_selfie"
    ]
  }
}' \
  -F 'video2=@/X:/2c2177a1-ed2b-4443-b2c7-e489ab205fd4.mp4'


import requests

url = "https://api-d.oz-services.ru/api/folders/"

payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"photo1\"; filename=\"1.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"photo2\"; filename=\"2.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"video1\"; filename=\"372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4\"\r\nContent-Type: video/mp4\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\n  \"folder:meta_data\": {\n    \"test\": \"test11234567\"\n  },\n  \"media:tags\": {\n    \"video1\": [\n      \"video_selfie\",\n      \"video_selfie_zoom_in\",\n      \"orientation_portrait\"\n    ],\n\t \"video2\": [\n      \"video_selfie\",\n      \"video_selfie_zoom_out\",\n      \"orientation_portrait\"\n    ],\n    \"photo1\": [\n      \"photo_id\"\n    ],\n       \"photo2\": [\n      \"photo_selfie\"\n    ]\n  }\n}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"video2\"; filename=\"2c2177a1-ed2b-4443-b2c7-e489ab205fd4.mp4\"\r\nContent-Type: video/mp4\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
headers = {
    'content-type': "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
    'X-Forensic-Access-Token': "0ccbdb4627c9d07c6c5b8f6e6cca44b5f8cb0c54ad7659098fa336240d494b0f9035e14bc42fc461224a9719f105e41026fed0f6f14188d9107b8c3d697a0cb1",
    'User-Agent': "PostmanRuntime/7.15.2",
    'Accept': "*/*",
    'Cache-Control': "no-cache",
    'Postman-Token': "c6d49ae7-7e7c-4fc1-87fa-6eb621db96fe,59850a03-3261-4dd3-8fdb-550985ba5530",
    'Host': "api-d.oz-services.ru",
    'Accept-Encoding': "gzip, deflate",
    'Content-Type': "multipart/form-data; boundary=--------------------------871104747068739662264204",
    'Content-Length': "12292189",
    'Connection': "keep-alive",
    'cache-control': "no-cache"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)


setUrl('https://api-d.oz-services.ru/api/folders/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'Connection' => 'keep-alive',
  'Content-Length' => '12292189',
  'Content-Type' => 'multipart/form-data; boundary=--------------------------871104747068739662264204',
  'Accept-Encoding' => 'gzip, deflate',
  'Host' => 'api-d.oz-services.ru',
  'Postman-Token' => 'c6d49ae7-7e7c-4fc1-87fa-6eb621db96fe,965a0a32-6e92-4e34-97dc-b92648ef4371',
  'Cache-Control' => 'no-cache',
  'Accept' => '*/*',
  'User-Agent' => 'PostmanRuntime/7.15.2',
  'X-Forensic-Access-Token' => '0ccbdb4627c9d07c6c5b8f6e6cca44b5f8cb0c54ad7659098fa336240d494b0f9035e14bc42fc461224a9719f105e41026fed0f6f14188d9107b8c3d697a0cb1',
  'content-type' => 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
));

$request->setBody('------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="photo1"; filename="1.jpg"
Content-Type: image/jpeg


------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="photo2"; filename="2.jpg"
Content-Type: image/jpeg


------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="video1"; filename="372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4"
Content-Type: video/mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="payload"

{
  "folder:meta_data": {
    "test": "test11234567"
  },
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_zoom_in",
      "orientation_portrait"
    ],
     "video2": [
      "video_selfie",
      "video_selfie_zoom_out",
      "orientation_portrait"
    ],
    "photo1": [
      "photo_id"
    ],
       "photo2": [
      "photo_selfie"
    ]
  }
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="video2"; filename="2c2177a1-ed2b-4443-b2c7-e489ab205fd4.mp4"
Content-Type: video/mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW--');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
RequestBody body = RequestBody.create(mediaType, "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"photo1\"; filename=\"1.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"photo2\"; filename=\"2.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"video1\"; filename=\"372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4\"\r\nContent-Type: video/mp4\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n{\n  \"folder:meta_data\": {\n    \"test\": \"test11234567\"\n  },\n  \"media:tags\": {\n    \"video1\": [\n      \"video_selfie\",\n      \"video_selfie_zoom_in\",\n      \"orientation_portrait\"\n    ],\n\t \"video2\": [\n      \"video_selfie\",\n      \"video_selfie_zoom_out\",\n      \"orientation_portrait\"\n    ],\n    \"photo1\": [\n      \"photo_id\"\n    ],\n       \"photo2\": [\n      \"photo_selfie\"\n    ]\n  }\n}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"video2\"; filename=\"2c2177a1-ed2b-4443-b2c7-e489ab205fd4.mp4\"\r\nContent-Type: video/mp4\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");
Request request = new Request.Builder()
  .url("https://api-d.oz-services.ru/api/folders/")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW")
  .addHeader("X-Forensic-Access-Token", "0ccbdb4627c9d07c6c5b8f6e6cca44b5f8cb0c54ad7659098fa336240d494b0f9035e14bc42fc461224a9719f105e41026fed0f6f14188d9107b8c3d697a0cb1")
  .addHeader("User-Agent", "PostmanRuntime/7.15.2")
  .addHeader("Accept", "*/*")
  .addHeader("Cache-Control", "no-cache")
  .addHeader("Postman-Token", "c6d49ae7-7e7c-4fc1-87fa-6eb621db96fe,fcc497bb-c480-4661-9a0a-00073d2a8ee6")
  .addHeader("Host", "api-d.oz-services.ru")
  .addHeader("Accept-Encoding", "gzip, deflate")
  .addHeader("Content-Type", "multipart/form-data; boundary=--------------------------871104747068739662264204")
  .addHeader("Content-Length", "12292189")
  .addHeader("Connection", "keep-alive")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

Пример JSON-ответа.

Пример JSON-ответа системы на вызов метода «Folder [ADD]» с аналогичными параметрами:

JSON


{
    "time_created": 1579853333,
    "time_updated": 1579853333,
    "meta_data": {
        "test": "test11234567"
    },
    "folder_id": "f5fea1c1-5797-487a-b0f5-673eea2f8a79",
    "resolution_time": null,
    "resolution_status": "INITIAL",
    "resolution_endpoint": null,
    "resolution_state_hash": "007c5bbe5beaab65",
    "resolution_comment": null,
    "resolution_suggest": null,
    "resolution_author_id": null,
    "is_archive": false,
    "media": [
        {
            "time_created": 1579853333,
            "time_updated": 1579853333,
            "meta_data": {},
            "media_id": "47e235cc-8844-4716-9c3d-2e37764fe15f",
            "media_type": "IMAGE_FOLDER",
            "info": {
                "thumb": {
                    "md5": "933fa1f5dd44d2c43f75e8044d4fa7a1",
                    "size": 17070,
                    "width": 300,
                    "height": 280,
                    "mime-type": "image/jpeg"
                },
                "original": {
                    "md5": "54b5d75d01488817bf041a5273de4585",
                    "size": 50971,
                    "width": 445,
                    "height": 416,
                    "mime-type": "image/jpeg"
                }
            },
            "tags": [
                "photo_selfie"
            ],
            "original_name": "2.jpg",
            "image_id": "47e235cc-8844-4716-9c3d-2e37764fe15f",
            "original_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/47e235cc-8844-4716-9c3d-2e37764fe15f.jpeg",
            "thumb_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/47e235cc-8844-4716-9c3d-2e37764fe15f_thumb.jpeg"
        },
        {
            "time_created": 1579853333,
            "time_updated": 1579853333,
            "meta_data": {},
            "media_id": "f35716ed-7abf-4198-8146-229eb4f2ad25",
            "media_type": "IMAGE_FOLDER",
            "info": {
                "thumb": {
                    "md5": "1827f89da365f01a24deb0329d231f80",
                    "size": 18261,
                    "width": 300,
                    "height": 300,
                    "mime-type": "image/jpeg"
                },
                "original": {
                    "md5": "9b1393886e54d93e1303ff284ae4dedf",
                    "size": 147204,
                    "width": 492,
                    "height": 492,
                    "mime-type": "image/jpeg"
                }
            },
            "tags": [
                "photo_id"
            ],
            "original_name": "1.jpg",
            "image_id": "f35716ed-7abf-4198-8146-229eb4f2ad25",
            "original_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/f35716ed-7abf-4198-8146-229eb4f2ad25.jpeg",
            "thumb_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/f35716ed-7abf-4198-8146-229eb4f2ad25_thumb.jpeg"
        },
        {
            "time_created": 1579853333,
            "time_updated": 1579853333,
            "meta_data": {},
            "media_id": "4ad2ef2b-24ab-44ee-ae50-17d41bce6927",
            "media_type": "VIDEO_FOLDER",
            "info": {
                "thumb": {
                    "md5": "65c26e859cd0ab26858c59ac68d27956",
                    "size": 18510,
                    "width": 225,
                    "height": 300,
                    "mime-type": "image/jpeg"
                },
                "video": {
                    "FPS": 30.0,
                    "md5": "aff630574ccfaf1eba06aaf44c9b12ca",
                    "size": 5969474,
                    "width": 800,
                    "height": 600,
                    "duration": 4.84,
                    "mime-type": "video/mp4"
                },
                "preview": {
                    "FPS": 30.0,
                    "md5": "aff630574ccfaf1eba06aaf44c9b12ca",
                    "size": 5969474,
                    "width": 800,
                    "height": 600,
                    "duration": 4.84,
                    "mime-type": "video/mp4"
                }
            },
            "tags": [
                "video_selfie",
                "video_selfie_zoom_out",
                "orientation_portrait"
            ],
            "original_name": "2c2177a1-ed2b-4443-b2c7-e489ab205fd4.mp4",
            "video_id": "4ad2ef2b-24ab-44ee-ae50-17d41bce6927",
            "video_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/4ad2ef2b-24ab-44ee-ae50-17d41bce6927.mp4",
            "thumb_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/4ad2ef2b-24ab-44ee-ae50-17d41bce6927_thumb.jpg",
            "preview_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/4ad2ef2b-24ab-44ee-ae50-17d41bce6927.mp4"
        },
        {
            "time_created": 1579853333,
            "time_updated": 1579853333,
            "meta_data": {},
            "media_id": "015dfea0-6109-4bcd-93c0-4d1953e77d99",
            "media_type": "VIDEO_FOLDER",
            "info": {
                "thumb": {
                    "md5": "3a344bc524b988c9d3a6dafd1e0ada4f",
                    "size": 18740,
                    "width": 225,
                    "height": 300,
                    "mime-type": "image/jpeg"
                },
                "video": {
                    "FPS": 30.0,
                    "md5": "2b90287b90e84ce1417f86d0081c4d79",
                    "size": 6123340,
                    "width": 800,
                    "height": 600,
                    "duration": 4.92,
                    "mime-type": "video/mp4"
                },
                "preview": {
                    "FPS": 30.0,
                    "md5": "2b90287b90e84ce1417f86d0081c4d79",
                    "size": 6123340,
                    "width": 800,
                    "height": 600,
                    "duration": 4.92,
                    "mime-type": "video/mp4"
                }
            },
            "tags": [
                "video_selfie",
                "video_selfie_zoom_in",
                "orientation_portrait"
            ],
            "original_name": "372d54ce-80f4-4d2e-a3c3-708f6162e599.mp4",
            "video_id": "015dfea0-6109-4bcd-93c0-4d1953e77d99",
            "video_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/015dfea0-6109-4bcd-93c0-4d1953e77d99.mp4",
            "thumb_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/015dfea0-6109-4bcd-93c0-4d1953e77d99_thumb.jpg",
            "preview_url": "http://api-d.oz-services.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/015dfea0-6109-4bcd-93c0-4d1953e77d99.mp4"
        }
    ]
}

Подробности JSON-ответа.

Первый блок ответа (стр.2-15) содержит основную информацию по папке.

Блок "media" (стр.16-166) содержит информацию по файлам, размещенным в папке.