InstantIO und die REST Api

Chakky

Member of Honour
Hallo HaBo,

ich experimentiere zur Zeit mit InstantIO rum. In der neuesten Version davon gibt es endlich zugriff auf einen RESTApi. Das heist InstantIO stellt für jedes angeschlossen Device informationen über den Browser bereit als JSON.

Jetzt hab ich das Problem das ich wenn auf einzeln Informationen wie zum Bsp
auf den Port des Webservers zugreifen will keine Antwort bekomme.

Also Bsp:

http://localhost:31338/InstantIO/element/Web/Port liefert mir ein JSON zurück
Code:
{
  "name": "Port",
  "type": "string",
  "length": 1,
  "cardinality": "single",
  "input": [ "string" ],
  "output": [ "string" ]
}
Laut Tutorial von instantreality 1.0 - tutorial - Accessing hardware in InstantIO via REST from X3DOM

Soll man jetzt mit
http://localhost:31338/InstantIO/element/Web/Port.string

auf den Port zugreifen können. Wäre in meinen Fall die 31338.
Bekomme aber keinerlei Antwort vom Server bzw keine Ausgabe.

Google Chrome schneidet mir folgende Header mit:

Code:
Request URL:http://localhost:31338/InstantIO/element/Web/Port.string
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Cookie:_pk_id.4.1fff=e7b435a4b2b1c129.1366718810.2.1377712750.1366718810.; PHPSESSID=n9b1lr3n0ohffps8ifergdc403; _pk_id.2.1fff=fe174039972c8ed5.1365769934.40.1382111002.1382108696.
DNT:1
Host:localhost:31338
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36

Erst hab ich gedacht liegt am Browser, hab mir dann schnell ein PHP Script zusammengeschrieben/zusammengesucht das auch ein JSON abfragen soll:

PHP:
$url = "http://localhost:31338/InstantIO/element/Web/Port.string";
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_HEADER, true);

// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
//curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/json'));
// Execute
$result=curl_exec($ch);

// Will dump a beauty json :3
var_dump(json_decode($result, true));

Da bekomme ich beim Aufruf nur folgende Ausgabe
"NULL"

kann mir jmd auf die Sprünge helfen?

In den Tutorial steht auch noch folgende Zeile mit der ich nix anfangen kann:
By using the input or output type as additioal mimetype in the HTTP query, you can access the value, in this case the value of Port, in a given format: http://localhost:12345/InstantIO/element/web/Port.string.

Heist das ich muss einen Mimetype mitschicken? Wenn ja welchen?

Danke für eure Hilfe!
 
Zurück
Oben