Untitled

 avatar
unknown
plain_text
2 years ago
1.8 kB
5
Indexable
import requests
import json

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

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

headers = {
    "X-ApiKey": apiKey
}

requests.post('http://example.com/example/asdfas', files={'bewerbung': (None, data)}, headers=headers)

if response.ok:
    responseData = response.json()
    output = {'success': True, 'data': responseData}
else:
    errorData = response.json()
    output = {'success': False, 'error': errorData}

return output
Editor is loading...
Leave a Comment