Page 1 of 2

How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jun 19, 2012 7:17 am
by zeroonea

I have a var was stored in localStorage. I want to use it as value of a Request Parameter of RestService. How I should do this?


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jun 19, 2012 12:42 pm
by maxkatz

If you want to invoke localStorage.getItem then you can write a JavaScript function in mapping. Or, you can map it directly from local storage.

http://help.tiggzi.com/documentation/...

http://help.tiggzi.com/documentation/...


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 8:52 am
by Joseph Yeung

Hi, Max.

Can the two links above be renewed? They don't work anymore.

Also, I was thinking if that (this topic) was a use case of Generic Service?

Thx.


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 10:22 am
by Kateryna Grynko

Hello,
you can find new Tiggzi documentation on http://docs.tiggzi.com


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 10:40 am
by Joseph Yeung

Hi, Katya.

So, setting a Generic Service can also achieve the same thing?

Thx.


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 11:19 am
by Joseph Yeung

Hmm...

Back to the point that "to invoke localStorage.getItem then you can write a JavaScript function", can I put loop in the custom javascript section of the request parameter concerned? Like:

precode
var i = 0

for (var i in localStorage){

var value = localStorage.getItem (localStorage);
return '{'+value+'}';

i++;
}

/code/pre

Cheers!


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 1:16 pm
by Kateryna Grynko

You can generate the only value via JavaScript.
You can write separate JS code for each request parameter.


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 2:28 pm
by Joseph Yeung

Hi thanks for replying.

I need to put all the content of the local storage (the image below) that has been saved in the Tiggzi Database on a button click.

Image

How can I do that programatically? Should I create Generic Service (like Max has referred to in https://getsatisfaction.com/tiggzi/to...?

Thankj you.


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 3:12 pm
by Kateryna Grynko

To execute data source with custom request parameters values use next JavaScript code:
codedatasource1.execute({'data': {
'count': 12
}
});/code
This example shows how to add "count" request parameter to rest service call.

To add all localStorage variable use next code:
codedatasource1.execute({'data':localStorage});/code
Please replace "datasource1" with DataSource component name on "Data" tab.


How to use a localStorage.getItem in Request Parameters of Rest Service?

Posted: Tue Jan 22, 2013 3:50 pm
by Joseph Yeung

Sorry, but what do you mean by "DataSource component name on "Data" tab"?

Where exactly are these located?