Get business bags

This endpoint returns all the bags defined at the business level, including the counters considered and the related bags.

GET /api/v1/businesses/{businessId}/bags

If the data provided in the request is correct —businessId—, the response will include a list of bags defined within the business, detailing the following information:

  • id: external identifier of the bag.

  • name: name defined for the bag.

  • defaultStartQuantity: default starting amount for the bag.

  • expiration: expiration period for the bag’s data (in days).

  • dataType: type of data.

  • symbol: symbol associated with the data type.

  • defaultStartDay: default start day of the bag.

  • periodicity: periodicity of the bag.

  • calculationMethod: source of information for calculating the values. It can be based on assignments (ASSIGNMENTS), clockings data (CLOCK_GUARDS) or both (ASSIGNMENTS_AND_CLOCK_GUARDS).

  • positiveCounters: list of counters that positively affect the bag.

  • negativeCounters: list of counters that negatively affect the bag.

  • bagRelationships: list of identifiers of related bags.

Here is an example of the response:

[
    {
        "name": "Worked hours",
        "defaultStartQuantity": 0.0,
        "dataType": "TIME",
        "defaultStartDay": "2022-01-01",
        "periodicity": "YEAR",
        "calculationMethod": "ASSIGNMENTS",
        "positiveCounters": [
            "THM"
        ],
        "negativeCounters": [],
        "bagRelationships": [null]
    },
    {
        "id": "OT",
        "name": "Overtime",
        "defaultStartQuantity": 0.0,
        "dataType": "TIME",
        "defaultStartDay": "2024-01-01",
        "periodicity": "QUARTER",
        "calculationMethod": "ASSIGNMENTS_AND_CLOCK_GUARDS",
        "positiveCounters": [
            "HCM",
            "HNT1M"
        ],
        "negativeCounters": [
            "HNNM"
        ],
        "bagRelationships": []
    },
    {
        "id": "HPY",
        "name": "Holidays from the previous year",
        "defaultStartQuantity": 0.0,
        "dataType": "NUMERIC",
        "defaultStartDay": "2024-01-01",
        "periodicity": "YEAR",
        "calculationMethod": "ASSIGNMENTS_AND_CLOCK_GUARDS",
        "positiveCounters": [],
        "negativeCounters": [],
        "bagRelationships": []
    }
]

The response will include the data defined for each business bag. For example, if the external identifier for a bag has not been set, the request will not return it.

Considerations

If there are no bags for the business indicated in the URL, the request will return an empty array [].

The counters listed in the response are identified by their shortName, which is the abbreviation of the counter in the system.

If any of the related bags (bagRelationships) does not have an external identifier set in the system, the response will display null.

What is a bag?

What is a counter?