Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor
Introduction
Introduction
530 Image Or File Resources Download

The endpoint of this service allows to download file, image or image variation.


Anchor
Configuration
Configuration
530 Image Or File Resources Download

Each view is associated to an identifier and a configuration JSON.

JSON example

Code Block
{
  "objectname": "name of the object",
  "description": "description of view",
  "prop": "name of property",
  "variation": "name of variation"
}
Properties and sections
  • objectname: String - Name of the object (type)

  • description: String - Short description of view

  • prop: String - Name of property that contains the file or image

  • variation: String, optional - Name of variation+

    Possible values are:

    • $native: the default value, for the original file

    • thumbnailTiny: document preview in JPEG, 100 pixels height

    • thumbnailSmall: document preview in JPEG, 200 pixels height

    • thumbnailBig: document preview in JPEG, 600 pixels height

    • thumbnailReal: document preview in JPEG, real size

    • pdf: document converted or included in a PDF

  • rscname: JSon, optional - The description of name for attachment. By default, the name is rscname with simple=false.



    Code Block
    "rscname": {
      "type": "type of function",
      "options": {
          "name of option 1":"value of option 1",
          "name of option 2":"value of option 2"
      }
    }

    Existing types:
    • rscname: the name of attachment is the name of the resource in the property

      Option:

      • simple: Boolean, optional. If true, only the first part and the extension is kept for the name. By example, if the name of image is sample.w200xh180.jpg, the name of attachment will be sample.jpg. If simple is false (default value), the full name is used (ie sample.w200xh180.jpg)

    • field: the name of attachment is the value of the name of object, followed by the name of the property field

      Option: none.

Anchor
EndPoints
EndPoints
530 Image Or File Resources Download

There are two endpoints available:

  • To download a file

  • To get a list of available views

Anchor
Download an image
Download an image
EndPoint: Download an image

since 11.14

Code Block
GET http://host:port/app/api/json/resource/{actionName}/{id}


since 11.12

Code Block
GET http://host:port/app/api/json/resource


Legacy endpoint:

Code Block
http://host:port/app/_plugins/WXM_RESTAPI/page/resource.jspz


Supported methods: GET, HEAD

Parameters

  • viewName: String - View identifier

  • id (or form_id): Object identifier (Mandatory)

  • variation: String, optional - The variation name, if different than configured

  • index: Numeric, optional -If the variation is split into multiple images, designates the index number of the image among all these images (The valueq range from 0 to the number of images excluded).

  • since 11.13attachment: boolean, optional (default is true): specify if the Content-Disposition header is set (with filename) or not

Response format

The resource is provided in the body, as attachment. The response contains the following specific headers:

  • Content-ID: the id of the content. The form of the content id is <the name of the view>/<the name of the variation if any>/<the index number if there are several images in the variation>.

  • X-WediaRest-Variation: the name of variation

  • X-WediaRest-Resource-Count: the number of images in the variation

  • X-WediaRest-Resource-Index: The index number

Security

The resource action of the RESTAPI domain allows the management of endpoint call authorisation. There are two parameters:

  • surfer: surfer

  • viewName: the view identifier.

Errors codes

HTTP CodeAPI CodeDefinition

404

404/600

Unknown view

403

403/600

Unreachable view (or forbidden)

422

422/600

Unreachable view (configuration problem)

422

422/601

Resource not found

403

403/602

Forbidden view


Anchor
available views list
available views list
EndPoint: available views list

since 11.12

GET http://host:port/app/api/json/catalog/resource

Legacy endpoint:

http//host:port/app/_plugins/WXM_RESTAPI/page/catalog/resourceview.jspz

Supported methods: GET, HEAD

Parameters

  • viewName: Character string, an optional Regular Expression type filter (by default, all accessible views are displayed)

Response format

Code Block
{
  "catalog": "list of resource views",
  "response": {
    "data": [ {
      "name": "name of the view",
      "description": "description of the view",
      "variation": "name of variation"
      }
    }
    ]
  },
  "links": {
    "href": "http://host:port/app/_plugins/WXM_RESTAPI/page/catalog/resourceview.jspz"
  },
  "status": 200,
  "time": 29
}
Security

The catalog action of RESTAPI domain allows the management of the endpoint call authorisation. There are two parameters:

  • surfer: surfer

  • endPoint: resource as value.

Errors codes

HTTP CodeAPI CodeDefinition

403

403/601

Unreachable catalog (or forbidden)