Paginated responses

From Safe Creative API
Jump to navigation Jump to search

Some components return a paginated list. Use the page parameter to get different pages.

Page size is fixed, depending on the called component.

Syntax

All paginated responses share the same structure:

  • listpage
    • recordtotal: Total number of records in the list
    • pagetotal: Total number of pages
    • list: List of elements in the current list
      • elements: XML items, depending on the called component

Note that the response does not include the number of the returned page. You should remember what you asked for.

Example

REQUEST for page 1

https://api.safecreative.org/v2/
?authkey=1i5g2aaf2bz09lyo867cuimqg
&component=user.licenses
&page=1
&ztime=1271749823888
&signature=0c740f90e64eac87502c4a0630363ad65fbad7ec

RESPONSE for page 1

<?xml version="1.0" encoding="UTF-8"?>

<listpage>
   <recordtotal>218</recordtotal>
   <pagetotal>9</pagetotal>
   <list>
     <license>
       <code>copyright</code>
       <name>All rights reserved</name>
       <shortname>(c)</shortname>
       <url>http://www.safecreative.org/license/copyright</url>
       <features>
         <recognition>NOT_APPLICABLE</recognition>
         <distribution>NO</distribution>
         <derivations>NO</derivations>
         <timelimited>NOT_APPLICABLE</timelimited>
         <commercial>NO</commercial>
       </features>
     </license>
     [...]
     <license>
       <code>http://creativecommons.org/licenses/by/2.5/my/</code>
       <name>Attribution 2.5 Malaysia</name>
       <shortname>CC by 2.5 my</shortname>
       <url>http://creativecommons.org/licenses/by/2.5/my/legalcode</url>
       <jurisdiction>my</jurisdiction>
       <features>
         <recognition>YES</recognition>
         <distribution>YES</distribution>
         <derivations>YES</derivations>
         <timelimited>NOT_APPLICABLE</timelimited>
         <commercial>YES</commercial>
       </features>
     </license>
   </list>
</listpage>

REQUEST for page 2

https://api.safecreative.org/v2/
?authkey=1i5g2aaf2bz09lyo867cuimqg
&component=user.licenses
&page=2
&ztime=1271749823888
&signature=0c740f90e64eac87502c4a0630363ad65fbad7ec

RESPONSE for page 2

<?xml version="1.0" encoding="UTF-8"?>
<listpage>
   <recordtotal>218</recordtotal>
   <pagetotal>9</pagetotal>
   <list>
     <license>
       <code>http://creativecommons.org/licenses/by/2.5/nl/</code>
       <name>Attribution 2.5 Netherlands</name>
       <shortname>CC by 2.5 nl</shortname>
       <url>http://creativecommons.org/licenses/by/2.5/nl/legalcode</url>
       <jurisdiction>nl</jurisdiction>
       <features>
         <recognition>YES</recognition>
         <distribution>YES</distribution>
         <derivations>YES</derivations>
         <timelimited>NOT_APPLICABLE</timelimited>
         <commercial>YES</commercial>
       </features>
     </license>
     [...]
     <license>
       <code>http://creativecommons.org/licenses/by-nc/2.5/cn/</code>
       <name>Attribution-NonCommercial 2.5 China Mainland</name>
       <shortname>CC by-nc 2.5 cn</shortname>
       <url>http://creativecommons.org/licenses/by-nc/2.5/cn/legalcode</url>
       <jurisdiction>cn</jurisdiction>
       <features>
         <recognition>YES</recognition>
         <distribution>YES</distribution>
         <derivations>YES</derivations>
         <timelimited>NOT_APPLICABLE</timelimited>
         <commercial>NO</commercial>
       </features>
     </license>
   </list>
</listpage>