CreateFromJson()

Create From JSON

Description

Create an artifact from JSON payload.

Package Details

Interface

IArtifactManager

Syntax

Task<ArtifactInfo> CreateFromJson(string artifact, ArtifactType artifactType, string documentVersion, int serviceRequestId, int userId);

Returns

Task<ArtifactInfo>

API Endpoint

POST

/api/v1/artifacts

Parameters

Parameter

Description

Parameter Type

Parameter

Description

Parameter Type

serviceRequestId

Service request id

Query string

artifactType

An artifact type.

  • Image = 1,

  • Pdf = 2,

  • JsonMetadata = 3,

  • JsonDocument = 4,

  • SignedJsonDocument = 5,

  • None

Query string

version

Version number

Query string

userId

Current user id

Query string

artifact

 

Artifact information (JSON payload)

Request body

Returns

On success, 200 Ok

On error, 400 Bad Request

On authorization error, 403 Forbidden

Example

const int serviceRequestId = 100; const ArtifactType artifactType = ArtifactType.JsonDocument; const string version = "1.0"; const int userId = 100; const string artifact = "{\"Rk\": \"L - 1\",\"Gcar\": \"G - 467\",\"Gtm\": \"M - 1\",\"Date\": \"Apr 6\",\"Tm\": \"CLE\",\"Where\": \"@\",\"Opp\": \"HOU\",\"Rslt\": \"L0 - 2\"}"; var artifact = await ArtifactManager.CreateFromJson(artifact, artifactType, version, serviceRequestId, userId);