Skip to content

Groups

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

http://locafyapi.com/legacygroups?populate=clients

Example Request

POST /legacygroups HTTP/1.1
Host: locafyapi.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

http://locafyapi.com/legacygroups

Example Request

POST /legacygroups HTTP/1.1
Host: locafyapi.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

http://locafyapi.com/legacygroups

Example Request

POST /legacygroups/:id HTTP/1.1
Host: locafyapi.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
    }
}