Folder MEDIA [ADD] Method (POST)

Folder Media [ADD] method is used to add files to an existing folder.

Additional Request Parameters.

All parameters of this method are mandatory, files can be added one at a time.

  • folder_id: unique identifier of the target folder (in the request headline);
  • photo1…photoN: picture files to be added to the folder (in the request body);
  • video1…videoN: video files to be added to the folder (in the request body);
  • payload: variable that contains file tags. The use is similar to Folder [ADD] method (in the request body).

Request Examples.

Example of running the Folder Media [ADD] method in Postman:

Examples of POST request syntax using Folder Media [ADD] method with following parameters:

  • Add 1 photo and 1 video files to the folder with ID “f5fea1c1-5797-487a-b0f5-673eea2f8a79”
  • Add tag "photo_selfie” to file image1
  • Add tags "video_selfie", "video_selfie_left", "orientation_portrait” to file video1

HTTP

Bash

Python

php

Java


POST /api/folders/f5fea1c1-5797-487a-b0f5-673eea2f8a79/media/ HTTP/1.1
Host: youradress.ru
X-Forensic-Access-Token: 0ccbdb4627c9d07c6c5b8f6e6cca44b5f8cb0c54ad7659098fa336240d494b0f9035e14bc42fc461224a9719f105e41026fed0f6f14188d9107b8c3d697a0cb1
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: 5cfe9efb-24ab-43a8-98d7-3e6e60b3f96f,dbd8bc79-a33a-478a-ae88-d63e0a5baf93
Host: youradress.ru
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Length: 4775975
Connection: keep-alive
cache-control: no-cache


Content-Disposition: form-data; name="image1"; filename="/X:/90eace77-ca39-45fa-853e-b9495d389640.jpeg


------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="image1"; filename="/X:/90eace77-ca39-45fa-853e-b9495d389640.jpeg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="video1"; filename="/X:/2726e120-422e-46e1-a658-367949a9cc3d.mp4


------WebKitFormBoundary7MA4YWxkTrZu0gW--,
Content-Disposition: form-data; name="image1"; filename="/X:/90eace77-ca39-45fa-853e-b9495d389640.jpeg


------WebKitFormBoundary7MA4YWxkTrZu0gW--
Content-Disposition: form-data; name="video1"; filename="/X:/2726e120-422e-46e1-a658-367949a9cc3d.mp4


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

{
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_left",
      "orientation_portrait"
    ],
    "image1": [
      "photo_selfie"
    ]
  }
}
------WebKitFormBoundary7MA4YWxkTrZu0gW--


curl -X POST \
  https://youradress.ru/api/folders/f5fea1c1-5797-487a-b0f5-673eea2f8a79/media/ \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 4775975' \
  -H 'Content-Type: multipart/form-data; boundary=--------------------------863638802816942085754134' \
  -H 'Host: youradress.ru' \
  -H 'Postman-Token: 5cfe9efb-24ab-43a8-98d7-3e6e60b3f96f,bb6d2c92-3644-43a8-9975-12f57dd01344' \
  -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 'image1=@/X:/Pa3Hoe/Work/Датасеты/Mobile_check (Алтын)/6acdc08e-465c-4f91-848b-0e11631172c0/90eace77-ca39-45fa-853e-b9495d389640.jpeg' \
  -F 'video1=@/X:/Pa3Hoe/Work/Датасеты/Mobile_check (Алтын)/6acdc08e-465c-4f91-848b-0e11631172c0/2726e120-422e-46e1-a658-367949a9cc3d.mp4' \
  -F 'payload={
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_left",
      "orientation_portrait"
    ],
    "image1": [
      "photo_selfie"
    ]
  }
}'


import requests

url = "https://youradress.ru/api/folders/f5fea1c1-5797-487a-b0f5-673eea2f8a79/media/"

payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"image1\"; filename=\"90eace77-ca39-45fa-853e-b9495d389640.jpeg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"video1\"; filename=\"2726e120-422e-46e1-a658-367949a9cc3d.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  \"media:tags\": {\n    \"video1\": [\n      \"video_selfie\",\n      \"video_selfie_left\",\n      \"orientation_portrait\"\n    ],\n    \"image1\": [\n      \"photo_selfie\"\n    ]\n  }\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': "5cfe9efb-24ab-43a8-98d7-3e6e60b3f96f,07fde835-bc62-423f-ad78-aca53d691005",
    'Host': "youradress.ru",
    'Accept-Encoding': "gzip, deflate",
    'Content-Type': "multipart/form-data; boundary=--------------------------863638802816942085754134",
    'Content-Length': "4775975",
    'Connection': "keep-alive",
    'cache-control': "no-cache"
    }

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

print(response.text)


