Hi there,
is there someone, who can help me out with a hint. I am trying to send a HTTP POST Request to an API from within openHAB. The result should be an Access-Token, that I need to send another POST to control a device.
Within Postmaster I am able to send the Request with:
{{url}}/api/authorize/access_token
and get a JSON-Response.
Postmaster translates it into:
curl --location --request POST 'http://192.168.20.21/api/authorize/access_token' \
--header 'Cookie: PHPSESSID=7gpadbudr9fk0ft16s3mlrfu25' \
--form 'client_id=NbgigQlMFZQ4eMqTpI0w0WPmZ6wW9z1IcLThTVlM' \
--form 'client_secret=6et0YuL28BSnd3Xyin820CejFqn2wRsVTP7QnQtw6mqykKvrMRHuFaWKMQxR2EbS0PNWHmEFKd9hmMErYN23Q5V06691RjWb2mq8mD0xnaU5bS6VwbdWjN4imSkBQKWDdmiuPGS214DhqAXkrjiXXkGKcRVLiTDXyGt93TjTqU3mN3Da485n92u60rR7LJnMf1BOex2Ke4S6Euu0TyIRyf0aGw4W72khAPsKookzEfYXijoXBbW57XvH3HnC2L' \
--form 'grant_type=client_credentials'
The result is:
{
"access_token": "saCWin2vMjithNaRL9VUZF6iO3kfkHpsxJiYfQdP",
"token_type": "Bearer",
"expires_in": 3600
}
I have frankly no idea where to go from here. Is it possible, do send a header with the HTTP-Binding? Can I do this with a sendHttpPostRequest?
Help would be very much appreciated!
Regards,
Nikolaus\