bmc_hub/tests/api.http

179 lines
3.5 KiB
Plaintext
Raw Permalink Normal View History

# BMC Hub — REST Client Test Requests
# Requires VS Code extension: "REST Client" (humao.rest-client)
# Usage: Click "Send Request" above any ### block
#
# Set your base URL and auth cookie below
# @baseUrl = http://localhost:8001
@baseUrl = http://172.16.31.183:8001
# Paste a valid session cookie from browser DevTools (Network tab → any API call → Cookie header)
@authCookie = session=YOUR_SESSION_COOKIE_HERE
###
# 1. Health check
GET {{baseUrl}}/health
###
# 2. System info
GET {{baseUrl}}/api/v1/system/health
Cookie: {{authCookie}}
###
# 3. List AnyDesk sessions (all or filtered)
GET {{baseUrl}}/api/v1/anydesk/sessions
Cookie: {{authCookie}}
###
# 4. List AnyDesk sessions for specific sag
GET {{baseUrl}}/api/v1/anydesk/sessions?sag_id=53
Cookie: {{authCookie}}
###
# 5. Start AnyDesk session (dry-run by default)
POST {{baseUrl}}/api/v1/anydesk/start-session
Cookie: {{authCookie}}
Content-Type: application/json
{
"sag_id": 53,
"contact_id": null,
"customer_id": null
}
###
# 5b. Assign AnyDesk session to sag
PATCH {{baseUrl}}/api/v1/anydesk/sessions/1
Cookie: {{authCookie}}
Content-Type: application/json
{
"sag_id": 53
}
###
# 5c. End AnyDesk session
POST {{baseUrl}}/api/v1/anydesk/sessions/1/end
Cookie: {{authCookie}}
###
# 5d. Get session details
GET {{baseUrl}}/api/v1/anydesk/sessions/1
Cookie: {{authCookie}}
###
# 5e. Pull live session log from AnyDesk API (requires dry_run=false in settings)
# Uses HMAC-SHA1 auth against https://v1.api.anydesk.com:8081/sessions
POST {{baseUrl}}/api/v1/anydesk/fetch-from-api?days=30&limit=1000
Cookie: {{authCookie}}
###
# 5f. Pull log for last 90 days
POST {{baseUrl}}/api/v1/anydesk/fetch-from-api?days=90&limit=1000
Cookie: {{authCookie}}
###
# 5g. AnyDesk health / config status
GET {{baseUrl}}/api/v1/anydesk/health
Cookie: {{authCookie}}
###
# 6. Create sag (case)
POST {{baseUrl}}/api/v1/sag
Cookie: {{authCookie}}
Content-Type: application/json
{
"titel": "Test sag fra REST client",
"customer_id": 1,
"status": "åben"
}
###
# 7. Update sag title (PATCH)
PATCH {{baseUrl}}/api/v1/sag/53
Cookie: {{authCookie}}
Content-Type: application/json
{
"titel": "Opdateret sagsoverskrift"
}
###
# 8. Set deadline on sag
PATCH {{baseUrl}}/api/v1/sag/53
Cookie: {{authCookie}}
Content-Type: application/json
{
"deadline": "2026-04-30"
}
###
# 9. List time entries for a sag
GET {{baseUrl}}/api/v1/timetracking/time?sag_id=53
Cookie: {{authCookie}}
###
# 10. Start live timer
POST {{baseUrl}}/api/v1/timetracking/time/start
Cookie: {{authCookie}}
Content-Type: application/json
{
"sag_id": 53,
"description": "Test timer fra REST client"
}
###
# 11. Stop live timer
POST {{baseUrl}}/api/v1/timetracking/time/stop
Cookie: {{authCookie}}
Content-Type: application/json
{
"sag_id": 53
}
###
# 12. Create manual time entry
POST {{baseUrl}}/api/v1/timetracking/time/manual
Cookie: {{authCookie}}
Content-Type: application/json
{
"sag_id": 53,
"faktisk_tid_min": 30,
"description": "Manuel registrering fra REST client",
"worked_date": "2026-03-27"
}
###
# 13. List call history
GET {{baseUrl}}/api/v1/telefoni/calls?limit=20
Cookie: {{authCookie}}
###
# 14. Link call to sag
PATCH {{baseUrl}}/api/v1/telefoni/calls/1
Cookie: {{authCookie}}
Content-Type: application/json
{
"sag_id": 53
}
###
# 15. Search contacts (partial name)
GET {{baseUrl}}/api/v1/search/contacts?q=Martin
Cookie: {{authCookie}}
###
# 16. Hardware by contact
GET {{baseUrl}}/api/v1/hardware/by-contact/1
Cookie: {{authCookie}}
###
# 17. Timetracking wizard - stats
GET {{baseUrl}}/api/v1/timetracking/wizard/stats
Cookie: {{authCookie}}