Add/Update Map Attachments - Fluid Topics - 3.6

Use Fluid Topics Web API

Product
Fluid Topics
FT_Version
3.6
Category
Technical Notes
language
English

This web service adds (if new) or updates (if existing) attachments to publications based on metadata selection.

Method

Endpoint

PUT

/api/admin/khub/maps/attachments?metadata1=value1&...&metadataN=valueN

Where metadata=value is any metadata key-value couple defining the publications to add or update.

To add or update a map attachment, the web service call requires a multipart body where the different parts consist in:

  • Sending an order to the Fluid Topics server to attach a file to the matched publications, by assigning a name.
  • Uploading the attachment itself.

Input Example

Content-Type: multipart/form-data; boundary=1234a5b67c89def

--1234a5b67c89def

Content-Disposition: form-data; name="order.json"; filename="order.json"
Content-Type: application/json

{
"attachments": [
{
"id": "my_attachment",
"filename": "oleandor.jpeg",
"displayName": "Oleandor Company Logo"
}
]
}

--1234a5b67c89def

Content-Disposition: form-data; name="oleandor.jpg"; filename="oleandor.jpg"
Content-Type: image/jpeg

... content bytes content bytes content bytes ...

--1234a5b67c89def--

Where:

  • id is the optional value used to identify the attachment (uses the filename by default)
  • filename is the file name of the map attachment
  • displayName is the optional display name of the map attachment (uses filename by default)
  • content bytes is the attachment content. The content can be specified with the file bytes themselves, or with the path to file to attach (depending of the REST Client used).

The web service is sending asynchronous requests. It may take a while for the attachment to be uploaded and the publication to be updated.

The following lines show an example of a map attachment update, from an IDE using a local path to the file:

Content-Type: multipart/form-data; boundary=1234a5b67c89def

--1234a5b67c89def

Content-Disposition: form-data; name="order.json"; filename="order.json"
Content-Type: application/json

{
"attachments": [
{
"id": "my_attachment",
"filename": "oleandor.jpeg",
"displayName": "New Oleandor Company Logo"
}
]
}

--1234a5b67c89def

Content-Disposition: form-data; name="oleandor.jpg"; filename="oleandor.jpg"
Content-Type: image/jpeg

< /path/to/the/file/to/attach/oleandor_new.jpg

--1234a5b67c89def--

Updating existing attachments requires calling the same web service with the same id (or filename if the id has not been specified), and by modifying the other properties (displayName, content-type, attachment content, or even the filename if an id has been specified).

Return codes

Return Code

Description

202 ACCEPTED

The update instruction was sent to the Fluid Topics processing pipeline.

400 BAD REQUEST

Invalid query.

500 INTERNAL SERVER ERROR

The Fluid Topics Server failed to respond.