pls help me with calculating api_sig. I have working URL request from here (www.flickr.com/services/api/explore/flickr.photosets.getP...).
I'm trying recalculate api_sig by myself. I'm generating md5 hash from this string:
"api_key071da8bd47cc06715f12e139
auth_token7215764931-65136290ea10d4b6
formatrest
methodflickr.photosets.getPhotosphoto
set_id7215924989144"
I don't know what should i use like [secret code]. Is it secret API key or is it "secret" from photoset? Or is it something else?
My string for md5 hash is:
"[secret]
api_key071da63edd47cc06715f12e139
auth_token757925931-65136290ea10d4b6
formatrestmethodflickr.photosets.getPhotos
photoset_id721746989144"
What am I doing wrong? I am getting different hash.
Thank you in advance for your advice and please excuse my English.
You should remove the whitespaces from the string i.e. you should just generate a md5-string from this: "api_key071da8bd47cc06715f12e139auth_token7215764931-65136290ea10d4b6formatrestmethodflickr.photosets.getPhotosphotoset_id7215924989144". And then use that as the api_sig parameter.
Here are the steps: https://www.flickr.com/services/api/auth.spec.html#signing
Related
The following GET request passes
#GET("api/v1/shades/colors?color=bl")
Call<List<Colors>> getColors();
but the following GET request fails.
#GET("api/v1/shades/colors?color={colorId}")
Call<List<Colors>> getColors(#Path(StringConstants.COLOR_ID) String colorId);
What's the right way to pass a dynamic value to a GET request?
Thank you!
It seems like you are using JaxRS web application. You should use this :
#GET("api/v1/shades/colors")
Call<List<Colors>> getColors(#Query("color") String colorId);
Check this: https://docs.oracle.com/javaee/6/tutorial/doc/gilik.html and this: https://mkyong.com/webservices/jax-rs/jax-rs-queryparam-example/.
Hope it helps !
Use annotation #RequestParam:
#GET("api/v1/shades/colors")
Call<List<Colors>> getColors(#RequestParam String colorId);
I am trying to retrieve data from cloudSearch, searching for the word "Person" and adding the following filter:
(prefix field=claimedgalleryid '')
The problem is that I don't know how to create the URL using that exact filter.
Could someone give me a suggestion or some link to Amazon documentation related to this topic?
What I've tried and didn't work:
...search?q=Gallerist&size=10&start=0&fq=(prefix%20field=claimedgalleryid%20%27%27)
...search?q=Gallerist&size=10&start=0&filter=(prefix%20field=claimedgalleryid%20%27%27)
You were close with your first attempt--it looks like you forgot to URI encode the = sign as %3D. Try this instead:
&fq=(prefix+field%3Dclaimedgalleryid+'')
I highly recommend using the "test search" feature to work out the kinks in your query syntax. You can see the results right there, and then use the "View Raw: JSON" link to copy the full request URL and see how characters get escaped and such.
I've noticed that when i send a url like this:
http://localhost:3000/register/register_user/?sig=zaQ/876CwJMEEmrJqAOYHyEKBXy2s03NDmk+3FsXPr4=
what comes through when I use it to compare to the expected result using params[:sig] in the controller is this:
zaQ/876CwJMEEmrJqAOYHyEKBXy2s03NDmk 3FsXPr4=
For some reason the '+' sign that was in the url at the 9th character from the end of the string has been converted to a space.
Not sure why that happens, whether it only happens with + signs or what.
The result returned by Digest::SHA256.base64digest(data) has this plus sign so my validation of the signature is failing.
What's the best way to fix this? Will it suffice in the general case just to convert '+' signs into spaces before the comparison or is the re some less ugly way to address?
You'll need to url encode it. Either do a search and replace for + with %2B or force the encoding using open-uri.
require 'cgi'
sig = "zaQ/876CwJMEEmrJqAOYHyEKBXy2s03NDmk+3FsXPr4="
puts CGI.escape(sig)
Tested it this time.
irb(main):008:0> require 'cgi'
=> true
irb(main):009:0> CGI.escape('zaQ/876CwJMEEmrJqAOYHyEKBXy2s03NDmk+3FsXPr4=')
=> "zaQ%2F876CwJMEEmrJqAOYHyEKBXy2s03NDmk%2B3FsXPr4%3D"
irb(main):010:0>
I have been beating my head against the wall with this one. The url must contain \r\n at the end or the device I am connecting to will not recognise it. I did not create the device so I can't go in and change what it is looking for. I also can not use the percent values for them either. When I create the URL from a string the URL becomes nil because it does not like the \r\n. I have searched on here all day. Literally and have come up with nothing. If anyone has a suggestion please let me know. I would really appreciate it.
Edit.. The url is #"http://192.168.1.1/link.html?cmd=scan\r\n"
I was able to figure out another way in so I did not have to send the string like that. Thank for the help.
Try this:
NSLog(#"http://192.168.1.1/link.html?cmd=scan\\r\\n");
OutPut:
http://192.168.1.1/link.html?cmd=scan\r\n
You have to skip the "\" with just putting another "\".
I've published a different take on a log in system on CodeProject ( http://www.codeproject.com/KB/aspnet/mlogin.aspx ) and I've got some free time, so I thought I'd have a look at password recovery/reset.
It was suggested on the article that I look into sending the account owner a single use, random url where they can reset their password if the account gets locked because of too many invalid login attempts/forgotten password.
Can anyone provide some guidance to help me to do this?
So far, I'm thinking I just have to generate a random string in a "recovery" field in the database table for the user's row and then check if the requested URL on the site is the same as the value for that field, then dynamically draw the page server-side.
Am I thinking on the right track here, or way off the mark?
Thanks in advance!
You're on the right track. Rather than a random string, a GUID is sufficient (uniqueidentifier field in SQL). Use the "d" format so the URL doesn't have curly braces:
MyUser.RecoveryKey = Guid.NewGuid()
Dim EmailBody As String = "http://blah/recoverpass.aspx?key=" & _
MyUser.RecoveryKey.ToString("D");