<!-- NOTE: Do not edit arc:info -->
<arc:info title="Custom Script" desc="This script will be executed when a file is processed.">
<input name="ConnectorId" desc="The id of this connector." />
<input name="WorkspaceId" desc="The workspace of this connector." />
<input name="MessageId" desc="The message id." />
<input name="FilePath" desc="The path of the file being processed." />
<input name="FileName" desc="The name of the file being processed." />
<input name="Attachment#" desc="The path of the attachment being processed." />
<input name="Header:*" desc="The message headers of the file being processed." />
<output name="Data" desc="The data that will be written to the file in the Receive folder." />
<output name="Encoding" desc="The encoding that will be used to write the file in the Receive folder." />
<output name="FileName" desc="The name of the output file in Receive folder." />
<output name="FilePath" desc="The path of file that will be written to Receive folder." />
<output name="Header:*" desc="The message headers of the file being written." />
</arc:info>
<!-- Upload Predict Data -->
<arc:set attr="upload.URL" value="https://api.forecastinge.com/v1/datas" />
<arc:set attr="upload.file:file" value="[FilePath]" />
<arc:set attr="upload.header:name#1" value="Authorization" />
<arc:set attr="upload.header:value#1" value="Bearer [Vault(FEToken)]" />
<arc:set attr="upload.form:label" value="data_predict" />
<arc:set attr="upload.form:project_id" value="[Vault(ProjectId)]" />
<arc:set attr="upload.form:name" value="[FileName]" />
<arc:call op="httpUpload" in="upload">
<arc:set attr="output.result" value="[http:content]" />
</arc:call>
<!-- Find Data Id -->
<arc:set attr="findData.URL" value="https://api.forecastinge.com/v1/datas?sort_by=created_at&order=DESC&limit=1" />
<arc:set attr="findData.header:name#1" value="Authorization" />
<arc:set attr="findData.header:value#1" value="Bearer [Vault(FEToken)]" />
<arc:set attr="findData.localfile" value="[FilePath | replace('.csv','.json')]" />
<arc:call op="httpGet" in="findData">
</arc:call>
<arc:set attr="json.uri" value="[FilePath | replace('.csv','.json')]" />
<arc:set attr="json.jsonPath" value="/json/data/" />
<arc:call op="jsonDomSearch" in="json" out="result">
<arc:set attr="output.data_id" value="[jsonpath('data_id')]" />
</arc:call>
<!-- Forecast Data -->
<arc:set attr="request.URL" value="https://api.forecastinge.com/v1/models/forecast" />
<arc:set attr="request.contenttype" value="application/json" />
<api:set item="request" attr="postdata">
{
"data_id": [output.data_id],
"project_id": [Vault(ProjectId)],
"model_id": [Vault(ModelId)],
"result_only": true,
"name":"ForecastResult_[now('yyyyMMddhhmmss')]"
}
</api:set>
<arc:set attr="request.header:name#1" value="Authorization" />
<arc:set attr="request.header:value#1" value="Bearer [Vault(FEToken)]" />
<arc:call op="httpPost" in="request">
<arc:set attr="output.data" value="[http:content]" />
<api:set attr="output.FileName" value="Results.csv"/>
</arc:call>
<arc:push item="output" />
<!-- NOTE: Do not edit arc:info -->
<arc:info title="Custom Script" desc="This script will be executed when a file is processed.">
<input name="ConnectorId" desc="The id of this connector." />
<input name="WorkspaceId" desc="The workspace of this connector." />
<input name="MessageId" desc="The message id." />
<input name="FilePath" desc="The path of the file being processed." />
<input name="FileName" desc="The name of the file being processed." />
<input name="Attachment#" desc="The path of the attachment being processed." />
<input name="Header:*" desc="The message headers of the file being processed." />
<output name="Data" desc="The data that will be written to the file in the Receive folder." />
<output name="Encoding" desc="The encoding that will be used to write the file in the Receive folder." />
<output name="FileName" desc="The name of the output file in Receive folder." />
<output name="FilePath" desc="The path of file that will be written to Receive folder." />
<output name="Header:*" desc="The message headers of the file being written." />
</arc:info>
<!-- Upload Predict Data -->
<arc:set attr="upload.URL" value="https://api.forecastinge.com/v1/datas" />
<arc:set attr="upload.file:file" value="[FilePath]" />
<arc:set attr="upload.header:name#1" value="Authorization" />
<arc:set attr="upload.header:value#1" value="Bearer [Vault(FEToken)]" />
<arc:set attr="upload.form:label" value="data_predict" />
<arc:set attr="upload.form:project_id" value="[Vault(ProjectId)]" />
<arc:set attr="upload.form:name" value="[FileName]" />
<arc:call op="httpUpload" in="upload">
<arc:set attr="output.result" value="[http:content]" />
</arc:call>
<!-- Find Data Id -->
<arc:set attr="findData.URL" value="https://api.forecastinge.com/v1/datas?sort_by=created_at&order=DESC&limit=1" />
<arc:set attr="findData.header:name#1" value="Authorization" />
<arc:set attr="findData.header:value#1" value="Bearer [Vault(FEToken)]" />
<arc:set attr="findData.localfile" value="[FilePath | replace('.csv','.json')]" />
<arc:call op="httpGet" in="findData">
</arc:call>
<arc:set attr="json.uri" value="[FilePath | replace('.csv','.json')]" />
<arc:set attr="json.jsonPath" value="/json/data/" />
<arc:call op="jsonDomSearch" in="json" out="result">
<arc:set attr="output.data_id" value="[jsonpath('data_id')]" />
</arc:call>
<!-- Forecast Data -->
<arc:set attr="request.URL" value="https://api.forecastinge.com/v1/models/forecast" />
<arc:set attr="request.contenttype" value="application/json" />
<api:set item="request" attr="postdata">
{
"data_id": [output.data_id],
"project_id": [Vault(ProjectId)],
"model_id": [Vault(ModelId)],
"result_only": true,
"name":"ForecastResult_[now('yyyyMMddhhmmss')]"
}
</api:set>
<arc:set attr="request.header:name#1" value="Authorization" />
<arc:set attr="request.header:value#1" value="Bearer [Vault(FEToken)]" />
<arc:call op="httpPost" in="request">
<arc:set attr="output.data" value="[http:content]" />
<api:set attr="output.FileName" value="Results.csv"/>
</arc:call>
<arc:push item="output" />
関連コンテンツ