使用 cURL 将 JSON 直接从 web URL 复制到 couchDB
Copy JSON directly from web URL to couchDB with cURL
是否可以将 curl -X GET
(即 JSON)的结果直接插入到 couchDB 数据库中?
也就是类似的东西。
>>> curl -X GET -H "some_header" http://some_web_JSON -X POST http://127.0.0.1:port/some_DB/_bulk_docs
拆分过程似乎可行,但我似乎无法一次性获得正确的语法(假设这是可能的)
>>> curl -X GET -H "some_header" http://some_web_JSON > outfile.json
>>> curl @outfile.json -X POST http://127.0.0.1:port/some_DB/_bulk_docs
通常在这种情况下,好的旧 Unix 管道结合从 stdin 读取是解决方案:
curl http://example.com/ | curl -s -T - -H 'Content-Type: application/json' -X POST http://127.0.0.1:5984/test/_bulk_docs
是否可以将 curl -X GET
(即 JSON)的结果直接插入到 couchDB 数据库中?
也就是类似的东西。
>>> curl -X GET -H "some_header" http://some_web_JSON -X POST http://127.0.0.1:port/some_DB/_bulk_docs
拆分过程似乎可行,但我似乎无法一次性获得正确的语法(假设这是可能的)
>>> curl -X GET -H "some_header" http://some_web_JSON > outfile.json
>>> curl @outfile.json -X POST http://127.0.0.1:port/some_DB/_bulk_docs
通常在这种情况下,好的旧 Unix 管道结合从 stdin 读取是解决方案:
curl http://example.com/ | curl -s -T - -H 'Content-Type: application/json' -X POST http://127.0.0.1:5984/test/_bulk_docs