copyhttps://api.pixlab.io/copy
Description
Copy a media from a remote location and store it on the pixlab.xyz storage server. If you have already set your own AWS S3 keys (refer to your dashboard on how to do that), then the media shall be copied to your S3 bucket.
HTTP Methods
GET
Request Parameters
Required
Fields | Type | Description |
---|---|---|
link | URL | Input media URL or Unique ID. |
key | String | Your PixLab API Key. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to. |
Response
application/json.
This command always return a JSON object after each call. The following are the JSON fields returned in response body:
Fields | Type | Description |
---|---|---|
status | Integer | Status code 200 indicates success, any other code indicates failure. |
link | URL | Link to the media output which is usually stored on the pixlab.xyz storage server unless you set your own S3 keys (refer to your dashboard on how to do that). |
id | String | Unique media ID. |
error | String | Error message if status != 200. |
Python Example
import requests
import json
#Copy the following image to our bucket
req = requests.get('https://api.pixlab.io/copy',params={'img':'http://cf.broadsheet.ie/wp-content/uploads/2015/03/jeremy-clarkson_3090507b.jpg','key':'My_Pix_Key'})
reply = req.json()
if reply['status'] != 200:
print (reply['error'])
else:
print ("Copied image: "+ reply['link'])