This endpoint uploads ZIP file to the page
Request
To upload a new zip file to an existing Page, please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v2.0/pages//code |
Header
Parameter | Type | Description |
---|---|---|
X-Auth-Token | String | Authentication Token of account |
Body
A ZIP file with the below structure
├── manifest.toml
├── script.js
├── body.html
├── style.css
├── static
│ ├── some_files_or_folders
ZIP file docs
For further information about the structure and contents of each file, please visit our Developer center
Make sure to replace <path_to_file>
with the actual path to ZIP file.
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/pages/66f6e0645b9284000df59a10/code' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-F 'zipFile=@<path_to_file>.zip;type=application/zip'
import requests
# API endpoint
url = "https://industrial.api.ubidots.com/api/v2.0/pages/<pageKey>/code"
# Headers
headers = {
"X-Auth-Token": "oaXBo6ODhIjPsusNRPUGIK4d72bc73"
}
# File to upload
file_path = "<path_to_file>.zip"
files = {
"zipFile": ("<filename>.zip", open(file_path, "rb"), "application/zip")
}
# Make the POST request
response = requests.post(url, headers=headers, files=files)
# Print the response
print(response.status_code)
print(response.text)
{"message": "File successfully uploaded."}
{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}
{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}
Response
{"message": "File successfully uploaded."}