Skip to content

Latest commit

 

History

History
71 lines (51 loc) · 1.59 KB

README.md

File metadata and controls

71 lines (51 loc) · 1.59 KB

Running the service

uvicorn main:app --reload

Simulate tool authentication

  1. Generate JWT token

python test_jwt.py

  1. Authenticate

curl -X POST "http://127.0.0.1:8000/" -H "Content-Type: application/x-www-form-urlencoded" -d "token=YOUR_JWT_TOKEN"

Testing with curl

  1. Get Metadata

curl -X GET "http://127.0.0.1:8000/metadata" -H "Authorization: Bearer mysecureapikey"

  1. Get Quotas

curl -X GET "http://127.0.0.1:8000/quota" -H "Authorization: Bearer mysecureapikey"

  1. Update Quotas
curl -X PUT "http://127.0.0.1:8000/quota" -H "Authorization: Bearer mysecureapikey" -H "Content-Type: application/json" -d '
[
    {
        "limit": 100,
        "scope": "total"
    },
    {
        "limit": 100,
        "scope": "user"
    },
    {
        "limit": 500,
        "scope": "user",
        "feature": "gpt-3"
    }
]'
  1. Get Course Quota

curl -X GET "http://127.0.0.1:8000/quota/course/course-123" -H "Authorization: Bearer mysecureapikey"

  1. Update Course Quota
curl -X PUT "http://127.0.0.1:8000/quota/course/course-123" -H "Authorization: Bearer mysecureapikey" -H "Content-Type: application/json" -d '
[
    {
        "limit": 100,
        "scope": "course"
    },
    {
        "limit": 10,
        "scope": "course-user"
    }
]'
  1. Get Quota for All Course Members

curl -X GET "http://127.0.0.1:8000/quota/course/course-123/user" -H "Authorization: Bearer mysecureapikey"

  1. Get Quota for a Specific Course Member

curl -X GET "http://127.0.0.1:8000/quota/course/course-123/user/user-456" -H "Authorization: Bearer mysecureapikey"