0

I am playing with REST services in qooxdoo and I have seen that there is a experimental class http://manual.qooxdoo.org/1.6/pages/communication/rest.html

that allows to create easily the communication but I cannot find any example for the followings :

  1. how do I pass the payload (json) to a put/post request?
  2. how do I pass arguments in the url like www.example.com/customers?arg1=20

thanks in advice.

1 Answers1

0

The documentation of the 1.6 does not explain too but the documentation of 2.0 gives some clues ...

declare the specifics

var customers = new qx.io.rest.Resource({
  create: {
   method: "POST",
   url: "/customers"
  });

to put/post a payload :

costumers.create({   "surname": "none",
                    "name": "none",
                    "email": "someone@example.com",
                    "description": "nothing",
                    "address": "Southpole"
});

To pass arguments in the url :

declare the specifics

var customers = new qx.io.rest.Resource({
  get: {
   method: "GET",
   url: "/customers?{args}"
  });

and when calling

var arguments = "arg1=10&arg2=10";
customers.get({arg:arguments});
// this will geneterate the following http://example.com/customers?agr1=10&arg2=10