WWW-Suffit-API

 view release on metacpan or  search on metacpan

lib/WWW/Suffit/Server/API/User.pm  view on Meta::CPAN

      "username": "test"
    }

=head2 PUT /api/user

Edit user's data

    # curl -v -H "Authorization: OWL eyJh...04qI" \
      -X PUT -d '{
        "name": "Test User",
        "email": "test@owl.localhost",
        "role": "Test user",
        "comment": "Test user for internal testing only"
      }' \
      https://owl.localhost:8695/api/user

    > PUT /api/user HTTP/1.1
    > Host: owl.localhost:8695
    > User-Agent: curl/7.68.0
    > Accept: */*
    > Authorization: OWL eyJh...04qI
    > Content-Length: 163
    > Content-Type: application/x-www-form-urlencoded
    >
    < HTTP/1.1 200 OK
    < Content-Length: 148
    < Server: OWL/1.00
    < Date: Mon, 15 May 2023 11:25:11 GMT
    < Content-Type: application/json;charset=UTF-8
    <
    {
      "comment": "Test user for internal testing only",
      "email": "test@owl.localhost",
      "name": "Test User",
      "role": "Test user",
      "status": true,
      "username": "test"
    }

=head2 POST /api/user/genkeys

Issue (generation) RSA keys pair (public and private RSA keys) for user

    # curl -v -X POST -H "Authorization: OWL eyJh...R_0c" \
      https://owl.localhost:8695/api/user/genkeys

    > POST /api/user/genkeys HTTP/1.1
    > Host: owl.localhost:8695
    > User-Agent: curl/7.68.0
    > Accept: */*
    > Authorization: OWL eyJh...R_0c
    >
    < HTTP/1.1 200 OK
    < Date: Fri, 12 May 2023 06:31:21 GMT
    < Server: OWL/1.00
    < Content-Type: application/json;charset=UTF-8
    < Content-Length: 1228
    <
    {
      "error": "",
      "private_key": "-----BEGIN RSA PRIVATE KEY-----...",
      "public_key": "-----BEGIN RSA PUBLIC KEY-----",
      "status": true
    }

=head2 PATCH /api/user/passwd

Change password for user

    # curl -v -H "Authorization: OWL eyJh...Bh7g" \
      -X PATCH -d '{
        "current": "currentPassword",
        "password": "newPassword"
      }' \
      https://owl.localhost:8695/api/user/passwd

    > PATCH /api/user/passwd HTTP/1.1
    > Host: owl.localhost:8695
    > User-Agent: curl/7.68.0
    > Accept: */*
    > Authorization: OWL eyJh...04qI
    > Content-Length: 64
    > Content-Type: application/x-www-form-urlencoded
    >
    < HTTP/1.1 200 OK
    < Server: OWL/1.00
    < Content-Type: application/json;charset=UTF-8
    < Content-Length: 30
    < Date: Mon, 15 May 2023 11:36:50 GMT
    <
    {
      "code": "E0000",
      "status": true
    }

=head2 DELETE /api/user/token/JTI

Removes specified token from list of tokens for user of current session

    # curl -v -X DELETE -H "Authorization: OWL eyJh...04qI" \
      https://owl.localhost:8695/api/user/token/SqpHCfCS2646efd7

    > DELETE /api/user/token/SqpHCfCS2646efd7 HTTP/1.1
    > Host: owl.localhost:8695
    > User-Agent: curl/7.68.0
    > Accept: */*
    > Authorization: OWL eyJh...04qI
    >
    < HTTP/1.1 200 OK
    < Server: OWL/1.00
    < Content-Type: application/json;charset=UTF-8
    < Content-Length: 30
    < Date: Mon, 15 May 2023 11:11:35 GMT
    <
    {
      "code": "E0000",
      "status": true
    }

=head2 GET /api/user/token



( run in 1.340 second using v1.01-cache-2.11-cpan-39bf76dae61 )