There are some postings on this but it does not work for me yet:
I am trying to contact an external API via HTTP POST to get a token back.
It already works with python. But we wanna integrate the workflow in fme server and Iam sure it will work with fme.
Python script:
# Parameter_____
base_url = 'https://apieco.eco-counter-tools.com'
api_key = 'XXX' # Base64 encoded secrets
# Tokenabruf
def get_token(url, api_key):
header = {
'Content-Type':'application/x-www-form-urlencoded',
'Authorization': 'Basic ' + api_key
}
r = requests.post(url + "/token", headers= header, data={'grant_type': 'client_credentials'})
answer = json.loads(r.text)
token = answerd'access_token']
return token
HTTPCaller:
Erorr Message:
HTTP/1.1 415 Unsupported Media Type
Which mime type should I use for the grant_type: client_credentials?