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
-
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 -
Tool to Generate All the URLs on a Domain
Hi all, I've been using xml-sitemaps.com for a while to generate a list of all the URLs that exist on a domain. However, this tool only works for websites with under 500 URLs on a domain. The paid tool doesn't offer what we are looking for either. I'm hoping someone can help with a recommendation. We're looking for a tool that can: Crawl, and list, all the indexed URLs on a domain, including .pdf and .doc files (ideally in a .xls or .txt file) Crawl multiple domains with unlimited URLs (we have 5 websites with 500+ URLs on them) Seems pretty simple, but we haven't been able to find something that isn't tailored toward management of a single domain or that can crawl a huge volume of content.
Technical SEO | | timfrick0 -
What about re-life expired domain ?
I want to know about your advice to re-life expired domain, assume PA:55 how I get benefits from it, when I use it for new related content.
Technical SEO | | zant0 -
Looking at creating some auto-generated pages - duplicate content?
Hi Everyone! We just launched a new version of our research site and the main CTA on the page sends users to a subdomain that's blocked by robots.txt. The subdomain link is one of our PPC landing pages and they would be duplicate content for every model (cars). We're also looking at a new content stream of deals pages, on the main domain. The thought process was that we could rank these pages for things like "Volkswagen golf deals" and also use them as canonical URLs from the PPC pages so that Panda doesn't get mad at us for sending hundreds of links to a subdomain that's blocked. It's going to take us a lot of time to write the copy for the deals pages, so if we auto-generate it by pulling a paragraph of copy from the car review, and numerical stats about that model, will it be classes as duplicate and/or is there any downside to doing it? Review Page: http://www.carwow.co.uk/car-reviews/Ford/Fiesta Deals Page: http://www.carwow.co.uk/deals/Ford/Fiesta PPC Landing Page: http://quotes.carwow.co.uk/buy/Ford/Fiesta I can't help but feel that this may all be a bit overkill and perhaps it makes more sense to build 1 central deals page per model with unique content that we can also send the PPC traffic to, then life any block from the quotes. subdomain. But that will take time and we'd also like a quick solution. I'd also question if it's even an issue to link to a blocked subdomain, Google adds the quote URL into the index but can't crawl it, which I've been told is bad - but is it bad enough to do something about? Thanks, JP
Technical SEO | | Matt.Carwow0 -
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 -
Are article sites a good way to generate traffic and links
I read a lot that article sites are a great way to generate links and traffic but i would like to hear from people on here to see about their experience with article sites. I have tried article sites and i have to be honest that most of them are no follow links and have also not generate any traffic. I have written over 30 articles for free article sites with no traffic coming from them and this has been done over a eight month period can anyone recommend any good article sites that can produce traffic and also ones that produce do follow If you feel i am wasting my time putting articles on free sites then please do tell me
Technical SEO | | ClaireH-1848860 -
Best Dynamic Sitemap Generator
Hello Mozers, Could you please share the best Dynamic Sitemap Generator you are using. I have found this place: http://www.seotools.kreationstudio.com/xml-sitemap-generator/free_dynamic_xml_sitemap_generator.php Thanks in advanced for your help.
Technical SEO | | SEOPractices0 -
Dynamically-generated .PDF files, instead of normal pages, indexed by and ranking in Google
Hi, I come across a tough problem. I am working on an online-store website which contains the functionlaity of viewing products details in .PDF format (by the way, the website is built on Joomla CMS), now when I search my site's name in Google, the SERP simply displays my .PDF files in the first couple positions (shown in normal .PDF files format: [PDF]...)and I cannot find the normal pages there on SERP #1 unless I search the full site domain in Google. I really don't want this! Would you please tell me how to figure the problem out and solve it. I can actually remove the corresponding component (Virtuemart) that are in charge of generating the .PDF files. Now I am trying to redirect all the .PDF pages ranking in Google to a 404 page and remove the functionality, I plan to regenerate a sitemap of my site and submit it to Google, will it be working for me? I really appreciate that if you could help solve this problem. Thanks very much. Sincerely SEOmoz Pro Member
Technical SEO | | fugu0