Untitled

 avatar
unknown
plain_text
2 years ago
2.0 kB
5
Indexable
def execute_request(inputData):
    import requests
    import json

    apiKey = 'LBBXstYd6H7fCmMI0v1EFeKALeY+GRU5Gn7opYaG7GY='
    url = 'https://fahr-zeit.europersonal.com/api/public/v1/Bewerbung/Create'

    data = {
        "bewerbung": {
            "BeworbenAls": inputData['beworbenAls'],
            "Mandant": {
                "ObjectUuid": inputData['mandantUuid'],
                "Bezeichnung": inputData['mandantName']
            },
            "Quelle": {
                "ObjectUuid": inputData['quelleUuid'],
                "Bezeichnung": inputData['quelleName']
            },
            "QuelleFreitext": inputData['quelleName'],
            "Stelle": {
                "ObjectUuid": inputData['stelleUuid'],
                "Bezeichnung": inputData['beworbenAls'],
                "MandantUuid": inputData['mandantUuid']
            }
        },
        "mitarbeiter": {
            "Adressen": [
                {
                    "Plz": inputData['plz']
                }
            ],
            "Anrede": {
                "ObjectUuid": inputData['anredeUuid'],
                "Bezeichnung": inputData['anredeBezeichnung']
            },
            "BenutzerdefinierteEigenschaften": [
                {
                    "Name": "WeitereInformationen",
                    "Wert": inputData['weitereInformation']
                }
            ],
            "Email": inputData['email'],
            "Nachname": inputData['nachname'],
            "Telefon": inputData['telefon'],
            "Vorname": inputData['vorname']
        },
        "skills": [],
        "werdegaenge": []
    }

    headers = {
        "X-ApiKey": apiKey,
        "Content-Type": "application/json"
    }

    response = requests.post(url, data=json.dumps(data), headers=headers)

    if response.ok:
        responseData = response.json()
        return {'success': True, 'data': responseData}
    else:
        errorData = response.json()
        return {'success': False, 'error': errorData}
Editor is loading...
Leave a Comment