logo-small
Features Prices
News 0
Latest News See All

Temporarily unavailable. Please come back later.

See All
Webinars 0
Upcoming Webinars See All
Upcoming Webinars

Sorry, we could not find any upcoming webinars.

See recorded webinars
Blog 0
Recent Posts See All

Temporarily unavailable. Please come back later.

See All
Mike Isaac

What In The World Is API? (Part 2: Knowing Your Limits and How To Use Data)

Mike Isaac
What In The World Is API? (Part 2: Knowing Your Limits and How To Use Data)

This is a continuation of the previous article, What In The World Is API and How Do I Use It?

If you have read the first API article, you have a general idea of what API is and how to use it. But now, you will want to understand how to make sure when enough is enough and how to organize this data. It is important to know this information so that you do not run out of API units and that you know what to do with your raw data.

sign-161176

When conducting an API call, you must understand how much data you are asking for. With API, always keep in mind the terms of service. In our API terms, you can see we state that you are unable to make more than 10 calls per second or make more than 2 calls simultaneously. For most API calls you conduct, you will be asked to set a display limit. This will determine how much data you receive as well as determine how many units you are charged. Lets take a look at another example here for Domain Organic Search Keywords:

http://api.semrush.com/?type=domain_organic&key=XXXXXXXXXXXXXXXXXXXXXX&display_filter=%2B%7CPh%7CCo%7Cseo&display_limit=10&export_columns=Ph,Po,Pp,Pd,Nq,Cp,Ur,Tr,Tc,Co,Nr,Td&domain=seobook.com&display_sort=tr_desc&database=us

Now let's break this down into individual sections as we did in the previous article:

http://api.semrush.com/?type=domain_organic: Type of API Call Being Conducted

&key=XXXXXXXXXXXXXXXXXXXXXX: API Key

&display_filter=%2B%7CPh%7CCo%7Cseo: Filter being used; for more info click here

&display_limit=10: The amount of lines of data you are receiving

&export_columns=Ph,Po,Pp,Pd,Nq,Cp,Ur,Tr,Tc,Co,Nr,Td: What Columns Will Be Displayed In Your Results

&domain=seobook.com: The Domain Being Queried

&display_sort=tr_desc: How Your Data Will Be Sorted

&database=us: What Database The Data Will Be From

&display_limit

The display limit section is the key to determining your data. This will tell you how many lines of data you will receive in your API call, and ultimately, how much this data will cost you to receive.

As explained in the previous article, each line of data costs a certain amount of API units depending on the call. For the example listed above, each line of data costs 10 API units. So if we keep the display limit at 10, this API call will cost 100 API units to make. We can adjust this display limit to any number we would like in order to get the data we are looking for. One zero can determine if you are getting charged 100 units or 1,000 units.

If you are unsure of how many API units you have, you can always go to the Accounts API section listed in the sidebar to the left and then use the “Check API Units Balance” API call. This will tell you the remaining API units left on your account. You can also go to the Tariff Summary, which can be found in the dropdown menu in the top-right of your screen under Profile. You will want to take this data into consideration when you are conducting API calls. You must be aware of your API unit balance when making calls so that you do not exceed your balance.

How to Use the Data

&export_columns

This section of the API call refers to the different columns that will be displayed in your results. You can enter as many sections in here as you would like, however, they need to be applicable to the actual call being conducted. This section will not affect how many units are being charged to your account. The only line that affects this would be the display limit line. The export columns tell you how much data each line will return. You can see the different columns that can be added to API calls here.

Once you have your API call structured correctly, you are now ready to retrieve your results. When you enter your call in the address bar in your browser, your data will look like this:

Keyword;Position;Previous Position;Position Difference;Search Volume;CPC;Url;Traffic (%);Traffic Cost (%);Competition;Number of Results;Trends seo tools;1;1;0;4400;5.59;http://tools.seobook.com/;5.53;8.05;0.96;27100000;0.99,0.99,0.99,0.99,0.99,0.81,0.81,0.81,0.81,0.81,0.81,0.81 seo;12;7;-5;90500;13.01;http://www.seobook.com/;3.15;10.66;0.96;224000000;0.99,0.99,0.82,0.82,0.82,0.82,0.82,0.82,0.82,0.82,0.82,0.82 seo training;1;1;0;1900;11.82;http://training.seobook.com/;2.39;7.35;0.94;6990000;0.99,0.79,0.79,0.79,0.79,0.79,0.67,0.79,0.79,0.67,0.67,0.67 free seo tools;1;1;0;1600;4.49;http://tools.seobook.com/;2.01;2.35;0.95;21000000;0.84,0.99,0.84,0.84,0.68,0.68,0.68,0.99,0.84,0.84,0.53,0.46 seo tool;1;1;0;880;5.12;http://tools.seobook.com/;1.10;1.47;0.98;10400000;0.45,0.45,0.45,0.45,0.37,0.45,0.63,0.45,0.55,0.99,0.45,0.37 seo book;1;1;0;880;11.87;http://www.seobook.com/;1.10;3.42;0.54;29800000;0.77,0.68,0.68,0.68,0.68,0.68,0.68,0.55,0.99,0.68,0.45,0.45 seobook;1;1;0;880;3.39;http://www.seobook.com/;1.10;0.97;0.05;119000;0.99,0.99,0.99,0.88,0.88,0.88,0.88,0.88,0.72,0.72,0.59,0.59 seo toolbar;1;1;0;390;2.11;http://tools.seobook.com/seo-toolbar/;0.49;0.26;0.35;1580000;0.99,0.81,0.99,0.81,0.81,0.81,0.81,0.81,0.67,0.54,0.44,0.35 seo infographic;1;1;0;210;0.00;http://www.seobook.com/learn-seo/infographics/;0.26;0.00;0.07;3560000;0.81,0.81,0.99,0.81,0.66,0.66,0.81,0.81,0.66,0.66,0.53,0.53 seotools;1;1;0;210;5.05;http://tools.seobook.com/;0.26;0.34;0.84;2950000;0.42,0.65,0.81,0.99,0.81,0.65,0.81,0.81,0.99,0.99,0.81,0.81

This probably looks like a big mess to you, which it is at the moment. It would be very hard for you to read this data like it is displayed. So what do you do? The best way to understand this information is to make the same steps being conducted in the video below:

[video width="560" height="315" mp4="http://www.semrush.com/blog/wp-content/uploads/2015/06/APIData.mp4"][/video]

You will first want to copy the data being shown in the browser. Once you do so, open up Microsoft Excel (or a similar program), and paste the data into the first cell. Then, you will want to use the “Text to Columns” feature that is listed under the Data menu. This will split up the data by a certain mark specified.

As you can see in the video above, you will then want to select semicolon as how the data is delimited. Once you select finish, the data will be organized and readable. This will help you when you are doing multiple API calls and are looking to quickly organize and save your data.

hungover

This should help shed more light on using API and how to verify you are asking for the correct data when making an API call. Also, make sure that you select the proper limits on your calls to know your limits and not to over do it. This information will put you one step closer to grabbing the data you desire.

Have any more questions? Please feel free to leave a comment below or contact us at mail@semrush.com to reach our Customer Support team or call (855) 814-4510.

Image Credits: Pixabay 1, Pixabay 2

Mike Isaac is the Customer Success Content Manager at SEMrush. He has been working at SEMrush for over a year and is constantly pushing out new content to keep users engaged. Feel free to connect with him on LinkedIn or follow him on Twitter.

Comments

2000 symbols remain
Have a Suggestion?