Skip to content

Latest commit

 

History

History
512 lines (409 loc) · 16 KB

UsersApi.md

File metadata and controls

512 lines (409 loc) · 16 KB

FireflyIIINet.Api.UsersApi

All URIs are relative to https://demo.firefly-iii.org/api

Method HTTP request Description
DeleteUser DELETE /v1/users/{id} Delete a user.
GetUser GET /v1/users/{id} Get a single user.
ListUser GET /v1/users List all users.
StoreUser POST /v1/users Store a new user
UpdateUser PUT /v1/users/{id} Update an existing user's information.

DeleteUser

void DeleteUser (string id, Guid? xTraceId = null)

Delete a user.

Delete a user. You cannot delete the user you're authenticated with. This cannot be undone. Be careful!

Example

using System.Collections.Generic;
using System.Diagnostics;
using FireflyIIINet.Api;
using FireflyIIINet.Client;
using FireflyIIINet.Model;

namespace Example
{
    public class DeleteUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://demo.firefly-iii.org/api";
            // Configure OAuth2 access token for authorization: firefly_iii_auth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UsersApi(config);
            var id = 123;  // string | The user ID.
            var xTraceId = "xTraceId_example";  // Guid? | Unique identifier associated with this request. (optional) 

            try
            {
                // Delete a user.
                apiInstance.DeleteUser(id, xTraceId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UsersApi.DeleteUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete a user.
    apiInstance.DeleteUserWithHttpInfo(id, xTraceId);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling UsersApi.DeleteUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The user ID.
xTraceId Guid? Unique identifier associated with this request. [optional]

Return type

void (empty response body)

Authorization

firefly_iii_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 User deleted. -
401 Unauthenticated -
404 Page not found -
400 Bad request -
500 Internal exception -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetUser

UserSingle GetUser (string id, Guid? xTraceId = null)

Get a single user.

Gets all info of a single user.

Example

using System.Collections.Generic;
using System.Diagnostics;
using FireflyIIINet.Api;
using FireflyIIINet.Client;
using FireflyIIINet.Model;

namespace Example
{
    public class GetUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://demo.firefly-iii.org/api";
            // Configure OAuth2 access token for authorization: firefly_iii_auth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UsersApi(config);
            var id = 123;  // string | The user ID.
            var xTraceId = "xTraceId_example";  // Guid? | Unique identifier associated with this request. (optional) 

            try
            {
                // Get a single user.
                UserSingle result = apiInstance.GetUser(id, xTraceId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UsersApi.GetUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get a single user.
    ApiResponse<UserSingle> response = apiInstance.GetUserWithHttpInfo(id, xTraceId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling UsersApi.GetUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The user ID.
xTraceId Guid? Unique identifier associated with this request. [optional]

Return type

UserSingle

Authorization

firefly_iii_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.api+json, application/json

HTTP response details

Status code Description Response headers
200 The requested user. -
401 Unauthenticated -
404 Page not found -
400 Bad request -
500 Internal exception -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListUser

UserArray ListUser (Guid? xTraceId = null, int? page = null)

List all users.

List all the users in this instance of Firefly III.

Example

using System.Collections.Generic;
using System.Diagnostics;
using FireflyIIINet.Api;
using FireflyIIINet.Client;
using FireflyIIINet.Model;

namespace Example
{
    public class ListUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://demo.firefly-iii.org/api";
            // Configure OAuth2 access token for authorization: firefly_iii_auth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UsersApi(config);
            var xTraceId = "xTraceId_example";  // Guid? | Unique identifier associated with this request. (optional) 
            var page = 1;  // int? | The page number, if necessary. The default pagination is 50, so 50 users per page. (optional) 

            try
            {
                // List all users.
                UserArray result = apiInstance.ListUser(xTraceId, page);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UsersApi.ListUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the ListUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // List all users.
    ApiResponse<UserArray> response = apiInstance.ListUserWithHttpInfo(xTraceId, page);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling UsersApi.ListUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
xTraceId Guid? Unique identifier associated with this request. [optional]
page int? The page number, if necessary. The default pagination is 50, so 50 users per page. [optional]

Return type

UserArray

Authorization

firefly_iii_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.api+json, application/json

HTTP response details

Status code Description Response headers
200 A list of users. -
401 Unauthenticated -
404 Page not found -
400 Bad request -
500 Internal exception -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

StoreUser

UserSingle StoreUser (User user, Guid? xTraceId = null)

Store a new user

Creates a new user. The data required can be submitted as a JSON body or as a list of parameters. The user will be given a random password, which they can reset using the "forgot password" function.

Example

using System.Collections.Generic;
using System.Diagnostics;
using FireflyIIINet.Api;
using FireflyIIINet.Client;
using FireflyIIINet.Model;

namespace Example
{
    public class StoreUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://demo.firefly-iii.org/api";
            // Configure OAuth2 access token for authorization: firefly_iii_auth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UsersApi(config);
            var user = new User(); // User | JSON array or key=value pairs with the necessary user information. See the model for the exact specifications.
            var xTraceId = "xTraceId_example";  // Guid? | Unique identifier associated with this request. (optional) 

            try
            {
                // Store a new user
                UserSingle result = apiInstance.StoreUser(user, xTraceId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UsersApi.StoreUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the StoreUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Store a new user
    ApiResponse<UserSingle> response = apiInstance.StoreUserWithHttpInfo(user, xTraceId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling UsersApi.StoreUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
user User JSON array or key=value pairs with the necessary user information. See the model for the exact specifications.
xTraceId Guid? Unique identifier associated with this request. [optional]

Return type

UserSingle

Authorization

firefly_iii_auth

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json, application/vnd.api+json

HTTP response details

Status code Description Response headers
401 Unauthenticated -
404 Page not found -
400 Bad request -
500 Internal exception -
200 New user stored, result in response. -
422 Validation error. The body will have the exact details. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateUser

UserSingle UpdateUser (string id, User user, Guid? xTraceId = null)

Update an existing user's information.

Update existing user.

Example

using System.Collections.Generic;
using System.Diagnostics;
using FireflyIIINet.Api;
using FireflyIIINet.Client;
using FireflyIIINet.Model;

namespace Example
{
    public class UpdateUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://demo.firefly-iii.org/api";
            // Configure OAuth2 access token for authorization: firefly_iii_auth
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new UsersApi(config);
            var id = 123;  // string | The user ID.
            var user = new User(); // User | JSON array with updated user information. See the model for the exact specifications.
            var xTraceId = "xTraceId_example";  // Guid? | Unique identifier associated with this request. (optional) 

            try
            {
                // Update an existing user's information.
                UserSingle result = apiInstance.UpdateUser(id, user, xTraceId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling UsersApi.UpdateUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update an existing user's information.
    ApiResponse<UserSingle> response = apiInstance.UpdateUserWithHttpInfo(id, user, xTraceId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling UsersApi.UpdateUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The user ID.
user User JSON array with updated user information. See the model for the exact specifications.
xTraceId Guid? Unique identifier associated with this request. [optional]

Return type

UserSingle

Authorization

firefly_iii_auth

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/vnd.api+json, application/json

HTTP response details

Status code Description Response headers
200 Updated user stored, result in response -
422 Validation error. The body will have the exact details. -
401 Unauthenticated -
404 Page not found -
400 Bad request -
500 Internal exception -

[Back to top] [Back to API list] [Back to Model list] [Back to README]