Comments (6)
API logs should tell you what the issue is.
In this case and if what you pasted is accurate, it should be that is_of_device_type
should be spelled is_of__device_type
(note the double underscore between is_of
and device_type
because it's a relationship traversal).
from open-balena.
Thank you for responding, the documentation is like this:
curl -X POST
"https://api.balena-cloud.com/v6/application"
-H "Content-Type: application/json"
-H "Authorization: Bearer <AUTH_TOKEN>"
--data '{
"app_name": "",
"device_type": ""
}'
and i did this i was getting this: Jamess-MacBook-Pro:~ jameskamwendo$ curl --cacert ca.crt -X POST "https://api.balenaproject.net/v6/application" -H "Content-Type: application/json" -H "Authorization: Bearer HgZNAhxvD4O7kk1qfyJxavz1dmqZo1Xn" --data '{"app_name": "fooled", "device_type": "raspberrypicm4-ioboard"}' -v
Note: Unnecessary use of -X or --request, POST is already inferred.
- Trying 192.168.43.207...
- TCP_NODELAY set
- Connected to api.balenaproject.net (192.168.43.207) port 443 (#0)
- ALPN, offering http/1.1
- Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@strength
- successfully set certificate verify locations:
- CAfile: ca.crt
CApath: none - TLSv1.3 (OUT), TLS handshake, Client hello (1):
- TLSv1.3 (IN), TLS handshake, Server hello (2):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Unknown (8):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Certificate (11):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, CERT verify (15):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Finished (20):
- TLSv1.3 (OUT), TLS change cipher, Client hello (1):
- TLSv1.3 (OUT), TLS Unknown, Certificate Status (22):
- TLSv1.3 (OUT), TLS handshake, Finished (20):
- SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
- ALPN, server did not agree to a protocol
- Server certificate:
- subject: CN=*.balenaproject.net
- start date: Jul 28 13:08:58 2023 GMT
- expire date: Jul 27 13:08:58 2025 GMT
- subjectAltName: host "api.balenaproject.net" matched cert's "*.balenaproject.net"
- issuer: CN=ca.balenaproject.net
- SSL certificate verify ok.
- TLSv1.3 (OUT), TLS Unknown, Unknown (23):
POST /v6/application HTTP/1.1
Host: api.balenaproject.net
User-Agent: curl/7.53.1
Accept: /
Content-Type: application/json
Authorization: Bearer HgZNAhxvD4O7kk1qfyJxavz1dmqZo1Xn
Content-Length: 63
- upload completely sent off: 63 out of 63 bytes
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
- TLSv1.3 (IN), TLS Unknown, Unknown (23):
< HTTP/1.1 500 Internal Server Error
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< Vary: X-HTTP-Method-Override
< Cache-Control: no-cache
< Date: Thu, 17 Aug 2023 11:55:10 GMT
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< - Connection #0 to host api.balenaproject.net left intact
Jamess-MacBook-Pro:~ jameskamwendo$
so i think i posted a log of what i was just trying after seeing the reponse when i created a fleet with balena cli the json had the is_of__device_type sort of so i thought maybe this might work just being desperate to see it work
from open-balena.
is_of__device_type
must be a number, the ID of the device type.
device_type
as per documentation must be a string, the slug of the device type.
Either of the two should work, assuming the API knows about the raspberrypicm4-ioboard
which I understand is a custom one.
from open-balena.
Same reponse am getting in django, code snippet is like the following:
if request.method == 'POST':
api_url = "https://api.balenaproject.net/v6/application"
app_name = request.POST.get('app_name')
device_type = request.POST.get('device_type')
headers_create = {
"Content-Type": "application/json",
"Authorization": f"Bearer {auth_token}"
}
payload = {
"app_name": app_name,
"device_type": device_type
}
print(payload)
# device_type
# response = requests.post(api_url, json=payload, headers=headers_create, verify=True)
response = requests.request('POST', api_url, json=payload, headers=headers_create, verify=True)
print("Response Content:", response)
from open-balena.
is_of__device_type
must be a number, the ID of the device type.
device_type
as per documentation must be a string, the slug of the device type.Either of the two should work, assuming the API knows about the
raspberrypicm4-ioboard
which I understand is a custom one.
I retried it with the is_of__device_type and put a number that was assigned to an existing fleet i created with balena cli and i still get this and same thing in postman:
Jamess-MacBook-Pro:~ jameskamwendo$ curl --cacert ca.crt -X POST "https://api.balenaproject.net/v6/application" -H "Content-Type: application/json" -H "Authorization: Bearer HgZNAhxvD4O7kk1qfyJxavz1dmqZo1Xn" --data '{"app_name": "fooled", "is_of__device_type": 65}' -v
Note: Unnecessary use of -X or --request, POST is already inferred.
- Trying 192.168.43.207...
- TCP_NODELAY set
- Connected to api.balenaproject.net (192.168.43.207) port 443 (#0)
- ALPN, offering http/1.1
- Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@strength
- successfully set certificate verify locations:
- CAfile: ca.crt
CApath: none - TLSv1.3 (OUT), TLS handshake, Client hello (1):
- TLSv1.3 (IN), TLS handshake, Server hello (2):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Unknown (8):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Certificate (11):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, CERT verify (15):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Finished (20):
- TLSv1.3 (OUT), TLS change cipher, Client hello (1):
- TLSv1.3 (OUT), TLS Unknown, Certificate Status (22):
- TLSv1.3 (OUT), TLS handshake, Finished (20):
- SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
- ALPN, server did not agree to a protocol
- Server certificate:
- subject: CN=*.balenaproject.net
- start date: Jul 28 13:08:58 2023 GMT
- expire date: Jul 27 13:08:58 2025 GMT
- subjectAltName: host "api.balenaproject.net" matched cert's "*.balenaproject.net"
- issuer: CN=ca.balenaproject.net
- SSL certificate verify ok.
- TLSv1.3 (OUT), TLS Unknown, Unknown (23):
POST /v6/application HTTP/1.1
Host: api.balenaproject.net
User-Agent: curl/7.53.1
Accept: /
Content-Type: application/json
Authorization: Bearer HgZNAhxvD4O7kk1qfyJxavz1dmqZo1Xn
Content-Length: 48
- upload completely sent off: 48 out of 48 bytes
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
- TLSv1.3 (IN), TLS Unknown, Unknown (23):
< HTTP/1.1 500 Internal Server Error
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< Vary: X-HTTP-Method-Override
< Cache-Control: no-cache
< Date: Thu, 17 Aug 2023 14:16:52 GMT
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< - Connection #0 to host api.balenaproject.net left intact
Jamess-MacBook-Pro:~ jameskamwendo$ curl --cacert ca.crt -X POST "https://api.balenaproject.net/v6/application" -H "Content-Type: application/json" -H "Authorization: Bearer HgZNAhxvD4O7kk1qfyJxavz1dmqZo1Xn" --data '{"app_name": "fooled", "is_of__device_type": "65"}' -v
Note: Unnecessary use of -X or --request, POST is already inferred. - Trying 192.168.43.207...
- TCP_NODELAY set
- Connected to api.balenaproject.net (192.168.43.207) port 443 (#0)
- ALPN, offering http/1.1
- Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@strength
- successfully set certificate verify locations:
- CAfile: ca.crt
CApath: none - TLSv1.3 (OUT), TLS handshake, Client hello (1):
- TLSv1.3 (IN), TLS handshake, Server hello (2):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Unknown (8):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Certificate (11):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, CERT verify (15):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Finished (20):
- TLSv1.3 (OUT), TLS change cipher, Client hello (1):
- TLSv1.3 (OUT), TLS Unknown, Certificate Status (22):
- TLSv1.3 (OUT), TLS handshake, Finished (20):
- SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
- ALPN, server did not agree to a protocol
- Server certificate:
- subject: CN=*.balenaproject.net
- start date: Jul 28 13:08:58 2023 GMT
- expire date: Jul 27 13:08:58 2025 GMT
- subjectAltName: host "api.balenaproject.net" matched cert's "*.balenaproject.net"
- issuer: CN=ca.balenaproject.net
- SSL certificate verify ok.
- TLSv1.3 (OUT), TLS Unknown, Unknown (23):
POST /v6/application HTTP/1.1
Host: api.balenaproject.net
User-Agent: curl/7.53.1
Accept: /
Content-Type: application/json
Authorization: Bearer HgZNAhxvD4O7kk1qfyJxavz1dmqZo1Xn
Content-Length: 50
- upload completely sent off: 50 out of 50 bytes
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
- TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
- TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
- TLSv1.3 (IN), TLS Unknown, Unknown (23):
< HTTP/1.1 500 Internal Server Error
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< Vary: X-HTTP-Method-Override
< Cache-Control: no-cache
< Date: Thu, 17 Aug 2023 14:17:05 GMT
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked
< - Connection #0 to host api.balenaproject.net left intact
Jamess-MacBook-Pro:~ jameskamwendo$
from open-balena.
Sorry, I don't see what's wrong. I'll close the issue as the issue tracker is not for support questions, but please post your issue in our forums, you'll also reach a much wider audience there.
from open-balena.
Related Issues (20)
- 503 - Service Unavailable HOT 5
- Failed to get device type build data for... HOT 2
- Up to date version of open-balena api requires API_HOST, not HOST env var HOT 1
- device is online=false HOT 1
- deploy multi docker-compose file without replace services HOT 1
- Restricted API keys HOT 2
- I can't connect to device - balena ssh <uuid device> - Host <UUID> not found: 2(SERVFAIL) HOT 1
- Ansible playbook to deploy open balena server and admin dashboard
- Quickstart does not work HOT 20
- haproxy:2.9-alpine can not build HOT 3
- DBUS: Communication with NetworkManager not possible anymore from docker container application HOT 1
- make auto-pki Command Takes Excessively Long Time to Complete HOT 3
- configure and connect minio buckets HOT 1
- API service responds with error 520 and constant AccessDenied error in the logs HOT 8
- 'make up' not working HOT 4
- Steps to Change Domain in OpenBalena v3.8.2 and v4.0.13 HOT 7
- What's new in version 4.x? HOT 6
- OpenVPN Issue with "Bad encapsulated packet length from peer" HOT 1
- `make auto-pki` command waits forever HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-balena.