Skip to content

Post API Add Media Upload Request

Dominik Magdaleński edited this page Jul 3, 2019 · 1 revision

Post API - /add_media_upload_request

URL: https://dive-networks.com/api/rpc/34/add_media_upload_request

HTTP Method: POST

HTTP Headers:

  • Content-Type: application/json,
  • Authorization: Token your-api-token-here.

Body: JSON object with "media_type" field.

Successful response

Status: 201 Created

Body:

{
  "result": {
    (...MediaUploadRequest fields...)
  }
}

Example (HTTPie)

HTTPie request:

http --follow POST https://dive-networks.com/api/rpc/34/add_media_upload_request Authorization:"Token your-api-token-here" media_type=image

HTTPie response:

HTTP/1.1 201 Created
(...headers...)

{
    "result": {
        "created_at": "2019-06-17T11:43:04.406597-04:00",
        "data": {},
        "expires_at": "2019-06-17T11:53:03.404639-04:00",
        "id": 5,
        "media_type": "image",
        "presigned_s3_post": {
            "fields": {
                "key": "images/ab3ae592-e327-41a4-ada6-d5fda11535c0",
                "policy": "eyJleHBpcmF0aW9uIjogIjIwMTktMDYtMTdUMTU6NTM6MDRaIiwgImNvbmRpdGlvbnMiOiBbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsIDAsIDIwOTcxNTIwXSwgeyJidWNrZXQiOiAiZGl2ZS1tZWRpYS11cGxvYWQtdGVzdC0yMjA0MjAxOSJ9LCB7ImtleSI6ICJpbWFnZ
XMvYWIzYWU1OTItZTMyNy00MWE0LWFkYTYtZDVmZGExMTUzNWMwIn0sIHsieC1hbXotYWxnb3JpdGhtIjogIkFXUzQtSE1BQy1TSEEyNTYifSwgeyJ4LWFtei1jcmVkZW50aWFsIjogIkFLSUFYTDdFQUdEUVFHRUhXUVFJLzIwMTkwNjE3L2V1LWNlbnRyYWwtMS9zMy9hd3M0X3JlcXVlc3QifSwgeyJ4LWFte
i1kYXRlIjogIjIwMTkwNjE3VDE1NDMwNFoifV19",
                "x-amz-algorithm": "AWS4-HMAC-SHA256",
                "x-amz-credential": "AKIAXL7EAGDQQGEHWQQI/20190617/eu-central-1/s3/aws4_request",
                "x-amz-date": "20190617T154304Z",
                "x-amz-signature": "33355fc9bdc9383bf43a5f104f3849f1e1528bdf82582c09d8c77be232160a84"
            },
            "url": "https://dive-media-upload-test-22042019.s3.amazonaws.com/"
        },
        "status": "init",
        "updated_at": "2019-06-17T11:43:04.406597-04:00"
    }
}