Users

The User:

Users can manage almost all of their settings and preferences via the API.

The execeptions to this are account deletion, archival, and password reset. These actions must be performed within the Log Harvestor application.

Get by id

Description


Get the user that matches the {id} query parameter.

Parameters


headers

Authorization

string

Required

Description:

Bearer token - JWT

Example:

"Bearer <token>"

params

id

string

Required

Description:

User identifier

Example:

"0f9c0b0b4f0c6b0017f0e3b1"

Responses


Description:

The [user](/docs/api/users) object with populated attributes.


Type:

User object


Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
    _id: "0f9c0b0b4f0c6b0017f0e3b1",
    fname: "Jack",
    lname: "Lumber",
    dname: "Jack Lumber",
    email: "ljack21@logharvestor.com",
    password: "password",
    image: "{image url}",
    phone: "123-456-7890",
    queries: {},
    settings: {},
    role: "demo",
    onboardingStage: "welcome",
    dismissOnboarding: false
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Invalid Role",
    message: "You do not have the required role to access this resource",
    status: 401
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Entity not found",
    message: "Entity not found",
    status: 404
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Internal Server Error",
    message: "Internal Server Error",
    status: 500
}

get

/user/:id

Request

1
2
3
4
curl https://logharvestor.com/api/v1/user/:id \
    -X GET \
    -H 'Authorization: Bearer <token>' \
    

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
    _id: "0f9c0b0b4f0c6b0017f0e3b1",
    fname: "Jack",
    lname: "Lumber",
    dname: "Jack Lumber",
    email: "ljack21@logharvestor.com",
    password: "password",
    image: "{image url}",
    phone: "123-456-7890",
    queries: {},
    settings: {},
    role: "demo",
    onboardingStage: "welcome",
    dismissOnboarding: false
}

Get events

Description


Get all events that the user has triggered. This includes every interaction the user has with the Log Harvestor application or API.

Parameters


headers

Authorization

string

Required

Description:

Bearer token - JWT

Example:

"Bearer <token>"

params

id

string

Required

Description:

User identifier

Example:

"0f9c0b0b4f0c6b0017f0e3b1"

Responses


Description:

An array of {event} object with populated attributes.


Type:

Event object


Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
    _id: "0f9c0b0b4f0c6b0017f0e3b1",
    type: "updated",
    message: "User 0f9c0b0b4f0c6b0017f0e3b1 updated forwarder 0f9c0b0b4f0c6b0017f0e3b1",
    user: "0f9c0b0b4f0c6b0017f0e3b1",
    entity: "0f9c0b0b4f0c6b0017f0e3b1",
    entityType: "Forwarder",
    refs: [
        {
            entity: "0f9c0b0b4f0c6b0017f0e3b1",
            entityType: "Forwarder"
        },
        {
            entity: "0f9c0b0b4f0c6b0017f0e3b1",
            entityType: "Project"
        }
    ]
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Invalid Role",
    message: "You do not have the required role to access this resource",
    status: 401
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Entity not found",
    message: "Entity not found",
    status: 404
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Internal Server Error",
    message: "Internal Server Error",
    status: 500
}

get

/user/:id/events

Request

1
2
3
4
curl https://logharvestor.com/api/v1/user/:id/events \
    -X GET \
    -H 'Authorization: Bearer <token>' \
    

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
    _id: "0f9c0b0b4f0c6b0017f0e3b1",
    type: "updated",
    message: "User 0f9c0b0b4f0c6b0017f0e3b1 updated forwarder 0f9c0b0b4f0c6b0017f0e3b1",
    user: "0f9c0b0b4f0c6b0017f0e3b1",
    entity: "0f9c0b0b4f0c6b0017f0e3b1",
    entityType: "Forwarder",
    refs: [
        {
            entity: "0f9c0b0b4f0c6b0017f0e3b1",
            entityType: "Forwarder"
        },
        {
            entity: "0f9c0b0b4f0c6b0017f0e3b1",
            entityType: "Project"
        }
    ]
}

Update

Description


Update a user.

Parameters


headers

Authorization

string

Required

Description:

Bearer token - JWT

Example:

"Bearer <token>"

params

id

string

Required

Description:

User identifier

Example:

"0f9c0b0b4f0c6b0017f0e3b1"

body

email

string

Required

Description:

User email

Example:

"ljack21@logharvestor.com"

fname

string

Required

Description:

User first name

Example:

"Jack"

lname

string

Required

Description:

User last name

Example:

"Lumber"

dname

string

Required

Description:

User display name

Example:

"Jack Lumber"

image

string

Description:

User image

Example:

"{image url}"

phone

string

Description:

User phone

Example:

"123-456-7890"

Responses


Description:

The updated [user](/docs/api/users) object with populated attributes.


Type:

User object


Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
    _id: "0f9c0b0b4f0c6b0017f0e3b1",
    fname: "Jack",
    lname: "Lumber",
    dname: "Jack Lumber",
    email: "ljack21@logharvestor.com",
    password: "password",
    image: "{image url}",
    phone: "123-456-7890",
    queries: {},
    settings: {},
    role: "demo",
    onboardingStage: "welcome",
    dismissOnboarding: false
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Invalid Role",
    message: "You do not have the required role to access this resource",
    status: 401
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Entity not found",
    message: "Entity not found",
    status: 404
}

Type:

Error object


Example:

1
2
3
4
5
{
    name: "Internal Server Error",
    message: "Internal Server Error",
    status: 500
}

put

/user/:id

Request

1
2
3
4
5
curl https://logharvestor.com/api/v1/user/:id \
    -X PUT \
    -H 'Authorization: Bearer <token>' \
    -H 'Content-Type: application/json' \
	--data-raw '{"email":"\"ljack21@logharvestor.com\"","fname":"\"Jack\"","lname":"\"Lumber\"","dname":"\"Jack Lumber\"","image":"\"{image url}\"","phone":"\"123-456-7890\""}'

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
    _id: "0f9c0b0b4f0c6b0017f0e3b1",
    fname: "Jack",
    lname: "Lumber",
    dname: "Jack Lumber",
    email: "ljack21@logharvestor.com",
    password: "password",
    image: "{image url}",
    phone: "123-456-7890",
    queries: {},
    settings: {},
    role: "demo",
    onboardingStage: "welcome",
    dismissOnboarding: false
}

Log_Harvestor_Icon

Join our newsletter

support@logharvestor.com

Copyright © Log Harvestor 2023TermsPrivacy