1861809

API Basic(json) - create HW item

Discussion created by 1861809 on Oct 14, 2015
Latest reply on Oct 16, 2015 by Chris Walls
HI Im, starting to get to grips with the samanage API and have now successfully created something that can query data[1].  I am now trying to add data and struggling.  Im trying to add a HW item and from the documentation[2] the only thing needed is the name and the ssn.  I am assuming the ssn that is required is the one present in the bio array as i dont see any other ssn values available.  With that in mind i created a small script available here

https://gist.github.com/b4ldr/d4bf9a1b703deff6edf7

However when i run this i get a http 400 error as show below

```
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.samanage.comDEBUG:requests.packages.urllib3.connectionpool:"POST /hardwares.json HTTP/1.1" 401 None
DEBUG:requests.packages.urllib3.connectionpool:"POST /hardwares.json HTTP/1.1" 400 38
{"status":"400","error":"Bad Request"}
```

Any pointers appreciated



[1]https://github.com/b4ldr/samanage
[2]https://www.samanage.com/api/hardware/

Outcomes