Multimedia create

This is how you can create multimedia via API.

circle-info

To create multimedia via API you need to send the data by a multipart request with upload and query headers.

circle-info

The folder to which multimedia will be uploaded must already exist.

circle-info

folderPath parameter is optional, if not included multimedia will be uploaded to the main folder.

circle-info

Max allowed file size is 100 MB

mutation {
  multimediaCreate(
    input: { name: "file_name.extension", folderPath: "folder_path" }
  ) {
    __typename
  }
}

Example in PHP8

$client = new \GuzzleHttp\Client(); // Guzzle version 6

$resp = $client->post(
    $url,
    [
        'multipart' => [
            [
                'name' => 'upload',
                'contents' => fopen(__DIR__ . '/test.png', 'r'),
            ],
            [
                'name' => 'query',
                'contents' => '
                    mutation {
                        multimediaCreate(input: {name: "new.png", folderPath: null}) {__typename}
                    }
                ',
            ],
        ],
        'headers' => [
            'X-API-KEY' => $apiKey,
        ],
    ],
);

Example in Python3

Last updated

Was this helpful?