REST API - Defining an Artifact in the Request Body
4 min
You must define the artifact in the request body when you are adding an artifact.
You can only define one artifact in a single request
Parameters
The following parameters must be specified within the Artifact element:
- ArtifactTypeId: Numerically identifies the type of artifact. The identifier can be obtained via the REST API - Get Artifact Type Request and REST API - List Artifact Types Request requests.
- Name: Identifies the name of the artifact.
- Any required properties of the applicable artifact type.
Properties Element
If you want to specify property values for your artifact, include a Properties element within the Artifact element.
If you are defining a property type for your artifact, you must specify values for required elements of the property type.
Among others, the Properties element can contain the following elements:
- Property: (Required.) The element of the property specifications.
- PropertyTypeId: The corresponding elements, which can be populated in the REST API - Get Artifact Request call.
Examples
AddArtifact Example
Here is an example of a request body in XML format:
<?xml version="1.0" ?> <Artifact xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.blueprintsys.com/blueprint/api/v1"> <ArtifactTypeId>25</ArtifactTypeId> <Name>New Textual Requirement</Name> <ParentId>10</ParentId> <Properties> <Property> <PropertyTypeId>235658</PropertyTypeId> <TextOrChoiceValue>Sample Description</TextOrChoiceValue> </Property> <Property> <NumberValue>15</NumberValue> <PropertyTypeId>235659</PropertyTypeId> </Property> </Properties></Artifact>Here is an example of a request body in JSON format:
{ "Name": "New Textual Requirement", "ParentId": 10, "ArtifactTypeId": 25, "Properties": [ { "PropertyTypeId": 235658, "TextOrChoiceValue": "Sample Description" }, { "PropertyTypeId": 235659, "NumberValue": 15.0 } ]}