API Task - Publish Results
Warning
API access is migrating to Enterprise only. Beginning in Release 9.5, all new or renewed subscriptions have access to public API endpoints on the Enterprise product edition only. Existing customers on non-Enterprise editions will retain access their available endpoints (Legacy) until their subscription expires. To use API endpoints after renewal, you must upgrade to the Enterprise product edition or use a reduced set of endpoints (Current). For more information on differences between product editions in the new model, please visit Pricing and Packaging.
Overview
After you have run a job to generate results, you can publish those results to different targets as needed. This section describes how to automate those publishing steps through the APIs.
Note
This task applies to re-publishing job results after you have already generated them.
Note
After you have generated results and written them to one target, you cannot publish to the same target. You must configure the outputs to specify a different format and location and then run a new job.
In the application, you can publish after generating results. See Publishing Dialog.
Basic Task
Create connections to each target to which you wish to publish. Connections must support write operations.
Specify a job whose output meets the requirements for the target.
Run the job.
When the job completes, publish the results to the target(s).
Step - Create Connections
For each target, you must have access to create a connection to it. After a connection is created, it can be reused, so you may find it easier to create them through the application.
Some connections can be created via API. For more information, see Designer Cloud Powered by Trifacta: API Reference docs
Other connections must be created through the application. Links to instructions are provided below.
Note
Connections created through the application must be created through the Connections page, which is used for creating read/write connections. Do not create these connections through the Import Data page. See Connections Page.
Redshift connection
Required Output Format: Avro
Example Id: 2
Create via API: N
Doc Link:Amazon Redshift Connections
Step - Run Job
Before you publish results to a different datastore, you must generate results and store them in HDFS.
Note
To produce some output formats, you must run the job on the Spark running environment.
In the examples below, the following example data is assumed:
Identifier | Value |
---|---|
jobId | 2 |
flowId | 3 |
For more information on running a job, see Designer Cloud Powered by Trifacta: API Reference docs
For more information on the publishing endpoint, see Designer Cloud Powered by Trifacta: API Reference docs
Step - Publish Results to Redshift
The following uses the Avro results from the specified job (jobId = 2) to publish the results to the test_table2
table in the public
Redshift schema through connectionId=2.
Note
To publish to Redshift, the targeted database is predefined in the connection object. For the path
value in the request body, you must specify the schema in this database to use. Schema information is not available through API. To explore the available schemas, click the Redshift icon in the Import Data page. The schemas are the first level of listed objects. For more information, see Import Data Page.
Request:
Endpoint | http://www.wrangle-dev.example.com:3005/v4/jobGroups/2/publish |
---|---|
Authentication | Required |
Method | PUT |
Request Body | { "connection": { "id": 2 }, "path": ["public"], "table": "test_table2", "action": "create", "inputFormat": "avro" } |
Response:
Status Code | 200 - OK |
---|---|
Response Body | { "jobgroupId":2, "reason":"JobStarted", "sessionId":"fae64760-4fc4-11e8-8cba-0987061e4e16" } |
Step - Publish Results with Overrides
When you are publishing results to a relational source, you can apply overrides to the job to redirect the output or change the action applied to the target table. For more information, see API Task - Run Job.