Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
breakoutModewide
languagepy
import requests
import json

def create_output_pipeline(dataset_guid, pipelineId=1, pipelineParameters=[]):
    url = "https://data.usmart.io/org/[Your Organisation GUID]/resourceContainer:create"

    payload = json.dumps({
        "datasetGUID": dataset_guid,
        "pipelineId": pipelineId,
        "pipelineParameters": pipelineParameters
    })
    headers = {
        'api-key-secret': '[your api-key-secret]',
        'api-key-id': '[your api-key-id]',
        'Content-Type': 'application/json',
    }

    response = requests.request("POST", url, headers=headers, data=payload)

    return response.json()
    
# Example function call
dataset_guid = "[Your Dataset GUID]"

# pipelineId is used to determine the type of output required
# pipelineId = 1: "Plain API"
# pipelineId = 2: "Spatial API"
# pipelineId = 3: "Raw File Download"
# pipelineId = 4: "CSV, JSON and XML Download"
# pipelineId = 5: "Spatial API from outputSpatial = create_output_pipeline(dataset_guid, pipelineId)
print(File"
# pipelineId = 6: "Real-time Data API"

output = create_output_pipeline(dataset_guid, pipelineId)
print(output)

The status of this action can be determined with the dataset:view, typically this will complete in less than a minute but for large datasets or those with a spatial API this could be over 30minutes. Polling dataset:view to check on status would be advisable.

file:updateRevision

Use this action to replace an existing dataset file with a new file, you need the file GUID which While we’ve provided the full list of pipelineId’s we’re not supporting the real-time Data API currently as other actions may be required to enable. We can look to support this in the future.

file:updateRevision

Use this action to replace an existing dataset file with a new file, you need the file GUID which you can get with the dataset:view action and the new file to call this action. This uses the s3:generatePutRequest action that was also required for file:create

...

The resourceContainerGUID can be found in the response to the dataset:view action and an example is highlighted below:

...

Closing thoughts and future

This is our most commonly used actions from the UI and should enable most use cases. We will look to document and support other actions in the future depending on demand. We have not provided support for enabling data access to Redshift and SQL at this point and more actions are currently required to setup the Schema and update Redshift from S3.