401 error code when trying to bulk-write to Thingspeak using AT-COMMAND

21 次查看(过去 30 天)
Hi everyone,
I would like to bulk-write json data to Thingspeak using AT commands (I'm using SIM7600 module). As I want to send a large amount of data at the same time, the json buffer is not enough. So I'm posting from a file. However I always get a 401 error code.
Does someone know why I get this error ?
The whole commands and results are reported below.
Thank you in advance
AT+HTTPINIT
OK
AT+HTTPPARA="URL","https://api.thingspeak.com/channels/<my_channel_id>/bulk_update.json"
OK
AT+HTTPPARA="CONTENT","application/json"
OK
AT+HTTPPOSTFILE="/data.txt",2,1,1
OK
AT+HTTPACTION=1
OK
+HTTPACTION: 1,401,0
+HTTPACTION: 1,401,154
+HTTP_PEER_CLOSED
AT+HTTPREAD=0,1000
OK
+HTTPREAD: DATA,154
{"status":"401","error":{"error_code":"error_auth_required","message":"Authorization Required","details":"Please provide proper authentication details."}}
+HTTPREAD:0
AT+HTTPTERM
OK

回答(1 个)

Christopher Stapels
Christopher Stapels 2024-7-1,13:18
The bulk endpoint requires a somewhat complex syntax. Check out the bulk JSON update page here. You aren't providing all the correct information, for example AIP key, etc.

类别

Help CenterFile Exchange 中查找有关 Write Data to Channel 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by