Upload Map Attachments - Fluid Topics - 3.6 - Technical Notes

Integrate Fluid Topics APIs

Product
Fluid Topics
FT_Version
3.6
Category
Technical Notes
language
English
audience
public

The Add/Update map attachments web service adds or updates attachments to publications based on the metadata defined in the call as follows:

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

The following lines show an example of an Add/Update map attachments web service implementation in Python where the file my_image.png is attached to the map with the originID of my_map:

import json
import requests

# order for my_image.png
my_image_order = {
'id': 'my_image',
'filename': 'my_image.png',
'displayName': 'My Image'
}

# Content of my_image.png file
with open('my_image.png', 'rb') as f:
my_image_content = f.read()

# order.json part
order = {
"attachments": [my_image_order]
}

# All the parts : order.json and my_image.png
parts = {
'order.json': (
'order.json',
json.dumps(order),
'application/json'
),
my_image_order['filename']: (
my_image_order['filename'],
my_image_content,
'image/png'
)
}

# Send
response = requests.put('https://demo/api/admin/khub/maps/attachments?ft:originId=my_map', files=parts)

print(response.status_code)
print(response.text)