Brijesh's Git Server — watchman @ main

observability tool, needs to be rewritten once identity is stable

API.adoc (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
=== Project Management API

==== TOC

* <<1-create-project,1. Create Project>>
* <<2-list-projects,2. List Projects>>
* <<3-get-project-by-id,3. Get Project By ID>>
* <<4-update-project,4. Update Project>>
* <<5-delete-project,5. Delete Project>>

==== 1. Create Project

[source,sh]
----
curl -X POST http://127.0.0.1:4000/projects -d '{"name": "Project 1"}'
----

==== 2. List Projects

[source,sh]
----
curl http://127.0.0.1:4000/projects
----

==== 3. Get Project By ID

[source,sh]
----
curl -X GET http://127.0.0.1:4000/projects/{id}
----

==== 4. Update Project

[source,sh]
----
curl -X PUT http://127.0.0.1:4000/projects/{id} -d '{"name": "Updated Project Name"}'
----

==== 5. Delete Project

[source,sh]
----
curl -X DELETE http://127.0.0.1:4000/projects/{id}
----

=== Log Management API

==== TOC

* <<1-create-logs-bulk,1. Create Logs (Bulk)>>
* <<2-list-logs,2. List Logs>>
* <<3-delete-logs,3. Delete Logs>>

==== 1. Create Logs (Bulk)

[source,sh]
----
curl -X POST http://127.0.0.1:4000/logs -d '[{"time": 1615760000, "level": "info", "message": "this is a test log", "subject": "test", "user_id": "1", "project_id": "1"}]'
----

==== 2. List Logs

[source,sh]
----
curl http://127.0.0.1:4000/logs?project_id=1
----

Or you add more query params to filter the logs

[source,sh]
----
curl http://127.0.0.1:4000/logs?project_id=1&user_id=1&log_level=info&start_time=1615760000&end_time=1615760000
----

==== 3. Delete Logs

[source,sh]
----
curl -X DELETE http://127.0.0.1:4000/logs?project_id=1
----

Or you can add more query params to filter the logs

[source,sh]
----
curl -X DELETE http://127.0.0.1:4000/logs?project_id=1&user_id=2
----