API Guide #
This is a guide letting you know the functions available via the API. You can perform Create, Delete, and View Operations on Notes using the API.
Note: If deploying from instructions, theAPPLICATION_PATH
isnotes-staging
.
Creating a Note #
$ curl -X POST http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api -d '{"message": "ZAP"}'
{
"Success": "Note added!"
}
$ curl -X POST http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api -d '{"message": "YEET"}'
{
"Success": "Note added!"
}
View all Notes #
$ curl -X GET http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api
[(1, 'ZAP'), (2, 'YEET')]
View select Note #
$ curl -X GET http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api\?id\=1
[(1, 'ZAP')]
Delete select Note #
$ curl -X DELETE http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api\?id\=1
Note deleted successfully!
$ curl -X GET http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api
[(2, 'YEET')]
Admin API Guide #
The admin functions are exactly the same as regular functions, except that secrets created by an admin can only be seen or deleted by an admin.
Note: The admin path is /api/admin
and requires Basic Authentication.
Creating a Note #
$ curl -u admin:yeet -X POST http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api/admin -d '{"message": "ZAP"}'
{
"Success": "Note added!"
}
$ curl -u admin:yeet -X POST http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api/admin -d '{"message": "YEET"}'
{
"Success": "Note added!"
}
View all Notes #
$ curl -u admin:yeet -X GET http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api/admin
[(1, 'ZAP','<IP-Address>', '<HostName>', 1), (2, 'YEET','<IP-Address>', '<HostName>', 1)]
View select Note #
$ curl -u admin:yeet -X GET http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api/admin\?id\=1
[(1, 'ZAP', '<IP-Address>', '<HostName>', 1)]
Delete select Note #
$ curl -u admin:yeet -X DELETE http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api/admin\?id\=1
Note deleted successfully!
$ curl -u admin:yeet -X GET http://{LOAD_BALANCER_IP}/{APPLICATION_PATH}/api/admin
[(2, 'YEET', '<IP-Address>', '<HostName>', 1)]