Attributions
What is an Attribution?
Attributions in Arttribute ensure that artists get proper credit when their work is used in AI. It is a core component that tracks and verifies the use of artworks according to the terms defined by the artist.
Key features of an Attribution include:
Feature | Description |
---|---|
id | Unique Identifier of an attribution. |
attributorId | ID of the user who made this attribution. |
artifactId | ID of the artifact being attributed. |
collectionId | ID of the collection being attributed. |
isValid | Whether the attribution is valid. |
createdAt | When the attribution was created (ISO 8601 timestamp). |
updatedAt | When the attribution was last updated. |
expiresAt | When the attribution expires (ISO 8601 timestamp). |
Either artifactId
or collectionId
will be present in an attribution, but not both.
Making an Attribution
Step 1: Prepare the Attribution Data
Before making an attribution, gather all necessary information, including the artifact ID or the collection ID (depending on what resource is being attributed), the terms accepted, and the attributor's details.
Step 2: Make API request
With your attribution data ready, you can begin the attribution creation process. Below are code snippets illustrating how to structure your API request.
- NodeJS
- cURL
const axios = require("axios");
let data = {
artifactId: "id-string",
};
axios
.request({
method: "post",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v2/attributions",
headers: {
"Content-Type": "application/json",
"x-authentication-address": address,
"x-authentication-message": message,
"x-authentication-signature": signature,
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
const axios = require("axios");
let data = {
collectionId: "id-string",
};
axios
.request({
method: "post",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v2/attributions",
headers: {
"Content-Type": "application/json",
"x-authentication-address": address,
"x-authentication-message": message,
"x-authentication-signature": signature,
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
curl --location --request POST 'https://api.arttribute.io/v2/attributions' \
--header 'Content-Type: application/json' \
--header 'x-authentication-address: address' \
--header 'x-authentication-message: message' \
--header 'x-authentication-signature: signature' \
--data '{
"artifactId": "id-string"
}'
curl --location --request POST 'https://api.arttribute.io/v2/attributions' \
--header 'Content-Type: application/json' \
--header 'x-authentication-address: address' \
--header 'x-authentication-message: message' \
--header 'x-authentication-signature: signature' \
--data '{
"collectionId": "id-string"
}'
Retrieving Attributions
Retrieving Attributions by ID
To retrieve an attribution by its ID, make a GET request to the /attributions/:id
endpoint. Below is a code snippet illustrating how to structure your API request.
- NodeJS
- cURL
const axios = require("axios");
axios
.get(`https://api.arttribute.io/v2/attributions/${id}`)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
curl 'https://api.arttribute.io/v2/attributions/id'
Retrieving Attributions by User ID
To retrieve attributions by a user ID, make a GET request to the /users/:id/attributions
endpoint. Below is a code snippet illustrating how to structure your API request.
- NodeJS
- cURL
const axios = require("axios");
axios
.get(`https://api.arttribute.io/v2/users/${id}/attributions`)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
curl 'https://api.arttribute.io/v2/users/id/attributions'
You can filter this down further to retrieve attributions for specifically artifacts or collections by adding the artifactId
or collectionId
.
- NodeJS
- cURL
const axios = require("axios");
axios
.get(
`https://api.arttribute.io/v2/users/${userId}/attributions/artifact/${artifactId}`
)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
const axios = require("axios");
axios
.get(
`https://api.arttribute.io/v2/users/${userId}/attributions/collection/${collectionId}`
)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
curl 'https://api.arttribute.io/v2/users/userId/attributions/artifact/artifactId'
curl 'https://api.arttribute.io/v2/users/userId/attributions/collection/collectionId'
Updating an Attribution
Under construction🚧
Deleting an Attribution
To delete an attribution, make a DELETE request to the /attributions/:id
endpoint. Below is a code snippet illustrating how to structure your API request.
- NodeJS
- cURL
const axios = require("axios");
axios
.request({
method: "delete",
url: `https://api.arttribute.io/v2/attributions/${id}`,
headers: {
"x-authentication-address": address,
"x-authentication-message": message,
"x-authentication-signature": signature,
},
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
curl --location --request DELETE 'https://api.arttribute.io/v2/attributions/id' \
--header 'x-authentication-address: address' \
--header 'x-authentication-message: message' \
--header 'x-authentication-signature: signature'