Abyssale Developer Hub
  • Getting Started
  • Rest API
    • Overview - Rest API
    • Authentication
    • Designs
      • Design Details
    • Generation
      • Design information
      • Synchronous generation
        • Generate single image
      • Asynchronous generation
        • Generate Multi-Format images
        • Generate Multi-Format PDFs for Printing
        • Generate Multi-Page PDF for Printing
        • Generate Multi-Format Videos
        • Generate Multi-Format Animated GIFs
        • Generate HTML5 Banner Ads
          • ad network
      • Element properties
        • Root
        • Text
        • Button
        • Image
        • Logo
        • Shape
        • Rating
        • Illustration
        • QR Code
        • Video
        • Audio
      • Errors
    • Image Export
    • Fonts
    • Annexes
    • API Reference
  • Dynamic Images
    • Overview - Dynamic Images
    • Dynamic Image generation with URL
  • Webhooks
    • Overview - Webhooks
    • Events
      • Design
      • Banner
      • Global events
Powered by GitBook
On this page
  1. Rest API

Image Export

How to export images - Abyssale REST API

PreviousErrorsNextFonts

Last updated 5 months ago

You can generate an export (.zip format) containing several images.

This process is asynchronous and requires a webhook server to listen to export events.

(1) Ask an export

# Do not forget to replace {YOUR-API-KEY}
curl -X POST -H "x-api-key:{YOUR-API-KEY}" -H "Content-Type: application/json"  \
-d '{
  "callback_url": "https://webhook.mycompany.com/export",
  "ids": ["{banner_id1}", "{banner_id2}", "{banner_id3}"]
}' \
https://api.abyssale.com/async/banners/export
const axios = require('axios');

const payload = {
  "callback_url": "https://webhook.mycompany.com/export",
  "ids": ["{banner_id1}", "{banner_id2}", "{banner_id3}"]
}

// Replace {id} by your template ID
axios.post("https://api.abyssale.com/banner-builder/{id}/generate", payload, {
    headers: {"x-api-key": "{YOUR-API-KEY}", "Content-Type": "application/json", "timeout": 30000}
  }).then(response => {
    console.log(response.data)
})
import json
import requests

export_payload = {
  "callback_url": "https://webhook.mycompany.com/export",
  "ids": ["{banner_id1}", "{banner_id2}", "{banner_id3}"]
}

# Do not forget to replace {YOUR-API-KEY} and {template_id}
r = requests.post("https://api.abyssale.com/banner-builder/{template_id}/generate",
  headers={"x-api-key": "YOUR-API-KEY", "Content-Type": "application/json"},
  data=json.dumps(export_payload),
  timeout=30
)
r.json()

(2) Receive the export request ID

If the export request is accepted, the API call returns the export_id. It represents the ID of the asynchronous export and allows toto identify the asynchronous response.

The following errors can occur:

  • 400: A given parameter is invalid. Body response:

{
    "message": "body_validation_errors: {'media': {'ids': {0: ['Length must be 36.']}}}",
    "errors": {
        "media": {
            "ids": {
                "0": [
                    "Length must be 36."
                ]
            }
        }
    }
}
  • 404: One the given banner ID cannot be found.

(3) NewExport event

Once the export is generated on the Abyssale side, a NewExport event is sent (POST) to the callback_url

If the initial request returns an export ID, the NewExport event will always be sent.

The export process
  • (1) Ask an export
  • POSTCreate a banner export
  • (2) Receive the export request ID
  • (3) NewExport event

Create a banner export

post

As this method is asynchronous you need to provide a callback URL that will be called back when the export is done. We will do a POST request on this URL with a JSON payload.

Authorizations
Body
idsstring · uuid[]Required

An array of string that corresponds to the banners IDs you would like to export.

Example: 64238d01-d402-474b-8c2d-fbc957e9d290
callback_urlstring · uriOptional

The url that will be called once the generation of your export is done.

Example: https://your-webhook.com/export-abyssale
Responses
200
Ok
application/json
post
POST /async/banners/export HTTP/1.1
Host: api.abyssale.com
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 106

{
  "ids": [
    "64238d01-d402-474b-8c2d-fbc957e9d290"
  ],
  "callback_url": "https://your-webhook.com/export-abyssale"
}
200

Ok

{
  "export_id": "64238d01-d402-474b-8c2d-fbc957e9d290"
}