Contents
Import Image Map Pro Map - Plugixa Image Map
POST /plugixa-image-map/v1/import/image-map-pro
Convert an Image Map Pro 6 map into Plugixa Image Map maps, one per artboard.
Any signed-in user with both plugixa_image_map_import and plugixa_image_map_create. See Roles and permissions.
Note. The import is not all or nothing. If one artboard fails, the maps made from the artboards before it are kept and the request answers with the error. Every map is created as a draft.
Request
POST https://your-site.example/wp-json/plugixa-image-map/v1/import/image-map-pro
Request body
Content type: application/json
Send one of the two fields:
| Field | Type | Required | Description |
|---|---|---|---|
source_id |
string |
One of the two | The id of a map stored on this site, from Image Map Pro Sources. Takes precedence when both are sent. |
project |
object |
One of the two | An Image Map Pro 6 export, as decoded JSON. Exports from Image Map Pro 5 are refused: open them in version 6 and export again. |
The whole request may be 3 MB at most. Each artboard’s picture is looked for in this site’s Media Library by URL, then by file name and size. See Import and export.
{
"source_id": "a1d3c5e7-9b2f-4d6a-8c0e-2f4a6c8e0b1d"
}
Responses
201 Created. data lists the new maps.
{
"success": true,
"data": {
"maps": [
{
"id": 22,
"title": "Store locator",
"image": "found"
}
],
"notes": []
}
}
| Field | Type | Meaning |
|---|---|---|
data.maps[].id |
integer |
A new map’s id |
data.maps[].title |
string |
The Image Map Pro name, followed by the artboard title when there are several artboards |
data.maps[].image |
string |
found or missing: whether the artboard’s picture was matched in the Media Library |
data.notes |
string[] |
Sentences about what could not be carried over, for example script actions |
Errors
| Status | Code | When |
|---|---|---|
413 |
plugixa_image_map_import_too_large |
The request is over 3 MB. |
404 |
plugixa_image_map_imp_not_found |
No stored map with that source_id. |
422 |
plugixa_image_map_imp_format |
project is not an Image Map Pro map. |
422 |
plugixa_image_map_imp_legacy |
The map was made with Image Map Pro 5. |
422 |
plugixa_image_map_imp_version |
The map was made with a version other than 6. |
422 |
plugixa_image_map_imp_empty |
The map has no artboards. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-image-map/v1/import/image-map-pro" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"source_id":"a1d3c5e7-9b2f-4d6a-8c0e-2f4a6c8e0b1d"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-image-map/v1/import/image-map-pro');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'source_id' => 'a1d3c5e7-9b2f-4d6a-8c0e-2f4a6c8e0b1d',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-image-map/v1/import/image-map-pro', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({
source_id: 'a1d3c5e7-9b2f-4d6a-8c0e-2f4a6c8e0b1d',
}),
});
const { data } = await response.json();
Quick Links
Share