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

9 views (last 30 days)
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

Answers (1)

Christopher Stapels
Christopher Stapels on 1 Jul 2024
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.

Products

Community Treasure Hunt

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

Start Hunting!