zeroonea
Posts: 0
Joined: Sun Jun 03, 2012 8:29 am

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

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

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

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/...

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

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

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

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

Hi, Katya.

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

Thx.

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

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

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!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

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

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

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

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

Where exactly are these located?

Return to “Issues”