Difference between revisions of "Groups"

From Advice Local Wiki
Jump to: navigation, search
(Updating a Group)
(Get All Groups)
 
Line 1: Line 1:
 
== Get All Groups ==
 
== Get All Groups ==
Get a list of all the groups created for this partner dashboard.
+
Get a list of all the groups created for this partner dashboard.  The query parameter ?populate=clients will include an array of the clients that belong to this group.  However, it should be noted that the request may become very large as the parent request is obligated to expand the one-to-many relationship.
  
 
=== API Endpoint ===
 
=== API Endpoint ===
 
<syntaxhighlight lang="html">
 
<syntaxhighlight lang="html">
https://p.lssdev.com/legacygroups
+
https://p.lssdev.com/legacygroups?populate=clients
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 11:51, 8 April 2024

Get All Groups

Get a list of all the groups created for this partner dashboard. The query parameter ?populate=clients will include an array of the clients that belong to this group. However, it should be noted that the request may become very large as the parent request is obligated to expand the one-to-many relationship.

API Endpoint

https://p.lssdev.com/legacygroups?populate=clients

Example Request

POST /legacygroups HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json


{"name":"Test Group"}


Example Response

{
    "status": 200,
    "success": true,
    "error": null,
    "data": [
        {
            "partner": 760,
            "id": 1,
            "name": "Test Group",
            "count": 0,
            "createdAt": "2024-04-08T19:41:00.000Z",
            "updatedAt": "2024-04-08T19:41:00.000Z"
        }
    ],
    "total": 1
}

Create a Group

This allows you to start grouping client locations into groups that you manage.

API Endpoint

https://p.lssdev.com/legacygroups

Example Request

POST /legacygroups HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json


{"name":"Test Group"}

"name" is the name of the group you want to create

Example Response

{
    "status": 200,
    "success": true,
    "error": null,
    "data": {
        "name": "Test Group",
        "createdAt": "2024-04-08T19:41:00.474Z",
        "updatedAt": "2024-04-08T19:41:00.474Z",
        "partner": 760
    }
}


Updating a Group

This allows you to update a group or add location ids to a group.

API Endpoint

https://p.lssdev.com/legacygroups

Example Request

POST /legacygroups/:id HTTP/1.1
Host: p.lssdev.com
x-api-token: YOUR_API_KEY
Content-Type: application/json


{"name":"Test Group", "clients": [123456, 234567]
}

"name" is the desired updated name you want to change to "clients" are the ids of the locations you wish to add to this group

Example Response

{
    "status": 200,
    "success": true,
    "error": null,
    "data": {
        "name": "Test Group",
        "createdAt": "2024-04-08T19:41:00.474Z",
        "updatedAt": "2024-04-08T19:41:00.474Z",
        "partner": 760
    }
}