Moped Documentation
  • Welcome 👋
  • User Guides
    • Getting started
    • Map a project
  • Product Management
    • User communication
    • User management
    • User analytics
    • Local testing
    • Release process
    • Patch release process
    • MUI X Pro License
    • Integrations
      • Dataset documentation
      • ArcGIS Online
      • eCapris
      • Power BI
    • Features
  • Dev Guides
    • DB Docs & Data dictionary
    • Database backup policy
    • Moped Read Replica
    • How-to's
      • How do I start the Hasura cluster locally?
      • How do I launch the Hasura Console?
      • How do I get a JWT token?
      • How to ping the GraphQL API
      • How to ping the REST API
      • How do I connect a database with Postgres GUIs?
      • How do I connect to the RDS instance?
      • How to load production data into a local instance
      • How do I update seed data?
    • Hasura
      • Hasura Roles
      • Hasura Migrations
        • Getting Started
        • Installing the Hasura CLI
        • Configuration Files
        • Hasura Migration Principles
        • The Migration file format
        • Development
        • Hasura Seed Data
        • Running the Hasura Cluster Locally (video)
        • Create a migration: Exercise 1 (video)
        • Create a migration: Exercise 2 (video)
        • Latest hasura-cluster features
    • User Management
    • Authentication
      • Authentication Architecture
      • DynamoDB & Cognito
      • Secrets Manager & Cognito
      • Hasura & Cognito
      • React & Cognito
      • Flask API & Cognito
      • Single Sign-On with CTM
    • Code organization
    • API
      • Configuration Files
      • Testing
      • User Management API
    • Maps and geospatial data
      • Access tokens and API keys
      • Map libraries
      • Map data
      • Map styles
      • Map layers and basemaps
      • React patterns
      • V1 Archive
        • Map libraries
        • Map data
        • Map custom hooks
        • Map styles
        • Map layers and basemaps
    • UI access control
    • Design system
      • Branding
      • Component styles
      • Text content
    • Activity Log
      • Architecture
      • GitHub Actions and Deployment of Updates
      • Hasura Event Logs and Truncate Cron Job
      • Authentication
  • See also
  • Get Moped support, report a bug, or request an enhancement
  • Data & Technology Services
  • Github repository
Powered by GitBook
On this page
  • Get Users
  • Get User
  • Create User
  • Edit User
  • Delete User
  • Update User Password

Was this helpful?

  1. Dev Guides
  2. API

User Management API

The goal of the user management API is to allow authenticated users with appropriate permissions to manage new and existing users.

PreviousTestingNextMaps and geospatial data

Last updated 4 years ago

Was this helpful?

Get Users

GET /users/

This endpoint allows you to get a list of users.

Headers

Name
Type
Description

Authentication

string

Authentication token from Cognito

[
  {
    "Attributes": [
      {
        "Name": "sub",
        "Value": "<Cognito Username>"
      },
      {
        "Name": "email_verified",
        "Value": "true"
      },
      {
        "Name": "email",
        "Value": "<User email>"
      }
    ],
    "Enabled": true,
    "UserCreateDate": "Fri, 09 Oct 2020 17:39:20 GMT",
    "UserLastModifiedDate": "Fri, 09 Oct 2020 17:39:20 GMT",
    "UserStatus": "CONFIRMED",
    "Username": "<Cognito Username>"
  },
  <Other users>
]
You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.

Get User

GET /users/:id

This endpoint allows you to get a user's details.

Path Parameters

Name
Type
Description

id

string

User Cognito ID

Headers

Name
Type
Description

Authenticaion

string

Authentication token from Cognito

