Ergonode docs
GraphQL API
Search…
⌃K

Multimedia create

This is how you can create multimedia via API.
To create multimedia via API you need to use MULTIPART, not a standard query.
The folder to which multimedia will be uploaded must already exist.
folderName parameter is optional, if not included multimedia will be uploaded to the main folder.
mutation {
multimediaCreate(
input: { name: "some_file_name.extension", folderName: "some_folder_name" }
) {
__typename
}
}
Example in Python3
from urllib import response
import requests
url = "https://marcin.ergonode.app/api/graphql/"
data = {
'upload': open('C:\\temp\\temp.png', 'rb'),
'query': (None, 'mutation{multimediaCreate(input:{name:"<choose_a_name>",folderName: "<some_folder_name>"}){__typename}}')
}
headers = {
'X-API-KEY': '<some_api_key>',
}
response = requests.post(url, files=data, headers=headers)
print (response.text)