Versions Compared

Key

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

...

Introduction

...

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

...

Configuration

...

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.

...

EndPoints

...

There are two endpoints available:

  • To download a file

  • To get a list of available views

...

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 Code

API Code

Definition

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

...


EndPoint: available views list

since 11.12

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

Legacy endpoint:

Code Block
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 Code

API Code

Definition

403

403/601

Unreachable catalog (or forbidden)