Share Coding

Tutorials, Problems, Stuffs …

Tag Archives: request

Refresh global variable by request

To renew a global variable such as a token, it is possible to do it by “Tests” function.

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("token", jsonData.access_token);

The code should be in “Tests”.

  "access_token": "780fe237-b0c0-45fa-8fde-e856206f0fce",
  "token_type": "bearer",
  "refresh_token": "bac7223d-68a0-4c5a-ae6b-62071dcb187c",
  "expires_in": 6695,
  "scope": "read write"

The JSON respond body.

After you click send button, the global variable “token” will update it’s value with “access_token”.


Cross Domain Request on GWT without RPC

Since RequestBuilder do not support cross domain on GWT, the other option will be JsonpRequestBuilder
Here is an example between client and server (PHP).

JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
jsonp.requestObject(URL.encode("http://serverurl/Server.php?callback=test_clbk"), new AsyncCallback() {
	public void onFailure(Throwable throwable) {
	public void onSuccess(JSONreceiver result) {

Read more of this post