Skip to main content

Signature codes

What is a signature code?

Every object in Alloy has a signature code that changes whenever the object is edited. This includes items and their designs/interfaces, along with other object types such as layers, basemaps, workflows, etc.

To edit an object via the API, you must supply its current signature. This preserves data integrity by ensuring you can only edit the object in its current state. If the object gets edited by another user or a system process before you submit your API request, it will fail because the item's signature has changed.

Signature codes are alphanumeric and contain 24 characters, e.g. 6329db561890d601580c2218.

Note

Signature codes are handled automatically in Alloy applications. If an object changes when viewing its details in Alloy Web, an orange notification appears in the top-right corner, prompting you to reload.

A notification prompting the user to refresh the loaded item

Get an object's signature

When you create or edit an object via the API, the object's new signature is included in the response body. This can be stored for use in a subsequent API request.

Otherwise, to get the current signature of an object, send a GET request to the corresponding API endpoint. The URL must end with the unique itemID or code of the object.

Example JavaScript

This example demonstrates how to get an item's signature via the Item endpoint (Swagger/ReDoc). The signature is extracted from the response and stored for subsequent processing, such as editing the item.

// load a http request library
const axios = require('axios');

// enter your api key here!
const apiKey = '7d781836-f04d-4f44-b68f-38319233d645';

// enter the ID of the item here
const itemId = '5ebe83783494cf004a4196d2';

// request item details
axios({
method: 'GET',
url: `https://api.uk.alloyapp.io/api/item/${itemId}`,
headers: { Authorization: `Bearer ${apiKey}` },
})
.then((response) => {
const signature = response.data.item.signature;

// insert the rest of your code here!
})
.catch((error) => {
// output any error data to the console
console.log(error.response.data);
});