Common Mistakes When Calling Smarty APIs

 • 
July 28, 2022
WEBINAR RECAP: While our documentation and tutorials are solid as Chris Hemsworth's abs, there are still some common API mistakes our support team has run into when helping our customers. In a recent webinar, our Support Team Lead Lyle Durland went over a few of those common mistakes and outlined what you need to know so that you never run into API problems again. Probably.
Tags

There are two types of frequent errors: 401 "Authentication Required" errors, and 402 "Payment Required" errors.

Status Code 401 - Authentication Required

If you're seeing this error there's a chance that there's an issue with your API key, there's a mistake inside your client-side request, or a mistake in the server-side request. In the recording Lyle dives deep into each of these, but here are the basics.

How to Authenticate API Requests

It is important that you are familiar with your API keys. Inside your Smarty account there's an API Keys tab where you can find embedded keys, as well as secret keys. Knowing which keys are used in which environment will help you avoid some errors. If you don't have access to the Smarty account, it may be a good idea to contact the account owner and get access to it.

Understand the difference between client-side requests (in a web browser) and server-side requests. Since browsers send a Referer header automatically, our system treats any request that includes a Referer header as a client-side request. In contrast, if the request does NOT have a Referer header, our system treats it as a server-side request.

Common Mistakes in Client-Side Requests

For client-side requests you'll want to use the embedded keys, not the secret keys. To do so will return a 401 error. Also, don't list the wrong referer/host value with the embedded key. There are a few specific places where your host will be a little different.

  • For localhost, just list "localhost" without the port number.
  • For calls from the jsfiddle website, the correct host is fiddle.jshell.net

When using a wildcard in a hostname, don't use the * for more than one level of subdomain, or you will get the 401 error.

And lastly don't forget to URL-encode the request URL. For example, a # symbol that is not URL-coded will break up the request URL and return an error.

Common Mistakes in Server-Side Requests

For server-side requests you'll want to use the secret keys, not the embedded keys. Don't type the auth-id or auth-token by hand; you might mistype a 1 for a lower-case L or a 0 for a capital O. And of course, don't forget to URL-encode the request URL.

Status Code 402 - Payment Required

Most of these errors stem from a misunderstanding of the way Smarty's products work, or what each license provides you with. There are a few things you can do to avoid these errors.

If you are a developer trying to work with the Smarty APIs we recommend that you be able to log in to the Smarty account that you are trying to use. If you are not the primary account owner, you'll need to obtain those login details from whoever is.

It is beneficial to be familiar with the different pages available in your account dashboard such as Subscriptions and API Keys pages. Knowing what you have available in the Subscriptions section will help you identify the APIs you are allowed to call and what specific abilities are included. If you are ever unclear you can contact the Smarty Support team on any of Smarty's pages via the chat, email, or phone call.

If you have several accounts with licenses make sure you're using the correct APIs from the correct accounts. Several of our customers are contractors or independent users who are utilizing several accounts. That may be the first thing you want to check if that is the case.

If you are using one of our SDKs don't assume that the elicense value listed in the Github example code is the right one. For example, the default license listed in the Github example code is us-rooftop-geocoding-cloud, but you may not have a Rooftop Geocoding license.

When in Doubt, Contact Support

The Smarty Support team is here for you. Feel free to contact them any time you need it!

Regular office hours: Weekdays 8 AM - 5 PM Mountain Time.

Phone: 801-877-5778

Chat: Anywhere on smarty.com

Email: support@smarty.com

Watch the full webinar recording for more information!

Subscribe to our blog!
Learn more about RSS feeds here.
Subscribe Now
Get our latest eBook!
Evaluating a geocoding tool?
Get the buyer's guide
smarty logo
Download now
Read our recent posts
Rising Parcel Shipping Costs in 2022: How to Cut Your Shipping Expenses
Arrow Icon
Parcel shipping costs have been rising since 2020. We’ve all seen inflation on the consumer end, whether we’re checking out online or paying at the gas pump. And skyrocketing freight rates have made headlines. Today, we’re going to focus on the impact of the increasing cost of shipping on your business and what you can do about it. But don’t lose hope—while we’re going to explore climbing shipment costs in this article, we’ll also chat about what your business can do to make shipping more efficient.
How to Clean Address Data For the Holiday Rush
Arrow Icon
It’s November, and online shopping is ramping up to its climactic end-of-year blitz. www. blackfriday. com estimates that between Thanksgiving and Black Friday of this year, consumers will spend approximately $13 billion 1. That’s great news for your business. But if you don’t have the right tools in place to help you meet that demand, you might be left wishing you had better prepare. Staffing may be one issue for many businesses. According to the US Chamber of Commerce, the wholesale and retail trade industry has experienced the second-highest quit rate of all industries since November 20202.
Helpful Hints to Authenticating Your APIs
Arrow Icon
We brought out the big guns in the way of our Development Team Lead, Kent Gividen, in a webinar all about authenticating your APIs. He went over some of his most useful tips and tricks that he uses to ensure APIs are authenticated. Was it helpful? You betcha. You wanna get the sparknotes? Read on. Common and Not-So-Common APIs to Know About Kent began by outlining the APIs that he has run into the most in his years as a developer. Some of them he dug into a little deeper than others, but these are all useful to be aware of.

The leader in location data intelligence

Ready to get started?