Difference between revisions of "API Assets List"

From unroole CMS wiki
Jump to: navigation, search
(Examples)
Line 291: Line 291:
 
  </hash>
 
  </hash>
  
 +
</nowiki>
 +
</blockquote>
 +
|}
 +
 +
=== All pdfs on an account ===
 +
 +
{| class="wikitable"
 +
|-
 +
! Parameters
 +
! Values
 +
|-
 +
| token
 +
| 1f0qpLwoV5oIcfnU2yvO
 +
|-
 +
| search
 +
| pdf
 +
|-
 +
| fields
 +
| id,name,description,file_name,content_type,file_size,updated_at,created_at,type,video_id,dimensions,upload_id,private,sharable,editable,printable,used,tags,url,styles
 +
|}
 +
 +
{| class="wikitable collapsible collapsed"
 +
|-
 +
! JSON
 +
|-
 +
| <nowiki>http://api.unroole.com/accounts/1/assets.json?token=1f0qpLwoV5oIcfnU2yvO&search=pdf&fields=id,name,description,file_name,content_type,file_size,updated_at,created_at,type,video_id,dimensions,upload_id,private,sharable,editable,printable,used,tags,url,styles</nowiki>
 +
|-
 +
| <blockquote>
 +
<nowiki>
 +
{ "assets" : [ { "content_type" : "application/pdf",
 +
        "created_at" : "2012-06-25T14:59:48Z",
 +
        "description" : "",
 +
        "dimensions" : {  },
 +
        "editable" : false,
 +
        "file_name" : "GONews_SpecEd_ENG.pdf",
 +
        "file_size" : 692261,
 +
        "id" : 302,
 +
        "name" : "GONews_SpecEd_ENG",
 +
        "printable" : true,
 +
        "private" : true,
 +
        "sharable" : false,
 +
        "styles" : {  },
 +
        "tags" : [ "pdf",
 +
            "train",
 +
            "go",
 +
            "newsletter"
 +
          ],
 +
        "type" : "Pdf",
 +
        "upload_id" : "asset_upload_d04ea4e4",
 +
        "url" : "https://cdn-unroole-dev.s3.amazonaws.com/system/asset_pdfs/302/original/GONews_SpecEd_ENG.pdf?AWSAccessKeyId=AKIAI54VTHLBTQ46H3FA&Signature=SqhpaVHcf%2BdCv8QE%2BAM32AADg20%3D&Expires=1340638792&updated_at=1340636388",
 +
        "video_id" : null
 +
      },
 +
      { "content_type" : "application/pdf",
 +
        "created_at" : "2012-06-25T14:59:32Z",
 +
        "description" : "",
 +
        "dimensions" : {  },
 +
        "editable" : false,
 +
        "file_name" : "bash.pdf",
 +
        "file_size" : 928014,
 +
        "id" : 300,
 +
        "name" : "bash",
 +
        "printable" : false,
 +
        "private" : true,
 +
        "sharable" : false,
 +
        "styles" : {  },
 +
        "tags" : [  ],
 +
        "type" : "Pdf",
 +
        "upload_id" : "asset_upload_d04ea4e4",
 +
        "url" : "https://cdn-unroole-dev.s3.amazonaws.com/system/asset_pdfs/300/original/bash.pdf?AWSAccessKeyId=AKIAI54VTHLBTQ46H3FA&Signature=oZmflRCdGOuZeUEFjLgvNqEWWig%3D&Expires=1340638792&updated_at=1340636372",
 +
        "video_id" : null
 +
      }
 +
    ],
 +
  "http_status" : 200,
 +
  "result_length" : 2
 +
}
 +
</nowiki>
 +
</blockquote>
 +
|}
 +
 +
{| class="wikitable collapsible collapsed"
 +
|-
 +
! XML
 +
|-
 +
| <nowiki>http://api.unroole.com/accounts/1/assets.xml?token=1f0qpLwoV5oIcfnU2yvO&search=pdf&fields=id,name,description,file_name,content_type,file_size,updated_at,created_at,type,video_id,dimensions,upload_id,private,sharable,editable,printable,used,tags,url,styles</nowiki>
 +
|-
 +
| <blockquote>
 +
<nowiki>
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<hash>
 +
  <assets type="array">
 +
    <asset>
 +
      <id type="integer">302</id>
 +
      <name>GONews_SpecEd_ENG</name>
 +
      <description></description>
 +
      <file-name>GONews_SpecEd_ENG.pdf</file-name>
 +
      <content-type>application/pdf</content-type>
 +
      <file-size type="integer">692261</file-size>
 +
      <created-at type="datetime">2012-06-25T14:59:48Z</created-at>
 +
      <type>Pdf</type>
 +
      <video-id nil="true">
 +
    </video-id>
 +
      <dimensions></dimensions>
 +
      <upload-id>asset_upload_d04ea4e4</upload-id>
 +
      <private type="boolean">true</private>
 +
      <sharable type="boolean">false</sharable>
 +
      <editable type="boolean">false</editable>
 +
      <printable type="boolean">true</printable>
 +
      <tags type="array">
 +
        <tag>pdf</tag>
 +
        <tag>train</tag>
 +
        <tag>go</tag>
 +
        <tag>newsletter</tag>
 +
      </tags>
 +
      <url>https://cdn-unroole-dev.s3.amazonaws.com/system/asset_pdfs/302/original/GONews_SpecEd_ENG.pdf?AWSAccessKeyId=AKIAI54VTHLBTQ46H3FA&amp;Signature=IlCGHZFkCPXafVJXIGWRGUM2Qic%3D&amp;Expires=1340638461&amp;updated_at=1340636388</url>
 +
      <styles></styles>
 +
    </asset>
 +
    <asset>
 +
      <id type="integer">300</id>
 +
      <name>bash</name>
 +
      <description></description>
 +
      <file-name>bash.pdf</file-name>
 +
      <content-type>application/pdf</content-type>
 +
      <file-size type="integer">928014</file-size>
 +
      <created-at type="datetime">2012-06-25T14:59:32Z</created-at>
 +
      <type>Pdf</type>
 +
      <video-id nil="true">
 +
    </video-id>
 +
      <dimensions></dimensions>
 +
      <upload-id>asset_upload_d04ea4e4</upload-id>
 +
      <private type="boolean">true</private>
 +
      <sharable type="boolean">false</sharable>
 +
      <editable type="boolean">false</editable>
 +
      <printable type="boolean">false</printable>
 +
      <tags type="array"/>
 +
      <url>https://cdn-unroole-dev.s3.amazonaws.com/system/asset_pdfs/300/original/bash.pdf?AWSAccessKeyId=AKIAI54VTHLBTQ46H3FA&amp;Signature=NTA2Z6AySAd3qg2c4JIbMbR6Hz8%3D&amp;Expires=1340638461&amp;updated_at=1340636372</url>
 +
      <styles></styles>
 +
    </asset>
 +
  </assets>
 +
  <result-length type="integer">2</result-length>
 +
  <http-status type="integer">200</http-status>
 +
</hash>
 
  </nowiki>
 
  </nowiki>
 
</blockquote>
 
</blockquote>
 
|}
 
