Skip to main content

Artifacts

What is an Arttribute Artifact?

An Artifact is a fundamental concept within Arttribute. It represents a piece of artwork, whether it's a painting, digital illustration, or any other form of artistic creation that can be made digitally accessible. Arttribute Items serve as the core units for artists and creators. To ensure authenticity and fairness, artifacts are tagged with Arttribute Licenses.

Key features of an Artifact include:

FeatureDescription
idUnique identifier of an artifact.
creatorIdID of the user who created this artifact.
nameName of the artifact.
licenseLicense associated with the artifact.
imageUrlPublic URL of the artifact's image.
whitelistList of addresses that can access the artifact.
blacklistList of addresses that cannot access the artifact.
createdAtWhen the artifact was created (ISO 8601 timestamp).
updatedAtWhen the artifact was last updated (ISO 8601 timestamp).

Creating an Artifact

Step 1: Prepare the Artifact Data

info

The user must provide authorization tokens to create an artifact. This process ensures that the user is authenticated and authorized to create artifacts.

Before creating an artifact, gather all necessary information. The full data object is described below:

FeatureDescription
nameName of the artifact.
assetAn object containing the data property which represents a base64 representation of the image.
license"Open" / "Exclusive" / "Non-Commercial" / "Exclusive Non-Commercial"

Step 2: Make API request

With the artifact data ready, you can begin the artifact creation process. Below are code snippets illustrating how to structure your API request.

tip

Prompt the user to sign a message with an onchain identity like a web3 wallet. This process authenticates the user and generates an access token that your application can use for subsequent requests.

danger

The image data must be base64 encoded. Also, the image data cannot be changed once the artifact is created. The artifact creation process is irreversible and the image data cannot be updated.

Making a Node JS request with axios
const axios = require("axios");
let data = {
name: "Digital Painting",
description: "A beautiful digital painting.",
asset: {
data: "data:image/png;base64,...", // Data URL of the image
mimetype: "image/png",
},
};

axios
.request({
method: "post",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v2/artifacts",
headers: {
"Content-Type": "application/json",
"x-authentication-address": address, // web3 wallet address
"x-authentication-message": message,
"x-authentication-signature": signature, // signature of the message
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Exploring Additional Functionality

Arttribute provides a range of features beyond creating artifacts. In this section, we'll walk you through how to:

  • Fetch information about an Artifact
  • Update an Artifact
  • Delete an Artifact

Fetching Artifacts

All Artifacts

To retrieve all artifacts, make a GET request to the /artifacts endpoint. Below is an example of how to fetch all artifacts using the Arttribute API.

Making a Node JS request with axios
const axios = require("axios");

axios
.get("https://api.arttribute.io/v2/artifacts")
.then((response) => {
console.log(JSON.stringify(response.data)); // returns an array of artifacts
})
.catch((error) => {
console.log(error);
});

Artifact by ID

To retrieve a specific artifact, make a GET request to the /artifacts/{id} endpoint. Below is an example of how to fetch a specific artifact using the Arttribute API.

Making a Node JS request with axios
const axios = require("axios");

axios
.get(`https://api.arttribute.io/v2/artifacts/${id}`)
.then((response) => {
console.log(JSON.stringify(response.data)); // returns the artifact with the specified ID
})
.catch((error) => {
console.log(error);
});

Artifacts by Creator

To retrieve all artifacts created by a specific user, make a GET request to the /users/{creatorId}/artifacts endpoint. Below is an example of how to fetch all artifacts created by a specific user using the Arttribute API.

Making a Node JS request with axios
const axios = require("axios");

axios
.get(`https://api.arttribute.io/v2/users/${creatorId}/artifacts`)
.then((response) => {
console.log(JSON.stringify(response.data)); // returns an array of artifacts created by the specified user
})
.catch((error) => {
console.log(error);
});

Updating Artifacts

Step 1: Prepare the Artifact Data

Before updating an artifact, gather all necessary information. The fields available for updating an artifact are:

FeatureDescription
nameName of the artifact.
license"Open" / "Exclusive" / "Non-Commercial" / "Exclusive Non-Commercial"
whitelistList of string addresses that can access the artifact.
blacklistList of string addresses that cannot access the artifact.

Step 2: Make API request

With the artifact data ready, you can begin the artifact update process. Below are code snippets illustrating how to structure your API request.

Making a Node JS request with axios
const axios = require("axios");
let data = {
name: "Digital Painting",
license: "Open",
whitelist: ["0x1234", "0x5678"],
blacklist: ["0x9876"],
};

axios
.request({
method: "patch",
maxBodyLength: Infinity,
url: `https://api.arttribute.io/v2/artifacts/${id}`,
headers: {
"Content-Type": "application/json",
"x-authentication-address": address, // web3 wallet address
"x-authentication-message": message,
"x-authentication-signature": signature, // signature of the message
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Deleting an Artifact

To delete an artifact, make a DELETE request to the /artifacts/{id} endpoint. Below is an example of how to delete an artifact using the Arttribute API.

Making a Node JS request with axios
const axios = require("axios");

axios
.request({
method: "delete",
url: `https://api.arttribute.io/v2/artifacts/${id}`,
headers: {
"x-authentication-address": address, // web3 wallet address
"x-authentication-message": message,
"x-authentication-signature": signature, // signature of the message
},
})
.then((response) => {
console.log(JSON.stringify(response));
})
.catch((error) => {
console.log(error);
});