Image APIs

Get Image List

OVERVIEW

Overview

Get images from publisher.

This API call is used to retrieve images from the system.

Since v5.1

HTTP Request

GET  /api/2/images?{parameters}

 

HTTP Headers
HTTP Request Header Description Example
Authorization The API Authorisation token "XXXXXXXXXXXXX"
Accept

The format of the expected response. 

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the default response given.

"application/xml"

 

API Accessibility

Access Type Description
API Token without user parameter Super admin, system admin, campaign admin, internal system admin, channel admin and editor can access the API.

 

Parameter details

Parameter Description Example
extension

To get images on basis of file extension (IGNORE CASE)

  • In absence of extension parameter all images will be returned
 extension=PNG,JPG
limit  Maximum result to fetch in system result page and default value is 30.  limit=7
offset  Is the Page number and default value is 0.  offset=0
search  Search Keyword for search the System pages.  search=Home
sort

To sort with different columns.

  • +/-name : will sort based on document name
  • +/-createdby : will sort based on the user name who uploaded the document.
  • +/-createddate : will sort based on the createddate
  • +/-modifieddate : will sort based on the modifieddate (DEFAULT)
  • +/-status : will sort based on status
  • +/-extension: will sort based on extension
 sort=+name
status 

 

To filter the result based on status

  • Status CSV can be passed in this parameter. active,archived OR 1,2 are the possible values.
status=active,archived

 

HTTP Response

Success

HTTP response 200 with a list of Image Objects

(Example below)

 

Example HTTP Request & Response

GET  https://example.com/context/api/2/images?extension=png

JSON Response

{
    "total": 3,
    "totalcount": 3,
    "currentpage": 0,
    "image": [
        {
            "id": 1002,
            "name": "PD20308_1001",
            "createdby": {
                "id": 27,
                "name": "Rishit Patel"
            },
            "createddate": "27 Feb 2019 11:19",
            "modifiedby": {
                "id": 27,
                "name": "Rishit Patel"
            },
            "modifieddate": "27 Feb 2019 11:19",
            "status": "active",
            "attachmentid": 2014,
            "filesize": "118.57 KB",
            "thumbnailurl": "https://example.com/context/flag/flag_2015.gif",
            "url": "https://example.com/context/flag/flag_2014.gif",
            "extension": "jpg",
            "height": 427,
            "width": 650
        },
        {
            "id": 1001,
            "name": "XML & char in tag",
            "createdby": {
                "id": 12,
                "name": "Mitul Patel"
            },
            "createddate": "27 Feb 2019 11:18",
            "modifiedby": {
                "id": 12,
                "name": "Mitul Patel"
            },
            "modifieddate": "27 Feb 2019 11:18",
            "status": "active",
            "attachmentid": 2012,
            "filesize": "33.99 KB",
            "thumbnailurl": "https://example.com/context/flag/flag_2013.gif",
            "url": "https://example.com/context/flag/flag_2012.gif",
            "extension": "PNG",
            "height": 845,
            "width": 1022
        }
    ]
}

XML Response

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<images>
    <total>3</total>
    <totalcount>3</totalcount>
    <currentpage>0</currentpage>
    <image>
        <id>1002</id>
        <name>PD20308_1001</name>
        <createdby>
            <id>27</id>
            <name>Rishit Patel</name>
        </createdby>
        <createddate>27 Feb 2019 11:19</createddate>
        <modifiedby>
            <id>27</id>
            <name>Rishit Patel</name>
        </modifiedby>
        <modifieddate>27 Feb 2019 11:19</modifieddate>
        <status>active</status>
        <attachmentid>2014</attachmentid>
        <filesize>118.57 KB</filesize>
        <thumbnailurl>https://example.com/context/flag/flag_2015.gif</thumbnailurl>
        <url>https://example.com/context/flag/flag_2014.gif</url>
        <extension>jpg</extension>
        <height>427</height>
        <width>650</width>
    </image>
    <image>
        <id>1001</id>
        <name>XML &amp; char in tag</name>
        <createdby>
            <id>12</id>
            <name>Mitul Patel</name>
        </createdby>
        <createddate>27 Feb 2019 11:18</createddate>
        <modifiedby>
            <id>12</id>
            <name>Mitul Patel</name>
        </modifiedby>
        <modifieddate>27 Feb 2019 11:18</modifieddate>
        <status>active</status>
        <attachmentid>2012</attachmentid>
        <filesize>33.99 KB</filesize>
        <thumbnailurl>https://example.com/context/flag/flag_2013.gif</thumbnailurl>
        <url>https://example.com/context/flag/flag_2012.gif</url>
        <extension>PNG</extension>
        <height>845</height>
        <width>1022</width>
    </image>
</images>

 
Validation Messages
Description Response Response Code
When offset is negative or not a number. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
    <ref>106</ref>
    <summary>Invalid parameter: offset</summary>
</error>
400
When limit is not a positive number. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
    <ref>107</ref>
    <summary>Invalid parameter: limit</summary>
</error>
400
When  invalid sort parameter is passed <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
    <ref>79</ref>
    <summary>Invalid parameter: sort</summary>
</error>
400

 

Comments


0 Comments

Last Updated: Nov 08,2024