Creating a plant via WS API?

If you see tons of errors in your web log - this is me :slight_smile:

I am trying to create a new point via WS API

POST /api/points
“name”: “Fooo”,
“x”: 4,
“y”: 5,
“z”: 6,
“pointer_type”: “ToolSlot”

my headers are
self.headers = {‘Accept’: ‘application/json, text/plain, /’,
‘Authorization’: ‘{}’.format(api_token),
‘Content-Type’: “application/json;charset=UTF-8”}

Server always returns 500 error.

IMHO I tried all possible combinations, added removed headers

  • GET works
  • PUT works
  • POST - > 500 error

What is funny: POST from your WebApp works (I checked via developer tools)

I must be missing something, but I can’t figure out what.

Thank you

Here’s a python example:

import os
import requests
import json

token = 'my_token'
plant = {'pointer_type': 'Plant', 'x': 100, 'y': 200}

headers = {'Authorization': 'Bearer ' + token,
           'content-type': "application/json"}
data = json.dumps(plant)
response ='',
                         headers=headers, data=data)
new_plant = response.json()

Thanks a lot! Was a stupid mistake on my end.

FAIL: response = + endpoint, headers=self.headers, json=json.dumps(data))
WORKS: response = + endpoint, headers=self.headers, data=json.dumps(data))