Introduction
This article explains how to use the File Upload End Point to upload files to the platform.
About the File Upload End Point
With various end points, you may upload a file associated with the object. For example, the app icon, app featured image, or build file for a given app. For each of these objects, you must first use the following end point to upload the file first, then use the returned file_id in the subsequent call for the object. The following section describes how to first upload the file and obtain the file_id.
Uploading a File
To upload the file, use the following curl request:
curl -H"Access-Token: <<your token>>" -F "file=@icon.png" https://cirrus.app47.com/api/v2/upload_file
On success, you can expect the following response:
{ "results": { "file_id":"5621b726256f5371b7000003", "url":"https://s3.amazonaws.com/a47_staging/uploaded_files/uploads/5621b726256f5371b7000003/original.png", "success":true }, "md5":"183cd15a639c3f41937632ed7e681501" }
On failure, you can expect the following response:
{ "results": { "message":"No file attached in request", "success":false }, "md5":"183cd15a549c1f41937632ed7e613201" }
HTTP POST Low Level Details
If you are using a different platform than curl, the following low level form post will hopefully allow you to understand the expected input on this end point.
Your POST should be formatted as follows:
POST /api/v2/uploade_file HTTP/1.1 Host: cirrus.app47.com Content-Length: 611 Content-Type: multipart/form-data; boundary=265141 Accept: application/json Accept-Encoding: gzip, deflate Access-Token: <<your token>> --265141 Content-Disposition: form-data; name="file"; filename="icon.png" Content-Type: text/plain <binary data> --265141
Comments
0 comments
Please sign in to leave a comment.