Discussions

Ask a Question
Back to All

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