Create an artifact document
Description
The Create() method is used to create artifact documents. The current types of documents that can be created are:
JsonMetadata
JsonDocument
SignedJsonDocument
Package Details
Interface
IArtifactManager
Syntax
ArtifactManager.Create<T>(T artifact, ArtifactType artifactType, string documentVersion, int serviceRequestId, int userId)
Returns
MTOA.DomainObjects.ArtifactInfo
API
[POST] /api/v1/artifacts
Parameters
Parameter | Description | Parameter Type |
---|---|---|
serviceRequestId | Service request id | Query string |
artifactType | An artifact type.
| Query string |
version | Version number | Query string |
userId | Current user id | Query string |
artifact | Artifact information (JSON payload) | Request body |
Returns
HTTP 200 OK if successful, 401 if unauthorized, 400 otherwise.
Example
using MTOA.BLL.Interfaces; string myDocumentVersion = "MySrv_1.0.0"; int serviceRequestId = 12345; var signature = new DTO.ESignature { UserId = CurrentUser.Id.ToString(), FirstName = CurrentUser.FirstName, LastName = CurrentUser.LastName, SignatureDateTime = DateTime.Now, IpAddress = WebRequestExtension.GetUserIPAddress(), HostName = WebRequestExtension.GetHostName(), BrowserDetails = WebRequestExtension.GetBrowserDetails() }; await _artifactManager.Create( signature, ArtifactType.SignedJsonDocument, myDocumentVersion, serviceRequestId, CurrentUser.Id);