Search code examples
oauth

How can an Accelo Web Application determine the 'staff ID' of the logged-in user?


Using the 'Web Application' OAuth flow of the Accelo API, where can the 'staff ID' of the logged-in user be found?

The staff ID is used in other requests, such as Activities.

It doesn't appear to be returned as part of the OAuth callback.

Nor do the /tokeninfo and /user endpoints mention it.

There's not even some kind of "whoami" method among the /staff endpoints.


(For the moment, I'm relying on the user to have at least one Timer started. The /timers?_fields=staff endpoint returns only the current user's Timers, and shows the staff ID for each.)

(Also, the application will not be granted write permissions in the scope, so creating a dummy Timer is not possible.)


Solution

  • Thanks to the quick work of the people at Accelo, the staff ID is now available in several endpoints:

    /staff/whoami

    Sample response:

    {
      "meta": {
        "message": "Everything executed as expected.",
        "more_info": "https://affinitylive.jira.com/wiki/display/APIS/Status+Codes#ok",
        "status": "ok"
      },
      "response": {
        "firstname": "Robert",
        "id": "23",
        "surname": "Bell"
      }
    }
    

    /tokeninfo

    Sample response:

    {
      "meta": {
        "message": "Everything executed as expected.",
        "more_info": "https://affinitylive.jira.com/wiki/display/APIS/Status+Codes#ok",
        "status": "ok"
      },
      "response": {
        "deployment": "example",
        "email": "[email protected]",
        "expiry_date": "1412345678",
        "firstname": "Robert",
        "locale": {
          "currency": {
            "symbol": "$"
          },
          "timezone": "Australia/Sydney"
        },
        "staff_id": "23",
        "surname": "Bell"
      }
    }
    

    /user

    Sample response:

    {
      "meta": {
        "message": "Everything executed as expected.",
        "more_info": "https://affinitylive.jira.com/wiki/display/APIS/Status+Codes#ok",
        "status": "ok"
      },
      "response": {
        "email": "[email protected]",
        "fax": "",
        "financial_level": "all",
        "firstname": "Robert",
        "id": "23",
        "locale": {
          "currency": {
            "symbol": "$"
          },
          "timezone": "Australia/Sydney"
        },
        "mobile": "+61234567890",
        "phone": "09 1234 5678",
        "position": "Developer",
        "surname": "Bell",
        "timezone": "Australia/Sydney",
        "title": null,
        "user_access": {
          "account_invoice": {
            "add": 1,
            "admin": 1,
            "dashboard": "",
            "manages": 0,
            "view": 1
          },
          "activity": {
            "add": 1,
            "admin": 1,
            "dashboard": 1,
            "manages": 0,
            "view": 1
          },
          // ...
        },
        "user_titles": {
          "account_invoice": {
            "plural": "Invoices",
            "singular": "Invoice"
          },
          "account_purchase": {
            "plural": "Purchases",
            "singular": "Purchase"
          },
          // ...
        },
        "username": "[email protected]"
      }
    }