Interesting : It works when I run it locally on the server…. But not from my windows client.  Some difference in how windows handles quotes maybe?

 

C:\Users\rb99mrs.RIKSBYGGEN>curl -u admin:password http://observium.riksbyggen.intra/api/v0/devices/ -H "Content-Type: application/json" -X POST -d '{"hostname":"papp01-exo"}'

Hostname Required

 

hsb@papp01-mon:/opt/observium# curl -u admin:password http://observium.riksbyggen.intra/api/v0/devices/ -H "Content-Type: application/json" -X POST -d'{"hostname":"papp01-exo"}'

{"status":"ok","device_id":810}

 

From: observium [mailto:observium-bounces@observium.org] On Behalf Of Adam Armstrong via observium
Sent: 09 November 2018 18:40
To: Jason Lixfeld via observium
Cc: Adam Armstrong
Subject: Re: [Observium] problem with api

 

That first example definitely doesn't return "hostname required", though the others all *should*, because they don't have a hostname.

 

The first example works fine for me if provided with a valid hostname:

 

root@zeta:/home/observium/dev# curl -u derp:derp http://dev.observium.org/api/v0/devices/ -H "Content-Type: application/json" -X POST -d '{"hostname":"<derp>"}'

{"status":"ok","device_id":773}

root@zeta:/home/observium/dev#

 

adam.

 

On 2018-11-09 16:00:06, Rowlands Mark via observium <observium@observium.org> wrote:

Version Information
Observium
18.11.9580 (9th November 2018)
OS
Linux 4.4.0-116-generic [amd64] (Ubuntu 16.04)
Apache
2.4.18 (Ubuntu)
PHP
7.0.32-0ubuntu0.16.04.1 (OPcache: ENABLED)
Python
2.7.12
MySQL
10.3.10-MariaDB-1:10.3.10+maria~xenial-log (extension: mysqli 5.0.12-dev)
SNMP
NET-SNMP 5.7.3
RRDtool
1.5.5 (rrdcached 1.5.5: unix:/var/run/rrdcached.sock)
Fping
3.13 (IPv4 and IPv6)

Trying to add a device :-

I have tried the following incantations :-

curl -u admin:PASSWORD http://observium.riksbyggen.intra/api/v0/devices/ -H "Content-Type: application/json" -X POST -d '{"hostname":"papp01-exo"}'

curl -u admin:PASSWORD http://observium.riksbyggen.intra/api/v0/devices/ -H "Content-Type: application/json" -X POST -d '{"papp01-exo":"localhost"}'

curl -u admin:PASSWORD http://observium.riksbyggen.intra/api/v0/devices/ -H "Content-Type: application/json" -X POST -d '{"papp01-exo":"observium.riksbyggen.intra"}'

curl -u admin:POSSWORD http://observium.riksbyggen.intra/api/v0/devices/ -H "Content-Type: application/json" -X POST -d '{'papp01-exo':'observium'}'

all of which return "Hostname Required"


_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium