GoliathDevelopersGet an API key
Reference/Accountgenerated from the gateway manifest

getMyProfile

Fetch the key owner's own profile.

POST/api/v1/callREADreadruns as the key's owner
View as Markdown

Fetch the key owner's own profile (id, name, email, phone number (personal, via updateMyProfile; lines: listCommunicationChannels), profile picture URL) plus WHO THEY ARE IN THE ORGANIZATION and WHICH CLOCK THEY READ ON. organizationRole is their role (ADMIN | MEMBER): every ADMIN-scoped operation requires the key owner to be an ADMIN, so CHECK THIS BEFORE attempting one and, when it is not ADMIN, say that a team admin has to do it instead of relaying a refusal. organizationMembershipStatus is ACTIVE or SUSPENDED. organization carries the org's id, name and its own timezone (null = never set, NOT UTC). timezone is the zone the key owner CHOSE (null = never chosen, again not UTC); resolvedTimezone is the zone their times are ACTUALLY rendered on after the fallbacks (their availability schedule, then the organization's): use resolvedTimezone whenever you state or interpret a time for them, and never assume UTC from a null. Permissions are a separate read: getMyCapabilities. Read it before updateMyProfile.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "getMyProfile",
    "variables": {}
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.account.getMyProfile()
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    operationId: 'getMyProfile',
    variables: {}
  }),
})
const { data, errors } = await res.json()

Variables

None. Send "variables": {}.

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "currentUser": {
      "id": "<ID>",
      "firstName": "…",
      "lastName": "…",
      "email": "…",
      "phoneNumber": "…",
      "profilePictureUrl": "…",
      "organizationRole": "ADMIN",
      "organizationMembershipStatus": "ACTIVE",
      "timezone": "…",
      "resolvedTimezone": "…",
      "organization": {
        "id": "<ID>",
        "name": "…",
        "timezone": "…"
      }
    }
  }
}

Errors

Behaviour

A read. It rejects an Idempotency-Key header with 400 bad_request.