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.
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:
Now let's break this down into individual sections as we did in the previous article:
https://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
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
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
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
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:
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.
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 [email protected] to reach our Customer Support team or call (855) 814-4510.