I'm relatively new to bash scripts so forgive me if this is a stupid question. Here is my simple bash script. It is written to send a POST request to a REST API repeatedly. I have set up some alerts to trigger when I have reached a certain threshold of these messages.
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
I get this error in the terminal every time
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
Anybody have an idea on what I am doing wrong?
EDIT: note that schDurSec is a String, while schStrtMillisecs, schEndMillisecs and count are integers.
A closing curly brace is missing in your data:
'{"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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With