Just like in the application, it is possible to split employees' work across cost centers via the REST API as well. In this article, you'll find the endpoints for both records, their fields, and examples of import and export.
Calling method
There are two available records, both accessible via the methods GET, POST, and PUT:
Address | Purpose |
| Regular work for cost centers — share of a shift within a given period |
| Work for cost centers in a specific month — number of hours |
Where {firma} is the database company identifier. A complete description of both records can be found at /prace and /prace-mesic. When retrieving data using the GET method, the supported output formats XML, JSON, and others are available.
Record fields
Shared fields
osoba— identification of the person from HR records. It doesn't need to be specified, as it is automatically filled in based on the given employment relationship.pracPom— identification of the employment relationshipstredisko— identification of the cost centerzakazka— identification of the ordercinnost— identification of the activitypoznam— note
Only in the prace record
datumOdanddatumDo— the period for which the work for the cost center appliesprocento— the portion of the shift allocated to the cost center, a decimal number ranging from 0 to 100
Only in the prace-mesic record
rokandmesic— the period for which the hours are reportedhodin— the number of hours worked for the cost center, a decimal number
Parameters
To download data from the records, you can use standard filtering and detail levels. Data import has no parameters; however, you can use external identifiers during import.
💡 First, try the import with the ?dry-run=true parameter. The request will be validated, but nothing will be written to the database.
Import example
In this example, an employee works 30% of their shifts in 2024 on a specific order for cost center C.
First, you need to identify the employment relationship to which the work for the cost center is linked — using either the ID or an external identifier. You can get the list of employment relationships for a given person using the GET method:
GET https://demo.flexibee.eu/c/demo/pracovni-pomer/(osoba="code:U123021").xml?detail=custom:id,kod
You then use the obtained ID when saving the work for the cost center:
POST https://demo.flexibee.eu/c/demo/prace.xml
<winstrom version="1.0">
<prace>
<!-- Externí identifikátor -->
<id>ext:MZDSW:123</id>
<!-- Datum začátku práce pro středisko -->
<datumOd>2024-01-01</datumOd>
<!-- Datum konce práce pro středisko -->
<datumDo>2024-12-31</datumDo>
<!-- % část směny alokovaná na středisko -->
<procento>30.0</procento>
<!-- Identifikace osoby z personalistiky, nepovinná -->
<osoba>code:U123021</osoba>
<!-- Identifikace pracovního poměru pomocí ID -->
<pracPom>1</pracPom>
<!-- Identifikace střediska -->
<stredisko>code:C</stredisko>
<!-- Identifikace zakázky -->
<zakazka>code:ZAKAZKA0821</zakazka>
<!-- Identifikace činnosti -->
<cinnost>code:A123</cinnost>
</prace>
</winstrom>
Similarly in JSON:
{
"winstrom": {
"prace": {
"id": "ext:MZDSW:123",
"datumOd": "2024-01-01",
"datumDo": "2024-12-31",
"procento": "30.0",
"osoba": "code:U123021",
"pracPom": "1",
"stredisko": "code:C",
"zakazka": "code:ZAKAZKA0821",
"cinnost": "code:A123"
}
}
}
Work for a cost center in a specific month is imported in a similar way. In this example, the employee worked 22 hours for cost center C on a specific order in December 2024.
POST https://demo.flexibee.eu/c/demo/prace-mesic.xml
<winstrom version="1.0">
<prace-mesic>
<id>ext:MZDSW:123</id>
<rok>2024</rok>
<mesic>12</mesic>
<hodin>22.0</hodin>
<osoba>code:U123021</osoba>
<pracPom>1</pracPom>
<stredisko>code:C</stredisko>
<zakazka>code:ZAKAZKA0821</zakazka>
<cinnost/>
</prace-mesic>
</winstrom>
Similarly in JSON:
{
"winstrom": {
"prace-mesic": {
"id": "ext:MZDSW:123",
"rok": "2024",
"mesic": "12",
"hodin": "22.0",
"osoba": "code:U123021",
"pracPom": "1",
"stredisko": "code:C",
"zakazka": "code:ZAKAZKA0821",
"cinnost": ""
}
}
}
Export example
Data can be retrieved using the GET method with any filter and detail level:
GET https://demo.flexibee.eu/c/demo/prace-mesic/(rok eq 2024).xml?detail=full
Result of the call:
<winstrom version="1.0">
<prace-mesic>
<id>ext:MZDSW:123</id>
<id>8</id>
<lastUpdate>2024-12-29T09:53:24.433+01:00</lastUpdate>
<rok>2024</rok>
<mesic>12</mesic>
<hodin>22.0</hodin>
<poznam/>
<osoba showAs="U123021: Jméno Zaměstnance">5</osoba>
<pracPom showAs="1-STANDARD: Standardní pracovní poměr">code:1-STANDARD</pracPom>
<stredisko showAs="C: Centrála">code:C</stredisko>
<zakazka showAs="ZAKAZKA0821: Přeprava 08/24">code:ZAKAZKA0821</zakazka>
<cinnost/>
</prace-mesic>
</winstrom>
Examples of invalid calls
On successful import, the HTTP status 200 or 201 is returned, along with a standard response containing the results. If the call is invalid, the status 400 is returned, and the response body contains a description of the error.
1. Invalid employment relationship
<error for="pracPom" path="prace[temporary-id=null].pracPom" value="code:1-STANDARAD" code="PROP" messageCode="notObjectIdentifier">Zadaný text 'code:1-STANDARAD' musí identifikovat objekt [PraceStred -1]</error>
2. Working time fund exceeded
<error path="prace[temporary-id=null].procento" code="INVALID" for="procento">V některém období je rozděleno víc než sto procent fondu pracovní doby. [PraceStred -1]</error>
3. Missing required field
<error>Pole 'Měsíc' musí být vyplněno. [ext:MZDSW:123]</error>
4. Inconsistent identification of employment relationship and person
<error>Definovaná osoba (U123021: Jméno Zaměstnance) se liší od osoby pracovního poměru (KN0329231: Jiné Jméno). [ext:MZDSW:AC]</error>
FAQ
Where can I find the breakdown of work by cost center for a given employee?
In individual liabilities or internal documents generated from payroll (social insurance and others), the document items will be broken down according to the relevant cost centers.
How are cost centers used in the application?
You can find an explanation in the articles Cost centers and their use and Payroll - work for cost centers.
