Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96123

RestAPI, Bad Request

$
0
0

@wjaceh wrote:

Hi,

I’m trying to send some text to conversation integration over RestAPI (at the moment using python script), but I’m getting “400: Bad Request”.

import requests
import json

url = 'http://192.168.50.21:8123/api/services/conversation/process'
headers = {
    'Authorization': 'Bearer my_long_lived_token',
    'content-type': 'application/json'
    }
payload = {
    'service_data':{
        "text": "Turn all lights on"
        }
    }

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.text)
print(response.status_code)


Can anyone spot the mistake?
PS: I’m quite new to coding so the whole thing might be misunderstood from my side.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 96123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>