Version 1.9.72 (Release Notes)


storehttps://api.pixlab.io/store

Description

Upload a local media file whether video or image to the pixlab.xyz storage cluster or to your own S3 Bucket if already connected from your dashboard. This command is always the first step for some processing tasks like mogrify, merge, drawlines, etc. that require a media file to be remotely available before processing it.

HTTP Methods

POST

Request Parameters

POST Request Body

Allowed Content-Type:
multipart/form-data

Required

FieldsTypeDescription
keyStringYour PixLab API Key. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to.
Optional Parameters:
FieldsTypeDescription
commentStringOptional comment to associate with the uploaded media.

Response

application/json.

This command always return a JSON object after each call with the link to the uploaded media file that you can pass verbatim to other processing commands or simply use in your HTML code to serve content for example. The following are the JSON fields returned in response body:

FieldsTypeDescription
statusIntegerStatus code 200 indicates success, any other code indicates failure.
linkURLLink to the media output which is usually stored on the pixlab.xyz storage cluster unless you set your own S3 keys (refer to your dashboard on how to do that).
idStringUnique media ID.
errorStringError message if status != 200.

Python Example

import requests
import json

# Upload a local image to the remote https://pixlab.xyz storage server or your own S3 bucket depending on the configuration from your dashboard.
# Use the output link for other purposes such as processing via mogrify, drawrectangles, etc. or simply serving content.

req = requests.post('https://api.pixlab.io/store',
	files = {'file': open('./local_image.png', 'rb')},
	data={
		'comment':'Super Secret Stuff',
		'key':'My_Pix_Key',
	}
)
reply = req.json()
if reply['status'] != 200:
	print (reply['error'])
else:
	print ("Upload Pic Link: "+ reply['link'])

See Also