API Operations

Documentation for documents

show

Overview

Allows to retrieve the details of a single document accessible by the user.

As all others, this method requires authentication. To understand how to retrieve the authentication token, refer to the Login documentation page.

Request

endpoint
/api/v1/documents/[id].[format]
http method
GET

id is the ID obtained with the index api call.

format must be either json or xml

Required Parameters

entity_id
unique identifier of the entity whom documents are required

Optional Parameters

None

Response

Response is a list of the attributes of the document, containing the following fields.

id
unique identifier of this entity
file_name
Name of the file
file_path
URL to download the actual document file
document_type_dc_identifier
identified of the document type
producer_id
ID of the entity that originally uploaded the document
data_file_name
Original file name of the attachment
data_content_type
Content type of the attachment
data_file_size
File size of the attachment
dc_creator
Descriptive name of the creator of the document
is_private
Flag that indicates document as private
metadata
Hash containing the metadata

This is a sample response in JSON format:

{
    "document": {
        "id": 300,
        "file_name": "4588_001.pdf",
        "file_path": "http://localhost:3000/000/000/300/original/4588_001.pdf?1369148105",
        "document_type_dc_identifier": "DT:00183",
        "producer_id": 13,
        "data_file_name": "4588_001.pdf",
        "data_content_type": "application/pdf",
        "data_file_size": 36413,
        "dc_creator": "Producer",
        "is_private": false,
        "metadata": {
            "month_reference": "1",
            "month": "1",
            "year": "2013"
        }
    }
}
        

Examples

In each sample below, you have to substitute values between angular brackets (< and >) with the correct input data.

cUrl

curl -H "Authorization: Token token=<auth_token>" https://www.myo.io/api/v1/documents/14.json -G -d 'entity_id=<entity_id>'

Ruby (with rest_client)

require 'rest_client'
RestClient::Request.new(:method => "get", :url => 'https://www.myo.io/api/v1/documents/14.json', :headers => { :accept => :json, :content_type => :json, :'Authorization' => "Token token=<auth_token>"}, :payload => {:entity_id => <entity_id>}).execute