Hi All,
I’m trying to set up a REST connection with a company’s API. With Postman I have this Authorization call working without any problems. But now I’m trying to add this in HomeAssistant as a restfull call but I’m facing some issues with the payload (I think).
The call in postman looks like this in cURL and is working without a problem:
curl --location --request POST 'https://api.interact-lighting.com/oauth/accesstoken' \ --header 'Authorization: Basic asdlfijaslfjsa;ljf;lasjf;ljsaef' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'app_key=key1' \ --data-urlencode 'app_secret=secret1' \ --data-urlencode 'service=officeCloud'
I have this in HA:
``
- platform: rest
resource: https://api.interact-lighting.com/oauth/accesstoken
name: iacloudtoken
#value_template: ‘{{value_json.token}}’
scan_interval: 3400
method: POST
payload: ‘{“app_key”: “key1”, “app_secret”: “secret1”, “service”: “officeCloud”}’
authentication: basic
username: username
password: password
timeout: 20
headers:
Content-Type: application/x-www-form-urlencoded
Content-Length: 4800
User-Agent: PostmanRuntime/7.26.5
``
My response in HA: {“fault”:{“faultstring”:“Invalid client identifier {0}”,“detail”:{“errorcode”:“oauth.v2.InvalidClientIdentifier”}}}.
As far I see and compare with Postman something is wrong in my payload. Because if I play a bit with my payload in Postman I get the same response.
Hopefully someone can support a bit?