A bunch of issues and observations while working with REST services towards, stackmob, which need oAuth.
1)
I need to contact a REST URL on stackmob which looks like
Code: Select all
[url=http://lala/user/username]http://lala/user/username[/url]
where is a parameter
I have tried following http://help.gotiggr.com/documentation... that tells me to write
Code: Select all
[url=http://lala/user/{username}]http://lala/user/{username}[/url]
[actually it tells me to use {id}]
It is kind of sporadic what happens:
o {username} never seems to be expanded.
o {id} seems to be expanded, but not always. I have had success with it, but after trying to reproduce the non-success with {username}, it does not work at all, when setting it back to {id}.
o there seems be a difference in the behaviour when tiggzi proxy is used and when not. When {id} expansion worked it appeared only to work when not using the proxy.
o when id is a parameter and referenced in the url (in the cases when the expansion works), it is also added as a parameter (?id=...) which is not intended. This can be ducked by making id a header parameter.
o when not using tiggzi proxy oAuth Authentication headers are not added, as they are when using the proxy.
2) In https://getsatisfaction.com/tiggzi/to...
you mention an alternative solution which is using {url}, and then getting the entire URL from localStorage. Why do you have two such replacements (suspect it is javascript/jquery shining through here), and could you expand on it?
5)
Since stackmod uses oAuth 1.0 I need to capture the {username} (or {id} parameter in the javascript that generates the Authorization header (as shown in your example). I cannot find a way to do that (so I just read it from localStorage which is where it is gotten from anyway). Is there a smart way to get it with javascript without using localStorage?
6) in the oAuth, authorization header javascript I dynamically assemble the URL with the parameters that will be appended:
...
var username = localStorage.getItem("username");
urlPart="http://api.mob1.stackmob.com/person/"...;
url = urlPart+"?"
+ "_expand=3";
// possible a lot more parameters from a form on the page
console.log("preAuth URL: " + url);
return getAuth("GET", url);
...
Is there an easier way to do that? Perhaps we can get the full URL directly from the service, after it has been assembled?