Managing and Creating Users through API

Managing and Creating Users through API" provides developers with detailed instructions on how to create, update, and manage user accounts within a system using API endpoints.

User management is an essential feature of the Fungies.io platform, enabling developers to handle user accounts programmatically. The user-related endpoints allow you to create new users, retrieve user information, update user details, and manage user inventory. These endpoints are designed to simplify user account management by providing necessary features like listing users, modifying their details, and archiving accounts.

To access these endpoints, authentication via API keys is required, you can go through the "Getting Started with the API" guide in which you will learn how you can generate the API-key and write-API-key.

After generating the API-key and write-API key you can immediately start making requests to the Fungies User management API endpoints.

GET /users/list (List All Users)

The /users/list endpoint is used to retrieve a list of all users on the Fungies.io platform. It allows developers to access details of every user in the system, including filtering options based on user creation dates and email.

Note: This endpoint requires an API-key for authentication.

This is a GET API endpoint that accepts the following parameters:

  • email: Filters users by their email address.

  • createdAfter: Returns users created after a specified date.

  • createdBefore: Returns users created before a specified date.

  • page: Specifies which page of the user list you want to retrieve.

  • limit: Defines the maximum number of users to return per page.

Successful Response:

When the request is successful, you will receive a response like this:

{
  "status": "<string>",
  "data": "<string>"
}

Error Response:

If the request fails, you will receive an error response like this:

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

POST /users/create (Create a New User)

The /users/create endpoint allows developers to create a new user in the system by providing the necessary information such as email, password, and username.

Note: This endpoint requires an API-key and write-API key (both) for authentication at the same time.

This is a POST API endpoint that requires the following in the request body:

  • email: The email address of the new user.

  • password: The password for the user account.

  • username: The username for the user.

Successful Response:

When the request is successful, you will receive a response like this:

{
  "status": "<string>",
  "data": "<string>"
}

Error Response:

If the request fails, you will receive an error response like this:

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

GET /users/{userId} (Get User by ID)

The /users/{userId} endpoint is used to retrieve details of a specific user by their unique user ID.

Note: This endpoint requires an API-key for authentication.

This is a GET API endpoint that requires a single parameter:

  • userId: The unique ID of the user you want to retrieve.

Successful Response:

When the request is successful, you will receive a response like this:

{
  "status": "<string>",
  "data": "<string>"
}

Error Response:

If the request fails, you will receive an error response like this:

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

PATCH /users/{userId}/update (Update User Details)

The /users/{userId}/update endpoint allows developers to update a user's details, such as their email or username.

Note: This endpoint requires an API-key and write-API key (both) for authentication at the same time.

This is a PATCH API endpoint that requires a single parameter and request body:

  • userId: The unique ID of the user to update.

  • Request Body:

    email: The updated email address for the user.

    username: The updated username for the user.

Successful Response:

When the request is successful, you will receive a response like this:

{
  "status": "<string>",
  "data": "<string>"
}

Error Response:

If the request fails, you will receive an error response like this:

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

PATCH /users/{userId}/archive (Archive User)

The /users/{userId}/archive endpoint is used to archive a specific user account, effectively deactivating it while preserving its data.

Note: This endpoint requires an API-key and write-API key (both) for authentication at the same time.

This is a PATCH API endpoint that requires a single parameter and request body:

  • userId: The unique ID of the user to archive.

  • Request Body: An object specifying any additional data needed for archiving the user.

Successful Response:

When the request is successful, you will receive a response like this:

{
  "status": "<string>",
  "data": "<string>"
}

Error Response:

If the request fails, you will receive an error response like this:

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

GET /users/{userId}/inventory (Get User Inventory)

The /users/{userId}/inventory endpoint retrieves the inventory of digital products or subscriptions associated with a specific user.

Note: This endpoint requires an API-key for authentication.

This is a GET API endpoint that requires the following parameters:

  • userId: The unique ID of the user whose inventory you want to retrieve.

  • productType: Filters inventory by the type of product. Available options-

    DigitalDownload ,Game ,GiftCard ,SoftwareKey ,VirtualCurrency ,VirtualItem ,Subscription.

  • expiresAfter: Filters items that expire after a specific date.

Successful Response:

When the request is successful, you will receive a response like this:

{
  "status": "<string>",
  "data": "<string>"
}

Error Response:

If the request fails, you will receive an error response like this:

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

Last updated