Zabbix API is the way to go when you need to manage Zabbix configurations or get data from Zabbix programmatically. For Python applications one of the community-based libraries is PyZabbix. Note: There is also a package called py-zabbix. That is a different one, not handled in this post. In this post I’ll show: How to […]
Tag: api
Creating an API with Amazon API Gateway and AWS Lambda
This is all about creating your first API in the Amazon cloud, serverless (= using someone else’s servers). In this example I’ll create: An AWS Lambda function (in Python) that is the code that does the things I want to do when someone calls my API An Amazon API Gateway that is the frontend for […]
Systemd Setup for FastAPI Webhook Listener
In my previous post I showed a simple NetBox webhook listener using FastAPI. In this post I’ll show the configurations to run the API using systemd. Let’s get into it, on my Debian 10 system. Let’s save the webhook_listener.py from the previous post in the same folder (webhook). Now we can try starting the webhook […]
Webhook Listener with FastAPI
Last year I wrote a webhook listener using Flask-RESTPlus. Now I wrote the same using FastAPI: There is so much to unpack there! Some of the FastAPI features I used (there are some links to FastAPI documentation): Request validation: I defined my own WebhookData class that defines the expected data in the webhook request. For […]
Even Better Webhook Listener
I made some improvements to the NetBox webhook listener presented in my earlier post. Here is the new one: Example from the log file: Notable changes: Added the message digest verification (X-Hook-Signature header sent by NetBox) Added content length checking as an example of all the worries you need to take care of when publishing […]
Webhook Listener for NetBox
Note: There is an improved version in the next post. Following my earlier post about implementing a REST API, here is a simple listener for NetBox webhooks: webhook-listener.py: With the other configurations described in the earlier post (and after configured NetBox to send the webhook POST requests to http://my.server.local/webhook/), these are the outputs: webhook-listener.log: Automatically […]
My First REST API with Python and Flask-RESTPlus
With few or no explanations, on Debian 10: The actual API app, in ~/resttest/resttest.py: ~/resttest/wsgi.py: /etc/systemd/system/resttest.service: /etc/nginx/sites-available/resttest: Final setup steps: Testing results: Also note that the Swagger UI is automatically accessible in http://my.server.name/: Some future considerations: TLS encryption (= reconfiguring NGINX) Authentication for the API Disabling/customizing the Swagger UI Links: Flask Flask-RESTPlus NGINX The post […]