我将如何将以下 curl 命令转换为 Jitterbit 操作?
curl -i -u username:password -X POST -F file=@/path/to/file.csv
https://website.com/api/filepost
目前我的操作结构如下:
脚本:
$jitterbit.target.http.form_data = true; $jitterbit.target.http.form_data.filename = "file.csv"; $jitterbit.target.http.form_data.name = "文件";
Source 一个没有标题的 CSV 文件,它符合 API 的规范(通过 curl 成功发送了相同的文件)
转换:文本到文本 - 源文件和目标文件都使用与源文件相同的文件格式
目前我已成功验证,但我收到一条 400/Bad Request 错误消息,提示“没有附加文件”。
完整的错误信息:
The operation "2. POST Preapplicants - CSV to API" failed.
Fatal Error
Failed to post to the url 'https://website.com/api/filepost’.
The last (and probably most relevant) error was: The server
returned HTTP Status Code : 400 Bad Request Error is: The
request could not be processed by the server due to invalid
syntax. Headers sent by the server: HTTP/1.1 400 Bad Request
Server: nginx/1.10.3 (Ubuntu) Content-Type: application/json
Transfer-Encoding: chunked Connection: keep-alive Cache-Control:
no-cache Date: Tue, 12 Sep 2017 18:55:38 GMT The response was:
{"message":"No file attached."}