trocco API Integration
  • 07 Dec 2022
  • 3 Minutes to read
  • Dark
    Light

trocco API Integration

  • Dark
    Light

Article Summary

Note

This is a machine-translated version of the original Japanese article.
Please understand that some of the information contained on this page may be inaccurate.

summary

You can use some of trocco's functions using the API.

Issuing an API Key

  1. Click API KEY Settings from the settings at the top right of the trocco top screen to open the API KEY list screen.

troccosetting.png

  1. Issue an API key from Create New in the upper right.

image.png

Authentication methods

Authenticate by specifying the API key in the Authorization header.

example

$ curl -X POST https://trocco.io/api/jobs?job_definition_id=<転送設定ID>
-H "Authorization: Token <APIキー>"

Run Job API

POST /api/jobs

parameter

Parameter NameTypeDescription
job_definition_idintThis is a required parameter.
Specify the transfer setting ID.
context_timeStringIf you use the custom variable **Time and Date (when queuing)** in the transfer settings, you can specify the date and time to be expanded.
Specify the following form: YYYY-MM-DD HH:MM:SS.
Example: 2019-11-18 00:00:00
The timezone is JST Japan time (GMT+9).
If not specified, the date and time of the API request are used.
custom_variablesArray of
Custom Variable<name, value>
You can specify custom variables.

name: Custom variable name (e.g.             )
value: The value of the custom variable

response

Item NameTypeDescription
idintThis will be the ID of the job.
job_definition_idintIt will be the ID of the forwarding settings.
job_definition_nameStringThis is the name of the transfer setting.
statusStringThis is the status of the job.
The following statuses exist:

・ queued ... Waiting to be executed
・ setting_up ... Execution readiness
・executing ... Running state
・Interrupting ... Execution suspended state
・succeeded ... Execution completed (success) state
・ Error ... Execution completed (error) state
・ canceled ... Execution completed (canceled) state
・Skipped ... Execution completed (skipped) state
created_attimestampThis is the date and time that the transfer job was created.

example

$ curl -X POST https://trocco.io/api/jobs?job_definition_id=<転送設定ID>
-H "Authorization: Token <APIキー>"
-d "context_time=<展開時刻>"
-d "custom_variables[][name]=$ad_id$"
-d "custom_variables[][value]=A0000"

Check Job Status API

GET /api/jobs/<Job ID>

response

Item NameTypeDescription
idintThis will be the ID of the job.
job_definition_idintIt will be the ID of the forwarding settings.
job_definition_nameStringThis is the name of the transfer setting.
statusStringThis is the status of the job.
The following statuses exist:

・ queued ... Waiting to be executed
・ setting_up ... Execution readiness
・executing ... Running state
・Interrupting ... Execution suspended state
・succeeded ... Execution completed (success) state
・ Error ... Execution completed (error) state
・ canceled ... Execution completed (canceled) state
・Skipped ... Execution completed (skipped) state
started_attimestampThis is the transfer start date and time of the transfer job.
* If the job is incomplete, it will not be included in the response.
finished_attimestampThis is the transfer end date and time of the transfer job.
* If the job is incomplete, it will not be included in the response.
created_attimestampThis is the date and time that the transfer job was created.

example

$ curl -X GET https://trocco.io/api/jobs/<ジョブID>
-H "Authorization: Token <APIキー>"

Workflow Job Execution API

POST /api/pipeline_jobs

parameter

Parameter NameTypeDescription
pipeline_definition_idintThis is a required parameter.
Specify the workflow definition ID.
context_timeStringIf you use the custom variable **Time and Date (when queuing)** in the forwarding settings, you can specify the date and time to be expanded.
Specify YYYY-MM-DD HH:MM:SS.
Example: 2019-11-18 00:00:00
The timezone is JST Japan time (GMT+9).
If not specified, the date and time of the API request are used.

response

Item NameTypeDescription
idintThis will be the ID of the job.
pipeline_definition_idintThis will be the ID of the data mart definition.
nameStringThis is the name of the data mart definition.
statusStringThis is the status of the job.
The following statuses exist:

・ queued ... Waiting to be executed
・ setting_up ... Execution readiness
・executing ... Running state
・Interrupting ... Execution suspended state
・succeeded ... Execution completed (success) state
・ Error ... Execution completed (error) state
・ canceled ... Execution completed (canceled) state
・Skipped ... Execution completed (skipped) state
created_attimestampThis is the date and time the workflow job was created.
started_attimestampThis is the start date and time of the workflow job.
finished_attimestampThis is the completion date and time of the workflow job.
context_timetimestampIf you use the custom variable [Time and date (when queuing)** in the workflow settings, it will be expanded based on this date and time.

example

$ curl -X POST https://trocco.io/api/pipeline_jobs?pipeline_definition_id=<ワークフロー設定ID>
-H "Authorization: Token <APIキー>"
-d "context_time=<展開時刻>"

Check Workflow Job Status API

GET /api/pipeline_jobs/<Job ID>

response

Item NameTypeDescription
idintThis will be the ID of the job.
pipeline_definition_idintThis will be the ID of the data mart definition.
nameStringThis is the name of the data mart definition.
statusStringThis is the status of the job.
The following statuses exist:

・ queued ... Waiting to be executed
・ setting_up ... Execution readiness
・executing ... Running state
・Interrupting ... Execution suspended state
・succeeded ... Execution completed (success) state
・ Error ... Execution completed (error) state
・ canceled ... Execution completed (canceled) state
・Skipped ... Execution completed (skipped) state
created_attimestampThis is the date and time the workflow job was created.
started_attimestampThis is the start date and time of the workflow job.
finished_attimestampThis is the completion date and time of the workflow job.
context_timetimestampIf you use the custom variable [Time and date (when queuing)** in the workflow settings, it will be expanded based on this date and time.

example

$ curl -X POST https://trocco.io/api/pipeline_jobs?pipeline_definition_id=<ワークフロー設定ID>
-H "Authorization: Token <APIキー>"
-d "context_time=<展開時刻>"

Was this article helpful?

What's Next