The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
So I need to create an API connection to Personio (a company Human Resource tool), where I obtain specific data about employees.
I have a Client-ID for that API, as well as a API-Secret (which I assume is the API Key). Also, I have done some minor previous work with API connection to Jira and NewRelic, both methods dont work here.
A reason for this is what a developer told me, that first an authentication needs to take place, before the data can be requested. Meaning that there is 2 different enpoints which need to connected to according to the Personio documentation.
I have listed their POSTMAN information below of how the authentication runs and then the custom attribute endpoint.
I need to get that data into PowerBI somehow and would truly appreciate any help here. I have already gone through the forums to test various answers on API connections, but no success.
Thank you to anyone who can help here!
Personio POSTMAN Documentation:
"item": [
{
"name": "Authentication",
"item": [
{
"name": "Auth Endpoint",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var data = pm.response.json();",
"var token = data.data.token;",
"",
"if (token) {",
" pm.environment.set(\"authToken\", token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [],
"url": {
"raw": "https://api.personio.de/v1/auth?client_id=XXXXX&client_secret=XXXXX",
"protocol": "https",
"host": [
"api",
"personio",
"de"
],
"path": [
"v1",
"auth"
],
"query": [
{
"key": "client_id",
"value": "XXXXX"
},
{
"key": "client_secret",
"value": "XXXXX"
}
]
}
},
"response": []
}
]
"name": "Get All Custom Attributes",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var authHeader = pm.response.headers.get(\"authorization\");",
"",
"if (authHeader) {",
" pm.environment.set(\"authToken\", authHeader.substring(7));",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://api.personio.de/v1/company/employees/custom-attributes",
"protocol": "https",
"host": [
"api",
"personio",
"de"
],
"path": [
"v1",
"company",
"employees",
"custom-attributes"
]
}
},
"response": []
},
{
"name": "Get All Attributes",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var authHeader = pm.response.headers.get(\"authorization\");",
"",
"if (authHeader) {",
" pm.environment.set(\"authToken\", authHeader.substring(7));",
"}"
],
"type": "text/javascript"
}
}
]
Personio Documentation can be found here:
raw.githubusercontent.com/personio/api-docs/master/Personio - Public API Collection.postman_collecti...
Hi @Anonymous ,
Please try:
let
GetAccessToken = () =>
let
url = "https://api.personio.de/v1/auth",
body = Text.ToBinary("{""client_id"":""YOUR_CLIENT_ID"",""client_secret"":""YOUR_API_SECRET""}"),
headers = [#"Content-Type" = "application/json"],
response = Json.Document(Web.Contents(url, [Headers=headers, Content=body])),
token = response[access_token]
in
token,
FetchData = () =>
let
accessToken = GetAccessToken(),
url = "https://api.personio.de/v1/custom-attributes",
headers = [#"Authorization" = "Bearer " & accessToken],
response = Json.Document(Web.Contents(url, [Headers=headers]))
in
response,
// Call the FetchData function to retrieve the data
Source = FetchData()
in
Source
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
That definitely gets me further than before. I used "Anonymous" as credential option to connect, but still got the following error: (red marking is the API secret)