[Rock-dev] REST interface not working ?

Steffen Planthaber Steffen.Planthaber at dfki.de
Thu Aug 20 13:09:59 CEST 2015


Hi,

It seems like the curl parser is now checking the content before 
sending. Actually the syntax to send data is a tiny bit different from 
what /sample gives you, the "value" needs to be without "" and followed 
yb =, this was done to be able to switch to a GET action for commands.

Sadly this is NOT a valis JSON format (JSON starts after "value=") and 
curl denies sending it. Leaving out the content type paramater and using 
"value=" will lead to the expected results.

curl -X POST -d 'value={"translation":0,"rotation":1}' 
http://localhost:9292/api/tasks/tasks/localhost/simple_controller/ports/motion_command/write

There is a (VERY basic) implementation for using the restAPI from cpp here:
https://github.com/planthaber/control-webapp/

A better one is under development.

Best, Steffen




Am 20.08.2015 um 09:28 schrieb Martin Schröer:
> No, that didn't do the trick unfortunately.
>
> [Had tested it already, sorry for not mentioning.]
>
>> Steffen Planthaber <Steffen.Planthaber at dfki.de> hat am 19. August 2015
>> um 16:23 geschrieben:
>>
>>
>> Hi,
>>
>> Could be the parser has trouble with the e notation.
>>
>> Please try:
>>
>> # curl -X POST -H "Content-Type: application/json" -d
>> > '{"value":{"translation":0,"rotation":0}}'
>> >
>> http://192.168.10.10:9292/api/tasks/tasks/localhost/skid4_control/ports/motion_command/write
>>
>>
>>
>>
>> Am 19.08.2015 um 15:31 schrieb Martin Schroeer:
>> > Hi there.
>> >
>> > I'm trying to use the REST interface of an ASGUARD to have it moving
>> around.
>> > Querying the interface for a input sample
>> >
>> > # curl
>> >
>> http:/192.168.10.10:9292/api/tasks/tasks/localhost/skid4_control/ports/motion_command/sample
>> >
>> > gives me
>> >
>> > {"value":{"translation":5.3281e-316,"rotation":6.934147e-310}}
>> >
>> > But if I try to write this very sample like
>> >
>> > # curl -X POST -H "Content-Type: application/json" -d
>> > '{"value":{"translation":5.3281e-316,"rotation":6.934147e-310}}'
>> >
>> http://192.168.10.10:9292/api/tasks/tasks/localhost/skid4_control/ports/motion_command/write
>> >
>> > it just gives me
>> >
>> > {"error":"malformed JSON string: #<Hashie::Mash
>> > rotation=6.934147e-310 translation=5.3281e-316>"}
>> >
>> > What am I doing wrong here ?
>> >
>> >
>> > Regards,
>> > Martin
>> >
>>
>>
>> --
>> Steffen Planthaber
>> Weltraumrobotik
>>
>> Besuchsadresse der Nebengeschäftstelle:
>> DFKI GmbH
>> Robotics Innovation Center
>> Robert-Hooke-Straße 5
>> 28359 Bremen, Germany
>>
>> Postadresse der Hauptgeschäftsstelle Standort Bremen:
>> DFKI GmbH
>> Robotics Innovation Center
>> Robert-Hooke-Straße 1
>> 28359 Bremen, Germany
>>
>> Tel.: +49 421 178 45-4125
>> Zentrale: +49 421 178 45-0
>> Fax: +49 421 178 45-4150 (Faxe bitte namentlich kennzeichnen)
>> E-Mail: Steffen.Planthaber at dfki.de
>>
>> Weitere Informationen: http://www.dfki.de/robotik
>> -----------------------------------------------------------------------
>> Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
>> Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
>> Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
>> (Vorsitzender) Dr. Walter Olthoff
>> Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
>> Amtsgericht Kaiserslautern, HRB 2313
>> Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
>> USt-Id.Nr.: DE 148646973
>> Steuernummer: 19/673/0060/3
>> -----------------------------------------------------------------------
>>
>> _______________________________________________
>> Rock-dev mailing list
>> Rock-dev at dfki.de
>> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev
>>


-- 
  Steffen Planthaber
  Weltraumrobotik

  Besuchsadresse der Nebengeschäftstelle:
  DFKI GmbH
  Robotics Innovation Center
  Robert-Hooke-Straße 5
  28359 Bremen, Germany

  Postadresse der Hauptgeschäftsstelle Standort Bremen:
  DFKI GmbH
  Robotics Innovation Center
  Robert-Hooke-Straße 1
  28359 Bremen, Germany

  Tel.:     +49 421 178 45-4125
  Zentrale: +49 421 178 45-0
  Fax:      +49 421 178 45-4150 (Faxe bitte namentlich kennzeichnen)
  E-Mail:   Steffen.Planthaber at dfki.de

  Weitere Informationen: http://www.dfki.de/robotik
  -----------------------------------------------------------------------
  Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
  Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
  Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
  (Vorsitzender) Dr. Walter Olthoff
  Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
  Amtsgericht Kaiserslautern, HRB 2313
  Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
  USt-Id.Nr.:    DE 148646973
  Steuernummer:  19/673/0060/3
  -----------------------------------------------------------------------



More information about the Rock-dev mailing list