Contents
On this page
Save Autosave - Plugixa Image Map
PUT /plugixa-image-map/v1/maps/{id}/autosave
Keep a draft of a map without saving it. The map itself does not change. POST does the same as PUT.
Any signed-in user with the plugixa_image_map_edit capability. Administrators have every Plugixa Image Map capability; see Roles and permissions.
Note. The autosave slot belongs to the user making the request: each user has at most one draft per map, and nobody can read another user’s. Saving the map clears the saver’s draft. A new draft replaces your previous one.
Request
PUT https://your-site.example/wp-json/plugixa-image-map/v1/maps/12/autosave
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The map’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
doc |
object |
Yes | The draft document, cleaned and bounded as in Create Map. |
rev |
integer |
No | The map version the draft is based on. Stored as sent, not checked; 0 when omitted. |
{
"rev": 4,
"doc": {
"image": {
"attachment_id": 58
},
"objects": [
{
"id": "o_3f9a1c2e",
"type": "spot",
"name": "Reception",
"geometry": {
"x": 44.0,
"y": 60.5
}
}
]
}
}
Responses
200 OK. The draft is kept.
{
"success": true,
"data": {
"saved_at": "2026-11-12 10:20:00",
"rev": 4
}
}
| Field | Type | Meaning |
|---|---|---|
data.saved_at |
string |
UTC datetime of the autosave |
data.rev |
integer |
The rev you sent |
Cleaning warnings are not returned here.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_image_map_not_found |
No map with that id, or the map is in the trash. |
422 |
plugixa_image_map_invalid_document |
doc is not a JSON object. |
413 |
plugixa_image_map_too_large |
doc is over 2 MB as JSON. |
422 |
plugixa_image_map_too_deep |
doc nests more than 12 levels. |
422 |
plugixa_image_map_newer_document |
doc.schema is newer than this version of the plugin reads. |
422 |
plugixa_image_map_too_many_objects |
More than 2,000 hotspots. |
422 |
plugixa_image_map_too_many_points |
A polygon with more than 1,000 points. |
422 |
plugixa_image_map_too_many_groups |
More than 500 groups. |
500 |
plugixa_image_map_save_failed |
The draft could not be written. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-image-map/v1/maps/12/autosave" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"rev":4,"doc":{"image":{"attachment_id":58},"objects":[{"id":"o_3f9a1c2e","type":"spot","name":"Reception","geometry":{"x":44.0,"y":60.5}}]}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-image-map/v1/maps/12/autosave');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'rev' => 4,
'doc' => [
'image' => [
'attachment_id' => 58,
],
'objects' => [
[
'id' => 'o_3f9a1c2e',
'type' => 'spot',
'name' => 'Reception',
'geometry' => [
'x' => 44.0,
'y' => 60.5,
],
],
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-image-map/v1/maps/12/autosave', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({
rev: 4,
doc: {
image: {
attachment_id: 58,
},
objects: [
{
id: 'o_3f9a1c2e',
type: 'spot',
name: 'Reception',
geometry: {
x: 44.0,
y: 60.5,
},
},
],
},
}),
});
const { data } = await response.json();
Quick Links
Share