{
  "Enabled": true,
  "ResponseMetadata": {
    "HTTPHeaders": {
      "connection": "keep-alive",
      "content-length": "344",
      "content-type": "application/x-amz-json-1.1",
      "date": "Mon, 12 Oct 2020 16:00:26 GMT",
      "x-amzn-requestid": "b88e891b-a0ec-4e21-bc96-d477eaf13b4e"
    },
    "HTTPStatusCode": 200,
    "RequestId": "b88e891b-a0ec-4e21-bc96-d477eaf13b4e",
    "RetryAttempts": 0
  },
  "UserAttributes": [
    {
      "Name": "sub",
      "Value": "<Cognito Username>"
    },
    {
      "Name": "email_verified",
      "Value": "true"
    },
    {
      "Name": "email",
      "Value": "<User email>"
    }
  ],
  "UserCreateDate": "Wed, 23 Sep 2020 17:37:00 GMT",
  "UserLastModifiedDate": "Wed, 23 Sep 2020 22:01:51 GMT",
  "UserStatus": "CONFIRMED",
  "Username": "<Cognito Username>",
  "x-hasura-allowed-roles": [
    "user", <Other user roles>
  ],
  "x-hasura-default-role": "user",
  "x-hasura-user-id": "<Cognito Username>"
}
You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.

Create User

POST /users/

This endpoint allows you to create a new user. *Requires admin role

Headers

Name
Type
Description

Authentication

string

Authentication token from Cognito

Request Body

Name
Type
Description

date_added

string

An iso date to be provided if you want to override the date the user was created. ISO format: "YYYY-MM-DD HH-MM-SS"

email

string

The users email address. Min. length: 8, max. length: 128

first_name

string

The first name of the user. Only alphanumeric characters, white spaces and hyphens. Min. Length: 1, Max Length: 128

last_name

string

The last name of the user. Only alphanumeric characters, white spaces and hyphens. Min. Length: 1, Max Length: 128

is_coa_staff

boolean

True if the user is part of the City of Austin, False otherwise. If this field is not provided, this is automatically set to True if the email ends with "@austintexas.gov"

status_id

integer

The status of the user, 0 for inactive, 1 for active.

title

string

The job position title of the user.

workgroup

string

The workgroup name. Not empty, min length: 3, max length: 128. Allowed characters: a-z, A-Z, 0-9, and any of these special characters: _-!@%^~?.:&()[]$

workgroup_id

integer

The workgroup_id in the moped_workgroup table in the database.

password

string

The new user's password. Allowed characters: a-z, A-Z, 0-9, and any of these special characters: _-!@%^~?.:&()[]$

roles

array

Array of strings, must be at least one value. It must be at least one of these values: "moped-admin", "moped-editor" or "moped-viewer"

{
  "ResponseMetadata": {
    "HTTPHeaders": {
      "connection": "keep-alive",
      "content-length": "359",
      "content-type": "application/x-amz-json-1.1",
      "date": "Fri, 09 Oct 2020 17:39:20 GMT",
      "x-amzn-requestid": "b6705165-b888-432e-a31b-8af46302fe52"
    },
    "HTTPStatusCode": 200,
    "RequestId": "b6705165-b888-432e-a31b-8af46302fe52",
    "RetryAttempts": 0
  },
  "User": {
    "Attributes": [
      {
        "Name": "sub",
        "Value": "<Cognito Username>"
      },
      {
        "Name": "email_verified",
        "Value": "true"
      },
      {
        "Name": "email",
        "Value": "<User email>"
      }
    ],
    "Enabled": true,
    "UserCreateDate": "Fri, 09 Oct 2020 17:39:20 GMT",
    "UserLastModifiedDate": "Fri, 09 Oct 2020 17:39:20 GMT",
    "UserStatus": "<Cognito Username>",
    "Username": "51bc4a5b-6615-4056-ad0a-e8ae515cb924"
  }
}
{
    "Error": {
        "Code": "UsernameExistsException",
        "Message": "An account with the given email already exists.",
    },
    "ResponseMetadata": {
        "HTTPHeaders": {
            "connection": "keep-alive",
            "content-length": "96",
            "content-type": "application/x-amz-json-1.1",
            "date": "Fri, 09 Oct 2020 16:20:04 GMT",
            "x-amzn-errormessage": "An account with the given email already exists.",
            "x-amzn-errortype": "UsernameExistsException:",
            "x-amzn-requestid": "3fc92761-90a9-4a50-b728-a3a69cab4dc8",
        },
        "HTTPStatusCode": 400,
        "RequestId": "3fc92761-90a9-4a50-b728-a3a69cab4dc8",
        "RetryAttempts": 0,
    },
    "message": "An account with the given email already exists.",
}
You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.

