我正在尝试使用curl对应用程序进行POST.我想用文件中的内联数据和数据构建数据,但我无法做到.
有谁知道这是否可能?
这是我正在尝试的代码示例:
curl -i -X POST http://localhost:3000/admin/articles -H "Content-Type: application/json" --data '{"article": {"issue_id": "1", "title": "hello", "translations_attributes": {"0": {"locale": "en", "id": "", "content": @file.json}}}}'
Run Code Online (Sandbox Code Playgroud)
这更像是一种解决方法,但我认为应该在大多数弹壳中完成工作.
curl -i -X POST http://localhost:3000/admin/articles \
-H "Content-Type: application/json" \
--data '{"article": {"issue_id": "1", "title": "hello",
"translations_attributes": {"0": {"locale": "en", "id": "",
"content": '"`cat file.json`"'}}}}'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6007 次 |
| 最近记录: |