Discussions

Ask a Question

BadRequest when trying to post attendance record

Hello, I am trying to post multiple attendance records for an employee using the personio api. But I always get a BadRequest error in the response. I tried the exact same post body example with attendances in my code but still all I get in the response is "please enter attendances". This is how I execute and create the request: // Post new slots var request = new RestRequest("company/attendances?", Method.Post); request.AddHeader("accept", "application/json"); request.AddHeader("content-type", "application/json"); request.AddHeader("authorization", personioToken); request.AddParameter("attendances", Attendance.TimeSlot.getJsonPost(toPost.ToArray(), pEmpId), ParameterType.RequestBody); var response = client.Execute(request); personioToken = extractToken(response); This is how I build the attendances value as JsonFormat from my TimeSlot object: public static string getJsonPost(TimeSlot[] timeSlots, int pEmpId) { string jsonFormat = ""; jsonFormat += "{\"attendances\":["; foreach (TimeSlot timeSlot in timeSlots) { jsonFormat += "{" + "\"employee\":" + pEmpId + ",\"date\":\"" + timeSlot.date.ToString("yyyy-MM-dd") + "\",\"start_time\":\"" + timeSlot.start_time.ToString("HH:MM") + "\",\"end_time\":\"" + timeSlot.end_time.Value.ToString("HH:MM") + "\",\"break\":" + timeSlot.getTotalMinBreak() + ",\"project_id\": null" + ",\"comment\":\"" + timeSlot.comment + "\"" + "}"; if (timeSlot != timeSlots.Last()) jsonFormat += ","; } jsonFormat += "]}"; return jsonFormat; }
ANSWERED

How do I create a new time-off entry via API (POST company/time-offs)?

Hello, I'd like to create a new time-off entry. In your API Reference I can't find a POST body example. Can you please provide the POST body example. Thanks a lot.
ANSWERED

How to assign and specify a universal ID to custom and standard attributes

Hello, how do I specify the universal ID? In the example "Employees API: Universal ID is now exposed" it looks as you can define the ID. Seems not to be composed of the label field "dynamic_153804": { "label": "Address, postcode", "value": "", "type": "standard", "universal_id": "postcode" }, Is there a way to replace then dynamic ID by the universal ID when working with the REST API? Consider a scenario where you need to convert JSON into XML for further processing. At the moment you'd get the XML node <dynamic_153804> ... The XML would be a lot easier to read/process if the node name would just be the uinversal_id <postcode> Thanks
ANSWERED

Getting historical values from work_schedule

Hello, Personio Team. I would like to ask you to help me with a following question: I need to get a historical values of "work_schedule", thought the API at this /company/employees endpoint I receive only the current value, so I wonder if there is a chance to get the previous values too. Regards, Andrii Mazur
ANSWERED

422 error /v1/company/documents

I'm using the following code: curl --location --request POST 'https://api.personio.de/v1/company/documents?employee_id=*myEmployeeID*&category_id=*myCategoryID*&title=test2' \ --header 'Authorization: Bearer *myBearerToken*' \ --form '[email protected]"/opt/PCDOCS/dochousetest/aufgaben/2022/08/24/1043_783.pdf"' I'm getting the following error response: {"success":false,"error":{"message":"The given data was invalid.","code":0,"error_data":{"file":["The file must be a file of type: pdf, docx, doc, jpg, zip, png, txt, jpeg, odt, xlsx, rtf, htm, xls, p7s, pptx, pages, rar, ppt, gif, tif, html, msg, eml, asc, tiff, wps, bmp, 7z, csv, ics, vcf, dotx, numbers, eps, gz, ods, otf, odp, odg, rtfd, txz, webarchive, xml, xps, md, fax, asice."]} What am I missing?
ANSWERED

Retrieving holidays from API?

I have seen that this question was asked before, https://developer.personio.de/discuss/614c152c9abde6004d49b0bc Are there any updates? Thanks in advance!
ANSWERED

422 error /v1/recruiting/applications/documents

Hey, I am trying to add a pdf file via api https://api.personio.de/v1/recruiting/applications/documents . And every other time I get this status "Something is wrong with the request body or the attachments" . Can you tell me what validations the file goes through for such an error?
ANSWERED

Get Updated Employees only from AP

Hi Personio, thank you for creating awesome solution and api docs PROBLEM: If i Query /company/employees I get the entire list of employees, But what about only UPDATED employees from certain date? Basically if would be very helpful if we can filter on last_modified_at similar filter directly in the query for "updated_from" in /company/attendances https://developer.personio.de/reference/get_company-attendances STEPS: 1. Query /company/employees 2. Get entire employees list 3. What If I only want updated employees?
ANSWERED

Call custom endpoint when data is created in Persio

Hello, is it possible to let call a certain endpoint when data is created, modified, deleted, ... in Persio? E. g. we want to react with our own software process if an employee creates an absence.
ANSWERED

encoding of Special Characters

Hello Personio Team. Im currently struggling with Encoding / Special Characters using the Patch API Endpoint with Powershell. Since every Patch API Call requires firstname / lastname (why though? shouldn't be Employee ID enough) i sometimes have to send special characters like ä ü é etc. what encoding does Personio expect. currently im Using the following code (which works fine as long as firstname and lastname do not use special characters) : $PatchingID = $user.id.value $firstname_required = $user.first_name.value $lastname_required = $user.last_name.value $PatchUri = "https://api.personio.de/v1/company/employees/$($PatchingID)" $body = "{`"employee`":{`"custom_attributes`":{`"dynamic_5345254`":`"Onboarding Teams `& Co`"},`"first_name`":`"$firstname_required`",`"last_name`":`"$lastname_required`"}}" $request2 = invoke-Webrequest -Method 'Patch' -Uri $PatchUri -Header $header -ContentType 'application/json' -Body $body