Python support.
Hi Ninox.
I'd like to run a Python program to pull some information from a serial interface and put it in a variable that will be put into a record entry. Are you guys interfacing with Python yet? Or any other external calls?
Thank you.
John
8 replies
-
@John, an interesting use case. Using the Ninox Cloud version, your Python application can post into your Ninox Cloud database. For LOCAL database, they currently do not support an API.
See https://ninoxdb.de/en/manual/api/rest and browse for "Update Record"..
-
Hi, thank you for support, the link is not working... can you please suggest any other place where to get a similar documentation?
-
Here is the link to the latest documents on API from Ninox.
-
here you can found an great API manager in JavaScript written by Axel Rothe : https://github.com/AxelRothe/ninox
To turn how to call Ninox API with Python language, there is many way :
- use REST software (like Advanced REST Client from MuleSoft) to test your connexion and retrieve corresponding code :
- use one curl to Python converter to convert the code from Ninox documentation : https://sqqihao.github.io/trillworks.html
-
First of all thanks a lot to Jacques who really helped a lot with patience!
I wrote a small Python script who scrape some data from Internet:
#data scraped from internet, for example
# a = 10, b = Paperino, c = Pluto, d = Nonna Papera
#now i transform the dict in JSON format ready for Ninox
#it works!
my_dict = [{
"fields": {
"Field1": [a],
"Field2": [b],
"Field3": [c],
"Field4": [d]
}
}]
my_json = json.dumps(my_dict, ensure_ascii=False)
url = 'https://api.ninox.com/v1/teams/TEAM-ID/databases/DATABASE-ID/tables/TABLE-ID/records'
headers = {'Authorization': 'Bearer API-KEY','Content-Type': 'application/json'}
req = requests.post(url, headers=headers, data=my_json)
print(req.text)
At this point is all OK
But when I try to update a record of the same Table with the PUT command instead of a POST, for example:
url = 'https://api.ninox.com/v1/teams/TEAM-ID/databases/DATABASE-ID/tables/TABLE-ID/records/1'
headers = {'Authorization': 'Bearer API-KEY','Content-Type': 'application/json'}
req = requests.put(url, headers=headers, data=my_json)
print(req.text)
I receive this error:
{"message":"Internal Server Error"}
Thx for your attention
dnnywld
-
Thank you a lot Jacques, all works perfectly!
I know that Ninox is written in JavaScript, and I saw your excellent solutions about NativeJS from Ninext.
Unfortunately I am not familiar with JS and I would really be able to run a Python script from Ninox. You said that could be really complex, but do you or anyone here know where to find a guide about that?
Seems that no one ever tried to do that...
As always thanks for all to you and all Ninox users always ready to help.
Content aside
- 2 yrs agoLast active
- 8Replies
- 2147Views
-
2
Following