Update()
Description
Create an artifact from JSON payload.
Package Details
Interface
IArtifactManager
Syntax
Task<ArtifactInfo> Update<T>(T artifact, ArtifactType artifactType, string documentVersion, int serviceRequestId, int userId);
Task<ArtifactInfo> Update<T>(int artifactId, T artifact, string documentVersion, int serviceRequestId, int userId);
Returns
Task<ArtifactInfo>
API Endpoint
PUT
/api/v1/artifacts/{id}
Parameters
Parameter | Description | Parameter Type |
---|---|---|
artifactId | An artifact id | Path |
artifact | Artifact information | Request Body |
documentVersion | Version number. | Query string |
serviceRequestId | A service request id. | Query string |
userId | Current user id. | Query string |
Returns
HTTP 200 OK if successful, 401 if unauthorized, 400 otherwise.
Example
public class SampleDocument
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime Date { get; set; }
}
var newDoc = new SampleDocument
{
Id = 100,
Name = "test",
Date = new DateTime(2020, 1, 2, 0, 0, 0)
};
const int artifactId = 100;
const int serviceRequestId = 111;
const ArtifactType artifactType = ArtifactType.JsonDocument;
const int userId = 2757;
var artifact = await MtoaApi.Artifacts.Update<SampleDocument>(artifactId, newDoc, null, serviceRequestId, userId);