Edit User

PUT /users/:id

This endpoint allows you to create a new user. *Requires admin role

Path Parameters

Name
Type
Description

id

string

Cognito ID (UUID) of the user to be updated.

Headers

Name
Type
Description

Authentication

string

Authentication token from Cognito

Request Body

Name
Type
Description

date_added

string

An iso date to be provided if you want to override the date the user was created. ISO format: "YYYY-MM-DD HH-MM-SS"

email

string

The users email address. Min. length: 8, max. length: 128

first_name

string

The first name of the user. Only alphanumeric characters, white spaces and hyphens. Min. Length: 1, Max Length: 128

last_name

string

The last name of the user. Only alphanumeric characters, white spaces and hyphens. Min. Length: 1, Max Length: 128

is_coa_staff

boolean

True if the user is part of the City of Austin, False otherwise. If this field is not provided, this is automatically set to True if the email ends with "@austintexas.gov"

status_id

integer

The status of the user, 0 for inactive, 1 for active.

title

string

The job position title of the user.

workgroup

string

The workgroup name. Not empty, min length: 3, max length: 128. Allowed characters: a-z, A-Z, 0-9, and any of these special characters: _-!@%^~?.:&()[]$

workgroup_id

integer

The workgroup_id in the moped_workgroup table in the database.

password

string

The new user's password. Allowed characters: a-z, A-Z, 0-9, and any of these special characters: _-!@%^~?.:&()[]$

roles

array

Array of strings, must be at least one value. It must be at least one of these values: "moped-admin", "moped-editor" or "moped-viewer"

Delete User

DELETE /users/:id

This endpoint allows you to delete a user. *Requires admin role

Path Parameters

Name
Type
Description

id

string

User Cognito ID

Headers

Name
Type
Description

Authentication

string

Authentication token from Cognito

{
  "ResponseMetadata": {
    "HTTPHeaders": {
      "connection": "keep-alive",
      "content-length": "0",
      "content-type": "application/x-amz-json-1.1",
      "date": "Fri, 09 Oct 2020 17:25:02 GMT",
      "x-amzn-requestid": "833d74e7-6ad4-47b8-800f-2a279ceb2bbd"
    },
    "HTTPStatusCode": 200,
    "RequestId": "833d74e7-6ad4-47b8-800f-2a279ceb2bbd",
    "RetryAttempts": 0
  }
}
You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.

Update User Password

PUT /users/:id/password

Path Parameters

Name
Type
Description

id

string

User Cognito ID

Headers

Name
Type
Description

Authentication

string

Authentication token from Cognito

Request Body

Name
Type
Description

password

string

The new user's password. Allowed characters: a-z, A-Z, 0-9, and any of these special characters: _-!@%^~?.:&()[]$

{
    "success": {
        "cognito": {
            "ResponseMetadata": {
                "HTTPHeaders": {
                    "connection": "keep-alive",
                    "content-length": "2",
                    "content-type": "application/x-amz-json-1.1",
                    "date": "Fri, 20 Nov 2020 22:54:09 GMT",
                    "x-amzn-requestid": "9580cdab-72ea-4048-a870-2b99bc045300"
                },
                "HTTPStatusCode": 200,
                "RequestId": "9580cdab-72ea-4048-a870-2b99bc045300",
                "RetryAttempts": 0
            }
        },
        "message": "User password updated: <User Cognito ID>"
    }
}
You don't have the permission to access the requrested resource. It is either read-protected or not readable by the server.