Generating a signature and expires in java
-
Hello,
I am developing a tool for my company to get stats from SeoMoz using your API. During development, I have been using the example signature and expires values which are auto-generated for me. Now that testing is complete, my code will need to generate these values. I have been googling looking for a resource demonstrating how to do this using Java, but I have not found a good example. I was hoping that someone at SeoMoz would have a resource or an example that they could share.
The email associated with this account belongs to a non-developer, so if a response is provided via email in addition to the forum, sending it to my email would be much appreciated.
Thank you,
Anthony
-
Never mind, I have come up with a solution:
package com.yourpackage.signature;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;import org.apache.geronimo.mail.util.Base64; //can be whichever flavor of encoder you'd like
public class SignatureGenerator {
public static final String ACCESS_ID = "member-XXXXXXX";
public static final String SECRET_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXx";//expireTime should be in seconds since Jan 1 1970 : new Date().getTime()/1000) + X
public static String generateSignature(String data, String key, String expireTime, String algorithm)
throws InvalidKeyException, NoSuchAlgorithmException, IOException {data += expireTime;
byte[] hmacData = null;
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"),
algorithm);
Mac mac = Mac.getInstance(algorithm);
mac.init(secretKey);
hmacData = mac.doFinal(data.getBytes("UTF-8"));String encoded = new String(Base64.encode(hmacData));
return encoded;
}public static void main(String[] args) {
try {Long longTime = new Long(new Date().getTime()/1000) + 60;
System.out.println(longTime);
String data = ACCESS_ID + "\n";
System.out.println(generateSignature(data, SECRET_KEY, String.valueOf(longTime), "HMACSHA1"));
} catch (Exception e) {
e.printStackTrace();
}}
}
-
There has been no response from SeoMoz on this forum or to my email.
Please provide some feedback. I am afraid If I cannot solve this issue I will be forced to cancel our account as it is not practical for me to manually load the sample signature and expired value on a daily basis.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Internal link is creating duplicate content issues and generating 404s from website crawl.
Not sure what the best way to describe it but the site is built with Elementor page builder. We are finding out that a feature that is included with a pop modal window renders an HTML code as so: Click So when crawled I think the crawling is linking itself for some reason so the crawl returns something like this: xyz.com/builder/listing/ - what we want what we don't want xyz.com/builder/listing/ xyz.com/builder/listing/%23elementor-action%3Aaction%3Dpopup%3Aopen%26settings%3DeyJpZCI6Ijc2MCIsInRvZ2dsZSI6ZmFsc2V9/ xyz.com/builder/listing/%23elementor-action%3Aaction%3Dpopup%3Aopen%26settings%3DeyJpZCI6Ijc2MCIsInRvZ2dsZSI6ZmFsc2V9//%23elementor-action%3Aaction%3Dpopup%3Aopen%26settings%3DeyJpZCI6Ijc2MCIsInRvZ2dsZSI6ZmFsc2V9/ so you'll notice how that string in the HREF is appended each time and it loops a couple times. Could I 301 this issue, what's the best way to go about handling something like this? It's causing duplicate meta descriptions/content errors for some listing pages we have. I did add a rel='nofollow' to the anchor tag with JavaScript but not sure if that'll help.
Technical SEO | | JoseG-LP0 -
Exposure from backlinks for job posting URL. Will soon expire, how best to keep the backlink juice?
Hi All, First post and apologies if this seems obvious. I run a niche jobs board and recently one of our openings was shared online quite heavily after a press release. The exposure has been great but my problem is the URL generated for the job post will soon expire. I was wondering the best way to keep the "link juice" as I can't extend the post indefinitely as the job has been filled. Would a 301 redirect work best in this case? Thanks in advance for the info!
Technical SEO | | MartinAndrew0 -
Good alternatives to Xenu's Link Sleuth and AuditMyPc.com Sitemap Generator
I am working on scraping title tags from websites with 1-5 million pages. Xenu's Link Sleuth seems to be the best option for this, at this point. Sitemap Generator from AuditMyPc.com seems to be working too, but it starts handing up, when a sitemap file, the tools is working on,becomes too large. So basically, the second one looks like it wont be good for websites of this size. I know that Scrapebox can scrape title tags from list of url, but this is not needed, since this comes with both of the above mentioned tools. I know about DeepCrawl.com also, but this one is paid, and it would be very expensive with this amount of pages and websites too (5 million ulrs is $1750 per month, I could get a better deal on multiple websites, but this obvioulsy does not make sense to me, it needs to be free, more or less). Seo Spider from Screaming Frog is not good for large websites. So, in general, what is the best way to work on something like this, also time efficient. Are there any other options for this? Thanks.
Technical SEO | | blrs120 -
CMS Auto Generated Sitemap Work Around?
Hey Moz Community, The Shopify ecommerce platform auto generates xml sitemaps and robots.txt for you. Frustratingly there is no way to augment either of these. If I noindex on a page it will still show up in the site map... Causing inconstancy with the sitemap submitted to GWT. In theory if put the MY version of the sitemap on site and point GWT to MY version.. Would this solve the inconstancy ? Or would Googlebot go in and still crawl the default /sitemap.xml anyway? Any suggestions and insight is greatly appreciated!
Technical SEO | | paul-bold0 -
NoIndex user generated pages?
Hi, I have a site, downorisitjustme (dot) com It has over 30,000 pages in google which have been generated by people searching to check if a specific site is working or not and then possibly adding a link to a msg board to the deeplink of the results page or something which is why the pages have been picked up. Am I best to noindex the res.php page where all the auto generated content is showing up and just have the main static pages as the only ones available to be indexed?
Technical SEO | | Wardy0 -
Best XML Generator for Wordpress?
Hi all, Quick question - does anybody have any recommendations for the best XML sitemap plugin for Wordpress? An idea of why you like it would also be helpful. Thank you very much! Mark
Technical SEO | | markadoi840 -
Non existant URLs being generated in index
Hi all, I have a pretty big problem with my site at the moment which I'm worried will have an impact on my rankings. I've just had a crawl test done and for some reason I get a load of urls returned that don't actually exist... For example I am getting urls like this in my crawl test and xml sitemap: www.applicablejobs.com/jobs/add/android-designer/android-designer/android-designer/android-developer/android-developer/ www.applicablejobs.com/jobs/add/android-designer/android-designer/android-designer/android-developer/iphone-designer/ All the urls seem to start off with www.applicablejobs.com/jobs/ and there is an entry for every conceivable combination of slugs. I can only assume that if the crawl test and an xml sitemap generator is indexing these urls then Google and other search engines probably are too. Does anyone have any idea what might be causing this issue and what can I do to remove them from Googles index if they are? Thanks
Technical SEO | | Benji870 -
Expired traffic and 301 value
Hi Folks, Here is our situation we have an old brand domain www.asia-hotels.com >> that was redirecting to>>www.asiahotels.com By mistake, we let that domain expired and only noticed the drop a month later We lost all our pages and this for several weeks Not sure of the exact date but approximately around 24th of December, what a merry Xmas! 😞 Since then we have repurchased the domain, Put back all the pages as they were and re-instated all the 301 redirect as they were. Since that date we haven't seen any uplift in our visits or visibility score. Did we do something wrong with our 301 redirect? I know for sure we used ISAPI rewrite mod for the non www. domain although I am not entirely sure how the www. version has been handled. Is there something we should do at a DNS level to flag the site is back? Should we presetn a reconsideration request? Any help would be greatly welcomed. Thanks for your help. Cheers, Freddy More info I placed a bit more info and the visits graph on my blog: http://www.inmarketingwetrust.com.au/seo-effect-of-domain-expiry-on-301-redirects/ I am not sure if this is due to the fact that some information is cached but when i looked at the site on opensiteexplorer I found that the data is still showing as non redirected sites: http://www.opensiteexplorer.org/asia-hotels.com/www.asia-hotels.com/a!comparison effect-of-301-redirect-expired-on-SERP-visibility-300x204.jpg
Technical SEO | | Gus_Martin0