|}

Revision as of 11:40, 25 June 2012

Summary

Allows querying for a list of assets. The query is a wildcard search on the asset's:

  • id
  • name
  • description
  • content_type
  • type
  • file_name
  • upload_id
  • tags

URI

https://api.unroole.com/accounts/[account-id]/assets

HTTP Method

GET

Required Paramaters

Paramater Default Maximum Length Accepted Values Description
token API Persistence Token that identifies this user and its permissions.

Optional Paramaters

Paramater Default Maximum Length Accepted Values Description
search string The search terms to be used in the query.
limit TBD The maximum number of assets to return.
fields id, name, file_name, url API Asset Fields List of comma separated fields to be returned in the response.
url_time_limit 60 The length of time (in seconds) that the asset url will be accessible for if the asset is private. This only applies to the response.

Response

Field Type Description
http_status integer API Status Code
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
error Rails default
assets array of API Asset Fields List of files that matched the search query
result_length integer Total number of results that could be returned. This may not be the number of assets in the response, as it is truncated by limit parameter.

Examples

All assets on an account

Parameters Values
token 1f0qpLwoV5oIcfnU2yvO

All pdfs on an account

Parameters Values
token 1f0qpLwoV5oIcfnU2yvO
search pdf
fields id,name,description,file_name,content_type,file_size,updated_at,created_at,type,video_id,dimensions,upload_id,private,sharable,editable,printable,used,tags,url,styles