Home Page > Integration > REST API > Files

Files

Files - /REST/1/Files

This endpoint is used for manipulating files within the system. Objects are always returned in a JSON format within an array. Empty results return an empty array.

 

It should be noted that this resource works slightly different to others in that the JSON body is provided in a form-data parameter. Here is an outline of how the form-data should appear:

 

Field Name Field Value
file An array of physical files to be uploaded to the system.
_jsonBody The JSON Object as described below.

 

Each Object within the JSON list presented in _jsonBody is matched against the file using the original_filename attribute. Below is an example of a POST using curl:

 

curl -u admin:admin -X POST http://my.openasset.example.org/REST/1/Files
    -F file=@filename001.jpg
    -F _jsonBody='[
        {
            "category_id": 1,
            "original_filename": "filename001.jpg"
        }]'

 

Object

The File object takes/returns the following JSON object.


[
    ​{
        ​"access_level": "<int>",
        "alternate_store_id": "<int>",
        "caption": "<text>",
        "category_id": "<int>",
        "click_count": "<int>",
        "contains_audio": "<bool>",
        "contains_video": "<bool>",
        "copyright_holder_id": "<int>",
        "created": "<date>",
        "description": "<text>",
        "download_count": "<int>",
        "duration": "<int>",
        "filename": "<string>",
        "id": "<int>",
        "md5_at_upload": "<hash>",
        "md5_now": "<hash>",
        "original_filename": "<string>",
        "photographer_id": "<int>",
        "project_id": "<int>",
        "rank": "<int>",
        "rotation_since_upload": "<bool>",
        "uploaded": "<date>",
        "user_id": "<int>"
    }
]

GET

As with other resources, this resource is subject to the global parameters mentioned in the REST Overview.

 

PUT

The following JSON parameters are available when updating a resource.

 

JSON Parameter Allowed Values Notes
access_level int  
caption string  
copyright_holder_id int  
description string  
photographer_id int  
rank int  
rotate_degrees enum:0,90,180,270 Represents a clockwise rotation. Optional

 

POST

The following JSON parameters are required when creating a resource:

 

JSON Parameter Allowed Values Notes
category_id int  
original_filename string Must match filename used in file post parameter
project_id int Required if it is a project based category
album_id int Optional
partial_filename string Optional
rotate_degrees enum:0,90,180,270 Represents a clockwise rotation. Optional

DELETE

The resource can be deleted using this verb and including the id in the endpoint URL.

Last modified
03:52, 14 Dec 2015

Tags

This page has no custom tags.

Classifications

This page has no classifications.