gpt4 book ai didi

bash - 意外的输入结束 : expected close marker for Object error when trying to send a curl post request in a for loop

转载 作者:行者123 更新时间:2023-12-03 16:14:01 28 4
gpt4 key购买 nike

我对 bash 脚本比较陌生,所以如果这是一个愚蠢的问题,请原谅我。这是我的简单 bash 脚本。编写它是为了重复向 REST API 发送 POST 请求。我已经设置了一些警报以在达到这些消息的某个阈值时触发。

for i in {0..600};
do
curl -X POST -d '{"rsID":{"action":"RECORDING_REQUESTED","ccid":"9999","rsId":"1c047ce2-8870-3072-852c-deae92a89105","chnnlId":"7438caaf-69bd-d76e-8091-3e5f60e57ad7","canonId":"1bb750d2-7b2a-2792-e21b-cdd8e41e6540","srsId":"","xtId":"SH009513260000","schDurSec":"1800","schStrtMillisecs":1539287671000,"schEndMillisecs":1539289471000,"count":40000}' -H "Content-Type:application/json" http://random-site/api/v1/proxy/folders/dvr-scheduler/services/https:dispatch-1-0-5:443/service/addSchedulerEvent;
echo sent query $i;
sleep 1;
done

我每次都在终端中收到此错误
Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@24077193; line: 1, column: 1])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@24077193; line: 1, column: 663]sent query 0
Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@44d2b5af; line: 1, column: 1])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@44d2b5af; line: 1, column: 663]sent query 1
Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@f2b601e; line: 1, column: 1])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@f2b601e; line: 1, column: 663]sent query 2

有人知道我做错了什么吗?

编辑:注意 schDurSec 是一个字符串,而 schStrtMillisecs、schEndMillisecs 和 count 是整数。

最佳答案

您的数据中缺少右花括号:

'{"rsID":
{"action":"RECORDING_REQUESTED",
"ccid":"9999",
"rsId":"1c047ce2-8870-3072-852c-deae92a89105",
"chnnlId":"7438caaf-69bd-d76e-8091-3e5f60e57ad7",
"canonId":"1bb750d2-7b2a-2792-e21b-cdd8e41e6540",
"srsId":"",
"xtId":"SH009513260000",
"schDurSec":"1800",
"schStrtMillisecs":1539287671000,
"schEndMillisecs":1539289471000,
"count":40000
}
}' # <-- this brace is missing

关于bash - 意外的输入结束 : expected close marker for Object error when trying to send a curl post request in a for loop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53923226/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com