In this tutorial we'll use the API to find out what Justin Bieber has been up to lately. We'll do everything in your web browser using the
GET v1/search endpoint.
Things you'll need
To follow this tutorial you'll need:
- Your API key
- A text editor
- A web browser
- Access to the internet
Open your text editor. We're going to use this to write our query before we use it.
In the editor, paste the following URL:
The first part of this, before the
?, is where the
v1/search endpoint lives. This endpoint lets you perform simple keyword searches for the last 24 hour period.
q represents the search term we want to use. The
key represents the API key you use to authenticate.
We want to search for Justin Bieber, so we'll want to replace
YOUR_SEARCH_TERM in the URL with that. Before we do, we'll format this properly. In URLs
%20 represents a space, so we're going to use
Your URL should now look like this:
Next, we'll insert our API key. Without this we won't get any results from the API. Your API key is unique to your account.
Your URL should now look something like this:
Copy what you have and open your web browser. Paste the URL into the address bar and press enter. Something like this will appear:
We're going to make this easier for you to read and browse through. Select everything, copy it, and then go to jsonprettyprint.com.
Paste the JSON data you just copied into the box and click the Pretty Print JSON button. The page will update and the JSON will be presented in a format that's easier to read.
Take a look through the output. You can see some of the data that NewsWhip calculates, like our prediction for the number of interactions the content will get, and you can see information about the posts that match your search.
Now that you've seen how to play with one of our APIs in your browser, you may want to: