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

조회 수: 9 (최근 30일)
peemv
peemv 2024년 6월 26일
답변: Christopher Stapels 2024년 7월 1일
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일
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에서 JSON Format에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by