Create or update an artifact
const url = 'http://localhost:11044/api/v1/artifacts/example/example';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"content":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/artifacts/example/example \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "content": "example" }'The JSON body carries the content under a content key. Type is one of the ArtifactType names (case-insensitive).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The artifact’s type, one of the ArtifactType names, case-insensitive. An unrecognised type is refused with 400
The artifact’s name, including its extension, unique within its type
Request Bodyrequired
Section titled “Request Bodyrequired”The content to store, verbatim. A write REPLACES an existing artifact of that name rather than merging, and the content is validated first: a failure answers 400 with the rules it broke, and nothing is written. The stored size is the content’s length in CHARACTERS, which is not necessarily its size in bytes.
An artifact’s new content
object
The content to store, verbatim
Example generated
{ "content": "example"}Responses
Section titled “Responses”Artifact written
Confirmation that an artifact was created or replaced
object
The artifact’s name
The stored content’s length in characters, which is not necessarily its size in bytes
Always written
The ArtifactType name, upper case
An unknown type or missing content answers with the reason alone; a validation failure also carries violations
A refusal carrying only its reason
object
Why the request was refused, written to be shown
A write refused because the content did not validate
object
Always Validation failed; the detail is in violations
Every rule the content broke

