These examples send GET, POST and PUT requests from the Pico LTE to a web server over the cellular connection, and read the response. Webhook.site is the test server: it shows every request it receives. No extra hardware is needed.
Before you begin
Hardware
- Sixfab Pico LTE or Pico LTE 2Registered and active in Sixfab Connect, connected to the computer with the micro USB cable.
Software
- Thonny with MicroPython and the Pico LTE SDKSet up as in the quickstart.
- config.jsonIn the root of the board: Prepare the configuration file.
Prepare Webhook.site
-
Open Webhook.site.
Open webhook.site in a browser. It shows your unique URL; the requests sent to it appear in the side bar.

-
Set response.
The examples also read the server’s response. Click Edit and set:
- Status code:
200, success. - Content type:
text/plainfor plain text,application/jsonfor JSON. - Response body: the response to return; this one returns a message and the time of the request:
{ "response": "Hello", "timeOfReq": $request.timestamp$ }Click Save.

- Status code:
Set server
In config.json, set the server; Webhook.site needs no username or password, so leave them empty:
{
"https": {
"server": "https://webhook.site/000-****-****-****-*********",
"username": "",
"password": ""
}
}
For a server with basic HTTP authentication, set username and password, and add picoLTE.http.set_auth() after picoLTE.network.get_pdp_ready() in the script.
Run examples
Open the script from the examples/http folder of the SDK repository in Thonny and click Run. The request appears on Webhook.site, and the log shows the response.
Script: examples/http/get.py.

INFO: Sending a GET request.
INFO: {'response': ['OK'], 'status': 0}
INFO: {'response': ['+QHTTPGET: 0,200', '{', ' response": "Hello", "timeOfReq": 1686009056', '}', 'OK', '+QHTTPREAD: 0'], 'status': 0}
INFO: Get request succeeded.

Script: examples/http/post.py.

INFO: Sending a POST request.
INFO: {'response': ['OK', '+QHTTPPOST: 0,200'], 'status': 0}
INFO: Post request succeeded.
INFO: {'response': ['{', '"response": "Hello",', '"timeOfReq": 1687272527', '}', 'OK', '+QHTTPREAD: 0'], 'status': 0}

Script: examples/http/put.py.

INFO: Sending a PUT request.
INFO: {'response': ['OK', '+QHTTPPUT: 0,200'], 'status': 0}
INFO: Put request succeeded.
INFO: {'response': ['{', '"response": "Hello",', '"timeOfReq": 1687278386', '}', 'OK', '+QHTTPREAD: 0'], 'status': 0}

The folder also has get_with_custom_header.py and post_with_custom_header.py, which send custom request headers.
Troubleshooting
+CME ERROR: 703when reading the response: wait longer before reading it.+CME ERROR: 712on a POST or PUT request: the server URL is wrong or empty. Set the full URL, withhttps://and the query, inconfig.json.