Artifact Management

Attaching Additional Artifacts to an Analytic Catalog Entry

Attach an artifact to the analytic catalog entry by issuing the following REST API request.

POST <catalog_uri>/api/v1/catalog/artifacts

The request is a multipart/form-data type with three required parts.

  • file is the artifact file.
  • catalogEntryID is analytic catalog entry id.
  • type is free form text. executable is reserved for executable analytic artifact. Template is reserved for the analytic template file.

Repeat this step to attach additional artifacts as needed. However, only one artifact of type executable and type template can be attached to an analytic catalog entry

Note: The maximum file size for upload is 250MB. The maximum expanded analytic file size (including directories and files) is 500MB.

Downloading Artifacts Attached to an Analytic Catalog Entry

You can download one or more analytic catalog entry artifacts as follows.

Procedure

  1. Get the list of artifacts attached to an analytic catalog entry by issuing the following REST API request.

    The request requires the analytic catalog entry ID.

    GET <catalog_uri>/api/v1/catalog/analytics/{id}/artifacts 

    The request returns a list of artifacts attached to an analytic catalog entry, similar to the following sample.

    {
        "artifacts": [
            {
                "filename": "anomalyDetector.zip",
                "createdTimestamp": "2015-09-15T23:53:37+00:00",
                "updatedTimestamp": "2015-09-15T23:53:37+00:00",
                "description": null,
                "id": "5a1713eb-2f1d-498d-a1ab-31cec71311ad",
                "type": "Executable"
            },
            {
                "filename": "README.pdf",
                "createdTimestamp": "2015-09-15T23:53:37+00:00",
                "updatedTimestamp": "2015-09-15T23:53:37+00:00",
                "description": "README file",
                "id": "0abdd515-793f-4e05-9773-17d8a054eddf",
                "type": "Documentation"
            }
        ]
    }

    The response returned has an ID for each artifact. The artifact is returned as application/octet-stream.

  2. Download an artifact by including its ID when issuing the following REST API request.
    GET <catalog_uri>/api/v1/catalog/artifacts/{id}/file
    Note: You cannot download the executable artifact for a subscription analytic.
  3. Repeat the previous step with a different artifact ID to download each artifact.

Updating an Analytic's Executable Artifact

You can update an analytic's executable artifact after it has been added to the catalog, then validate it after changes are made, by following these steps.

About This Task

Note:
  • You cannot use this procedure for an analytic that is in production state.
  • You cannot update an executable artifact for a subscription analytic.

Procedure

  1. Retrieve the list of artifacts attached to an analytic catalog entry by issuing the following REST API request.

    The request requires the analytic catalog entry id. Get the id of the artifact with type Executable from the response.

    GET <catalog_uri>/api/v1/catalog/analytics/{id}/artifacts 

    The following sample response includes the list of artifacts attached to an analytic catalog entry.

    {
        "artifacts": [
            {
                "filename": "anomalyDetector.zip",
                "createdTimestamp": "2015-09-15T23:53:37+00:00",
                "updatedTimestamp": "2015-09-15T23:53:37+00:00",
                "description": null,
                "id": "5a1713eb-2f1d-498d-a1ab-31cec71311ad",
                "type": "Executable"
            },
            {
                "filename": "README.pdf",
                "createdTimestamp": "2015-09-15T23:53:37+00:00",
                "updatedTimestamp": "2015-09-15T23:53:37+00:00",
                "description": "README file",
                "id": "0abdd515-793f-4e05-9773-17d8a054eddf",
                "type": "Documentation"
            }
        ]
    }
  2. Update the executable artifact of an analytic catalog entry by issuing the following REST API request.

    The request requires the executable artifact id retrieved in the previous Step 1.

    PUT <catalog_uri>/api/v1/catalog/artifacts/{id}

    The request is a multipart/form-data type with three required parts.

    NameValue
    fileExecutable analytic file. Specify the updated executable artifact.
    catalogEntryIDAnalytic catalog entry ID
    typeFile type. executable is reserved for executable analytic
    Note: The maximum file size for upload is 250MB. The maximum expanded analytic file size (including directories and files) is 500MB.
  3. Deploy and validate the analytic with test input data.

    The test input data is used to invoke the analytic execution after the analytic is deployed successfully. For example, the demo-adder sample analytic can accept the following sample input data:

    {“number1”: 123, “number2”: 456}

    Choose from the following methods to pass the input data.

    • The input data can be sent directly in the body of the validation request. In this case, issue the following REST API request.
      POST <catalog_uri>/api/v1/catalog/analytics/{id}/validation
    • The input data can be uploaded as an artifact attached to the analytic (see Attaching Additional Artifacts to an Analytic Catalog Entry). This can be useful if you have a large dataset, or if you plan on reusing the dataset. In this case, issue the following REST API request with the artifact ID as a query parameter:
      POST <catalog_uri>/api/v1/catalog/analytics/{analyticId}/validation?inputId={artifactId}

    In either case, the request to deploy and validate an analytic is an asynchronous request. The response contains a validationRequestId that can later be used to retrieve the status and results of the validation. The following is a sample response from a validation request.

    {
        "analyticId": "09718078-95e7-4b58-b74a-152838f03b41",
        "validationRequestId": "dfcaa0d4-40f1-471d-9f66-e72a23a30266",
        "inputData": "{\"number1\": 123, \"number2\": 456}",
        "status": "QUEUED",
        "createdTimestamp": "2015-09-18T16:53:04+00:00",
        "updatedTimestamp": "2015-09-18T16:53:04+00:00",
        "message": "Analytic validation request successfully queued - reference id is dfcaa0d4-40f1-471d-9f66-e72a23a30266",
        "result": null
    }
  4. Deploy and validate the analytic by issuing the following REST API request.
    POST <catalog_uri>/api/v1/catalog/analytics/{id}/validation

    Note the following:

    • The request to deploy and validate an analytic is an asynchronous request. The response contains the validationRequestId.
    • Provide the test data in the request body. The test data provided is used to invoke the analytic execution after the analytic is deployed successfully.

    Sample response from deploying and validating an analytic.

    {
        "analyticId": "09718078-95e7-4b58-b74a-152838f03b41",
        "validationRequestId": "dfcaa0d4-40f1-471d-9f66-e72a23a30266",
        "inputData": "{\"number1\": 123, \"number2\": 456}",
        "status": "QUEUED",
        "createdTimestamp": "2015-09-18T16:53:04+00:00",
        "updatedTimestamp": "2015-09-18T16:53:04+00:00",
        "message": "Analytic validation request successfully queued - reference id is dfcaa0d4-40f1-471d-9f66-e72a23a30266",
        "result": null
    }
  5. Retrieve the analytic validation status by issuing the following REST API request.

    Use the validationRequestId from the previous step to check the status of the deployment and validation. The status can be QUEUED, PROCESSING, or COMPLETED. If the status is COMPLETED, the result of the analytic execution is also returned.

    GET  <catalog_uri>/api/v1/catalog/analytics/{id}/validation/{validationRequestId}

    Sample response from validation status check.

    {
        "analyticId": "09718078-95e7-4b58-b74a-152838f03b41",
        "validationRequestId": "dfcaa0d4-40f1-471d-9f66-e72a23a30266",
        "inputData": "{\"number1\": 123, \"number2\": 456}",
        "status": "COMPLETED",
        "createdTimestamp": "2015-09-18T16:53:04+00:00",
        "updatedTimestamp": "2015-09-18T16:55:41+00:00",
        "message": "Analytic validation completed successfully.",
        "result": "{\"result\":579}"
    }