setUrl('https://youradress.ru/api/folders/f5fea1c1-5797-487a-b0f5-673eea2f8a79/media/');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'Connection' => 'keep-alive',
  'Content-Length' => '4775975',
  'Content-Type' => 'multipart/form-data; boundary=--------------------------863638802816942085754134',
  'Accept-Encoding' => 'gzip, deflate',
  'Host' => 'youradress.ru',
  'Postman-Token' => '5cfe9efb-24ab-43a8-98d7-3e6e60b3f96f,07dc329c-63ff-40fa-af28-86729368a5d2',
  '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="image1"; filename="90eace77-ca39-45fa-853e-b9495d389640.jpeg"
Content-Type: image/jpeg


------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="video1"; filename="2726e120-422e-46e1-a658-367949a9cc3d.mp4"
Content-Type: video/mp4


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

{
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_left",
      "orientation_portrait"
    ],
    "image1": [
      "photo_selfie"
    ]
  }
}
------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=\"image1\"; filename=\"90eace77-ca39-45fa-853e-b9495d389640.jpeg\"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"video1\"; filename=\"2726e120-422e-46e1-a658-367949a9cc3d.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  \"media:tags\": {\n    \"video1\": [\n      \"video_selfie\",\n      \"video_selfie_left\",\n      \"orientation_portrait\"\n    ],\n    \"image1\": [\n      \"photo_selfie\"\n    ]\n  }\n}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");
Request request = new Request.Builder()
  .url("https://youradress.ru/api/folders/f5fea1c1-5797-487a-b0f5-673eea2f8a79/media/")
  .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", "5cfe9efb-24ab-43a8-98d7-3e6e60b3f96f,a191739c-cc90-4ce0-89ad-9e387438dd10")
  .addHeader("Host", "youradress.ru")
  .addHeader("Accept-Encoding", "gzip, deflate")
  .addHeader("Content-Type", "multipart/form-data; boundary=--------------------------863638802816942085754134")
  .addHeader("Content-Length", "4775975")
  .addHeader("Connection", "keep-alive")
  .addHeader("cache-control", "no-cache")
  .build();

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

Example of JSON Response.

Example of the system's JSON response to calling Folder Media [ADD] method with similar parameters:

JSON


[
    {
        "time_created": 1579857057,
        "time_updated": 1579857057,
        "meta_data": {},
        "media_id": "2d678796-933d-450e-accf-6dcf47011095",
        "media_type": "IMAGE_FOLDER",
        "info": {
            "thumb": {
                "md5": "e797fba781c5d493648cf892993c8982",
                "size": 14077,
                "width": 300,
                "height": 189,
                "mime-type": "image/jpeg"
            },
            "original": {
                "md5": "7db11e1e3d2676558d1e2ea4a732e4b0",
                "size": 40402,
                "width": 766,
                "height": 483,
                "mime-type": "image/jpeg"
            }
        },
        "tags": [
            "photo_selfie"
        ],
        "original_name": "90eace77-ca39-45fa-853e-b9495d389640.jpeg",
        "image_id": "2d678796-933d-450e-accf-6dcf47011095",
        "original_url": "http://youradress.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/2d678796-933d-450e-accf-6dcf47011095.jpeg",
        "thumb_url": "http://youradress.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/2d678796-933d-450e-accf-6dcf47011095_thumb.jpeg"
    },
    {
        "time_created": 1579857057,
        "time_updated": 1579857057,
        "meta_data": {},
        "media_id": "c9bc6cae-39bc-4bd6-8b4f-571f9ed75810",
        "media_type": "VIDEO_FOLDER",
        "info": {
            "thumb": {
                "md5": "6d1f0aba436940d7aa24677cacd26821",
                "size": 16307,
                "width": 225,
                "height": 300,
                "mime-type": "image/jpeg"
            },
            "video": {
                "FPS": 19.96,
                "md5": "22946e88b86b78c6fe8f12d17332697c",
                "size": 4734874,
                "width": 800,
                "height": 600,
                "duration": 4.61,
                "mime-type": "video/mp4"
            },
            "preview": {
                "FPS": 19.96,
                "md5": "22946e88b86b78c6fe8f12d17332697c",
                "size": 4734874,
                "width": 800,
                "height": 600,
                "duration": 4.61,
                "mime-type": "video/mp4"
            }
        },
        "tags": [
            "video_selfie",
            "video_selfie_left",
            "orientation_portrait"
        ],
        "original_name": "2726e120-422e-46e1-a658-367949a9cc3d.mp4",
        "video_id": "c9bc6cae-39bc-4bd6-8b4f-571f9ed75810",
        "video_url": "http://youradress.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/c9bc6cae-39bc-4bd6-8b4f-571f9ed75810.mp4",
        "thumb_url": "http://youradress.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/c9bc6cae-39bc-4bd6-8b4f-571f9ed75810_thumb.jpg",
        "preview_url": "http://youradress.ru/static/f5fea1c1-5797-487a-b0f5-673eea2f8a79/c9bc6cae-39bc-4bd6-8b4f-571f9ed75810.mp4"
    }
]

Details of JSON Response.

The response contains information on files added to the folder.