Create Assets

To create Assets, a User needs to be authenticated with a Role that has “create” access with a specific asset type in a specific Project.

The parameters currently used to create assets are assetTypeId, projectId, and properties.

  • The assetTypeId relates to the asset type the new content will be created under. This could relate to a line, work item, image or any other asset type in the system.
  • The projectId is the id of the project you’re creating the content in. You must choose a Project to store your data.
  • The properties field represents a JSON string that will be used when creating the Asset. An asset type have specific properties (Name, URL, Legacy ID, …) and this properties JSON string is where these are defined

Input parameters

  • assetTypeId
    • String
    • id of asset type used to create asset
  • projectId
    • String
    • (external) id of project to create asset in
  • properties
    • String
    • String representation of JSON blob to create asset with
    • Example
      • {"Name": "New Name!"}
    • Note: in some cases you need to either nest single quotes in double ( '{"hello": "world"}' ), or escape inner quotes in string JSON representation ( "{\"hello\": \"world\"}" )

Possible Errors

  • Asset Type / Project not found
    • Asset Type id or Project id passed in call is invalid
  • Forbidden
    • Caller does not have the required permissions to create content with this tool in this project
  • Invalid properties
    • Properties do not match the JSON schema for properties of this tool’s asset type

Example Graphql call:

mutation MyMutation {
  createAsset(projectId: "123abc", properties: "{\"test\": \"test\"}", assetTypeId: "123abc") {
    id
  }
}