Update an artifact

Details

URI /artifact/<artifact_id>
Method PUT
Parameters

userIdentifier=<user_id>
    Required; the user ID you want to use as credentials for this API call. See Get userIdentifier for the steps required to get the userIdentifier value.

view=<view_type>&scope=view
    Optional; Used to update artifacts based on pre-defined views. See Artifact views (description column) for a list of view types that support update operation.

<_artifact_property>_action_=merge
   Optional; use the merge option with the action meta tag query parameter to update only a portion of the artifact. The action meta tag can either be specified globally for the artifact by including parameter _action_=merge, or for a specific property e.g., _property_values_action_=merge.

Returns 200 - Ok
401 - Not authorized
404 - Not found
500 - Server exception

Note To completely update the artifact, i.e., replace the persistent artifact, do not use the view or merge parameters and include all artifact content in the request body. Note that if only a portion of the artifiact content is sent in the request body, any unspecified content will be removed from the artifact.

To update a portion of the artifact:

  • Use a pre-defined view that contains a subset of the artifact properties; only that subset of properties will be updated per the values specified in the request body. SeeArtifact views for a list of view types.
  • Use the merge option as described under Parameters.
    You can use the merge option with the view parameter to update only the view properties for which you specify values in the request body.

Note Collection specific behavior

When a merge option is specified on a collection, for example _property_values_action_=merge, all collection items specified in the PUT request body are updated. Any other collection items are left untouched.
For the property attribute of an artifact, the items of this collection attribute are matched by name.  For all other attributes, the collection items are matched by ID.

Examples

The following examples demonstrate how to update an artifact.

This example shows how to change the finalize flag of a component using the view parameter.
The following URL was sent:

https://<host>:<port>/csa/rest/artifact/90e72e4f3af5c989013afb471ebc0264?userIdentifier=&scope=view&view=componentfinalize

The following XML was sent in the request body:

<ServiceComponent>
  <id>90e72e4f3af5c989013afb471ebc0264</id>
  <toFinalize>false</toFinalize>
</ServiceComponent>

This example shows changing the display name of a resource provider. This example does not use the view parameters. To use this approach, retrieve the artifact using GET artifact API, modify the necessary value (in this example - displayName), and use that as the body of the PUT request to update the artifact.
The following URL was sent:

https://<host>:<port>/csa/rest/artifact/90e72e4f3b00a69e013b0c049ab00033?userIdentifier=<user_id>

The following XML was sent in the request body:

<ResourceProvider>
  <id>90e72e4f3b00a69e013b0c049ab00033</id>
  <objectId>90e72e4f3b00a69e013b0c049ab00033</objectId>
  <createdOn>2012-11-16T17:38:46.576-08:00</createdOn>
  <updatedOn>2012-11-16T17:38:46.576-08:00</updatedOn>
  <createdBy>
    <id>90d96588360da0c701360da0f1d5f483</id>
    ...
  </createdBy>
  <updatedBy>
    <id>90d96588360da0c701360da0f1d5f483</id>
    ...
  </updatedBy>
  <isCriticalSystemObject>false</isCriticalSystemObject>
  <description>TestProvider</description>
  <name>TestProvider_November 17, 2012 1:38:46 AM UTC</name>
  <displayName>TestProviderModified</displayName>
  <state>
    <id>90d96588360da0c701360da0ef470038</id>
    ...
  </state>
  <artifactType>
    <id>90d96588360da0c701360da0eed8001f</id>
    ...
  </artifactType>
  <disabled>false</disabled>
  <accessPoint>
    <id>90e72e4f3b00a69e013b0c049a740032</id>
    ...
  </accessPoint>
  <providerType>
    <id>90d96588360da0c701360da0eeac0016</id>
    ...
  </providerType>
  <numberOfResourceOffering>0</numberOfResourceOffering>
  <numberOfEnvironment>0</numberOfEnvironment>
  <numberOfPools>0</numberOfPools>
</ResourceProvider>