WPRM version 1.2.9

optimized request saving process

Instead of saving the request options 4 times for newly created requests. Now, you only have to save the parameter values entries then the full request sections a one time.

New RESTful requests engine

Unirest is a set of lightweight HTTP libraries. Utility methods to call GET, POST, PUT, DELETE requests which we will add in future versions.

Connection header extra custom data

Now you can add new data to request’s header such as authentication key.

Advertisements

WPRM Example 4: Mashape APIs – Market Data API

You can access the Mashape APIs website from here. Today, we will implement MARKET DATA API.

  1. Establishing Connection:
    To make a request to the service server you have to use a URL which have 2 parts: base url and parameters. The first part is static and the second is dynamic in most cases which means that you can change the results if you changed the parameters’ values.
    To establish a connection you need to know 3 thing about your API:

    • Its base url (your custom while 1 and 2 can be replaced with the paraameters): https://stockviz.p.mashape.com/marketdata/{1}
    • the results (response) format [Json, XML, etc ..]: JSON in this example
    • The parameters Keys: the name of the parameters like data (or you can all it data_type).
    • Check the checkbox to confirm that your url is dynamic with numbers like {1}.
    • In Authorization and header settings section, You need to add X-Mashape-Key as token key. Get one using the API’s documentation.

    Once you now that, go to Restful Manager > Connection, add a new connection, give it a relevant name(you will need it soon)  and add the data as in the following screenshot then click Save.
    mashconn

  2. Create request and Connection Settings:
    Next, we need to assign those parameters to suitable data so that the web service can query it and return the required data response.
    Now, go to Restful Manager > Requests, add a new request. and give it a name, then select the connection name that you have just created. When the parameters show up, populate the parameter values as you see in the following screenshot. Both are fixed values(however you can make it so it retrieve from database).
    As you can see, there are a lot of options in Parameter values setting, most of them are to set the dynamic data retrieval which is one of the features that makes this plugin powerful(we will discuss it more in other tutorial).
    Once you populated those fields, click save.
    mashreq
  3. Request’s Display Settings:
    After you save your values, you will find new sections are generated in the request page. One of them is ‘Display Settings’ which responsible for what you want to do with the response results:

    • Display Vs. Save then Display: WPRM give a chance to save selected items from the results in database or just display it in runtime. Most of times we will just choose ‘Display Only’.
    •  Where to display results: decide where to show the results template by selecting post type and then before or after content or you can just use a shortcode to add it wherever you like. Choose ‘shortcode’ and save the code that shows up.
    • Showing repeatable results: select where or not to loop through results. This used only when you have a group of results that share the same group of parameter keys which is the case here.
    • Start Checking dummy data: add all values in this section with full fixed(no dynamic work is here) dummy(but correct) data then click ‘check request’ once you see results check only the data that you want it to show up in your app or widget.
      mashreqdis
  4. Templating Results:
    Now every thing is ready except how the results will look like!! so here comes the last section, ‘Template Settings’. You will find in it 2 parts:

    • Header or non-repeatable Template: this is the template that show results one time. you can add text inline style and html to template you results. The links below the editor is a shorthand to help you copy and paste to the editor:
      • the results keys
      • Functional helpers like: if/ifExists/section
    • Repeatable template: if you have a repeatable data you will setup this template exactly as the above to be in for each repeated item at a time.mashreqtemp
      Save the changes once you finish.
      mashtest

To see the output, we’ll copy and paste the shortcode from the display section in any text widget in your theme. It’s very simple but you can style it as you like.

WPRM Example 3: Railways API

You can access the API website from here.

  1. Establishing Connection:
    To make a request to the service server you have to use a URL which have 2 parts: base url and parameters. The first part is static and the second is dynamic in most cases which means that you can change the results if you changed the parameters’ values.
    To establish a connection you need to know 3 thing about your API:

    • Its base url (your custom while 1 and 2 can be replaced with the paraameters): http://api.railwayapi.com/name_to_code/station/{1}/apikey/{2}/
    • the results (response) format [Json, XML, etc ..]: JSON in this example
    • The parameters Keys: the name of the parameters like station_name & api_key.
    • Check the checkbox to confirm that your url is dynamic with numbers like {1}.

    Once you now that, go to Restful Manager > Connection, add a new connection, give it a relevant name(you will need it soon)  and add the data as in the following screenshot then click Save.
    railconn

  2. Create request and Connection Settings:
    Next, we need to assign those parameters to suitable data so that the web service can query it and return the required data response.
    Now, go to Restful Manager > Requests, add a new request. and give it a name, then select the connection name that you have just created. When the parameters show up, populate the parameter values as you see in the following screenshot. Both are fixed values(however you can make it so it retrieve from database).
    As you can see, there are a lot of options in Parameter values setting, most of them are to set the dynamic data retrieval which is one of the features that makes this plugin powerful(we will discuss it more in other tutorial).
    Once you populated those fields, click save.
    railreq
  3. Request’s Display Settings:
    After you save your values, you will find new sections are generated in the request page. One of them is ‘Display Settings’ which responsible for what you want to do with the response results:

    • Display Vs. Save then Display: WPRM give a chance to save selected items from the results in database or just display it in runtime. Most of times we will just choose ‘Display Only’.
    •  Where to display results: decide where to show the results template by selecting post type and then before or after content or you can just use a shortcode to add it wherever you like. Choose ‘shortcode’ and save the code that shows up.
    • Showing repeatable results: select where or not to loop through results. This used only when you have a group of results that share the same group of parameter keys which is the case here. so select this option.
    • Repeatable Results Root: this is the root to loop through results(will com back to it later).
    • Start Checking dummy data: add all values in this section with full fixed(no dynamic work is here) dummy(but correct) data then click ‘check request’ once you see results check only the data that you want it to show up in your app or widget(it’s enough to check the data from one repeatable and the system will get them all). Also, for the ‘Repeatable Results Root’ that we left it earlier, find the parent of the Repeatables and add it to this field as you see in the screenshot both highlighted with yellow.
      railreqdis
  4. Templating Results:
    Now every thing is ready except how the results will look like!! so here comes the last section, ‘Template Settings’. You will find in it 2 parts:

    • Header or non-repeatable Template: this is the template that show results one time. you can add text inline style and html to template you results.
    • Repeatable template: if you have a repeatable data you will setup this template exactly as the above to be in for each repeated item at a time. The links below the editor is a shorthand to help you copy and paste to the editor:
      • the results keys
      • Functional helpers like: if/ifExists/section

      railtemp
      Save the changes once you finish.

railtestTo see the output, we’ll copy and paste the shortcode from the display section in any text widget in your theme. It’s very simple but you can style it as you like.

WPRM version 1.2.5

Added custom url connection:

Customized base connection url will enable the user to make flexible requests under the same connection. Lots of APIs use the last part of its base url to add the type of the connection. For example, Facebook graph where you can say graph.facebook.com/v2.3/{1} where 1 could be replaced with ‘me’, ‘page’, user_id, and other things.

conk2

Fixed storing request results in WP database:

The way of saving request results has been optimized and some options like ‘Display/Store results’ has been modified. Now you can save the results from dashboard without any need to use the shortcode.

WPRM version 1.2.1

[if] and [ifExist] helpers

[if item=val][/if]: checks one of the results keys against a possible value. If the condition returns true then the content of the condition will be displayed as part of the content. In the next screenshot, you see that check one of the results if it’s valid or not and display different output depending on that.
samps

[ifExist item][/if]: checks if an item exists and not empty. if the item have any value the content of the condition will be displayed. In the following sceenshot, we use if exist to test if an image link exists because if not we don’t need to see the broken image icon so we don’t show it at all.
samps2

[section] helpers

section helpers is very useful with templates especially the repeatable data template. It’s a simple typography tool to organize your template. You can use sections as [section 1/2], [section 1/3] and [section 1/4]. each fraction refers to the part of the page/container that this section will take.

Ability to establish authorized requests with username and password

If you use web services that provides API access(which i think most of them), so you will find some of them require remote username and password authorization before you query any data. Now you can do these kind of requests with WPRM. Just go to RESTful Manager > connection, then set the checkbox ‘This Connection will be authorized with username and password.’ and fill your username and password.
samps3

WPRM Example: Klout SEO API

In this example, we will validate a phone/mobile number using Klout API. Please, make sure that:

  • WP Restful Manager Plugin installed and active.
  • You read our quick launch example(Basic steps will not explained in this example).
  • Know what this API does.

In this API, we will go through 8 steps:

  1. Sign up in the API and get the API key.
  2. Establish a connection to get Klout Network Id.
  3. Create data request and Populate parameters values.
  4. Set data storing options.
  5. Establish a new connection for koultData.
  6. Create request and populate parameters values.
  7. Set display options.
  8. Customize the display template.
  1. Sign up in the API and get the API key:
    Go to documentation, sign up and get you API key.koult
  2. Establish a connection to get Klout Network Id:
      • Connection base url: http://api.klout.com/v2/identity.json/twitter
      • the results (response) format: json
      • The parameters Keys: key/ screenName

    These will be added as in the screenshot then save it:
    conk

  3. Create request and Populate parameters values:
    • key: it will be fixed value. then copy and paste the API key in the value source.
    • screenName: it could be a fixed value if you want to add fixed tweeter id. In this example, i assume that you store your users’ tweeter id as users meta so we will retrieve them dynamically.

    Save after you finish.
    reqk

  4. Set data storing options:
    • Display/store: We will only save the targeted output in the database output.
    •  Where to display results: If you use a fixed twitter id you can choose ‘save only’. But since it will be dynamic so we will use shortcode here.
    • Showing repeatable results: don’t check this option we don’t have repeatable data.
    • (save everything before this step)Start Checking dummy data: add all values in this section with full fixed(no dynamic work is here) dummy(but correct) data then click ‘check request’ once you see results check only the data that you want save which in this case will be the id. A dropdwon menu show up choose where to save. In this case will be user meta, select it then memorize the meta key that will show beside it.reqkd. once When you’re finished, click save.
  5. Establish a new connection for koultData.
    • Connection base url: http://api.klout.com/v2/user.json/{1}/{2} (this is called custom url. To provide flexibility, we made it easy to add parameters in the base url itself. The screenshot below will clear it out).
    • the results (response) format: json
    • The parameters Keys: networkid/type/key(the custom parameters’ keys can be given random names – names are only references here – but the key value parameters have to be given the same name as in the documentation).
    • activate the custom URLs checkbox.

    These will be added as in the screenshot then save it:
    conk2

  6. Create data request and populate parameters values:
    • networkid: choose ‘user meta’ and select the user meta key that you have just saved it in step #4.
    • type: if you had a look at the docs. You will find several types of data you can retrieve like Score, Influence, Topics, etc .. here we will choose score.
    • key: it will be fixed value. then copy and paste the API key in the value source(same as above).
      reqk2
  7. Set data storing options in the new request:
    • Display/store: here we will display data so select ‘Display Only’.
    •  Where to display results: we will use shortcode here.
    • Showing repeatable results: don’t check this option we don’t have repeatable data.
    • (save everything before this step)Start Checking dummy data: add all values in this section with full fixed(no dynamic work is here) dummy(but correct) data then click ‘check request’. You can get the ‘networkid’ from the previous request just by copy and paste it. Check whatever you want to display.

    reqkd2

  8. Create data request and populate parameters values:
    Now every thing is ready except how the results will look like!! so here comes the last section, ‘Template Settings’.

    • In Header or non-repeatable Template: this is the template that we’ll use. you can add text inline style and html to template you results. The links below the editor is a shorthand to help you copy and paste to the editor:
      • the results keys: score/bucket.
      • Functional helpers like: if/ifExists/sections

      In the screenshot below, we create a table then add the score of the twitter account at first row then the level of the score on the second row. We get the level by checking the bucket if it between 30-39, it will show Bad, and if it between 50-59, it shows Moderate, and so on. You can add as many [if] conditions as you like. reqktemp

    • Save the changes. After that get both requests shortcodes [rm req=xx] and add them in whatever page or post you like. Make sure you add them in the same order we created them so we can store the network id first. The screenshot below shows how it would look like. It’s so simple but it could be effective in real app or website.
      sampsk

WPRM Example: Phone number validation API

In this example, we will validate a phone/mobile number using numverify API. Please, make sure that:

  1. Establishing Connection:
    If you checked the API’s documentation, you will find that to make a request to the service server you have to use a URL which have 2 parts: base url (http://apilayer.net/api/validate) and parameters (access_key=YOUR_ACCESS_KEY&number=14158586273). The first part is static and the second is dynamic in most cases which means that you can change the results if you changed the parameters’ values.
    To establish a connection you need to know 3 thing about your API:

    • Its base url.
    • the results (response) format [Json, XML, etc ..].
    • The parameters Keys: the name of the parameters like access_key & currencies.

    Once you now that, go to Restful Manager > Connection, add a new connection, give it a relevant name(you will need it soon)  and add the data as in the following screenshot then click Save.
    Note: You can get access key to the API by signing up for a free plan.
    conn2

  2. Create request and Connection Settings:
    Next, we need to assign those parameters to suitable data so that the web service can query it and return the required data response. In our example, we’ll 2 parameter values which are access_key and number.
    Now, go to Restful Manager > Requests, add a new request. and give it a name, then select the connection name that you have just created. When the parameters show up, populate the parameter values as you see in the following screenshot.
    As you can see, there are a lot of options in Parameter values setting, most of them is to set the dynamic data retrieval which makes this plugin powerful:
    access_key: will be fixed value since access keys doesn’t change.
    number: the phone number would be a post/user meta as in this example. you can make it related to current logged in user by retrieving user’s meta phone number that the system is previously saved.
    Once you populated those fields, click save.
    paramvals
  3. Request’s Display Settings:
    After you save your values, you will find new sections are generated in the request page. One of them is ‘Display Settings’ which responsible for what you want to do with the response results:

    • Display Vs. Save then Display: WPRM give a chance to save selected items from the results in database or just display it in runtime. In this example, we will just choose ‘runtime request’ to only display the results.
    •  Where to display results: decide where to show the results template by selecting post type and then before or after content or you can just use a shortcode to add it wherever you like. We will use shortcode so we can add it as a widget(may be you want to add it in some user section).
    • Showing repeatable results: select where or not to loop through results. This used only when you have a group of results that share the same group of parameter keys(discussed in other example).
    • Start Checking dummy data: add all values in this section with full fixed(no dynamic work is here) dummy(but correct) data then click ‘check request’ once you see results check only the data that you want it to show up in your app or widget. once you’are finished click save.
      disset
  4. Templating Results:
    Now every thing is ready except how the results will look like!! so here comes the last section, ‘Template Settings’. You will find in it 2 parts:

    • Header or non-repeatable Template: this is the template that we’ll use. you can add text inline style and html to template you results. The links below the editor is a shorthand to help you copy and paste to the editor:
      • the results keys
      • Functional helpers like: if/ifExists/section

      In the GIF below, we check if the number is valid by checking the ‘valid’ results item if it’s equal to 1(check the documentation).

    • Repeatable template: if you have a repeatable data you will setup this template exactly as the above to be in for each repeated item at a time.
      newphonetemp
      Click to see full image and clear text

      Save the changes once you finish. The GIF above shows how it would look like. It’s so simple but it could be effective in real app or website.

Actions and Filters for Developer

In this post, I’ll add all actions, filters and any developer related updates.

Filters

rm_before_save_parameters_keys:

Catch all parameter keys before saving them in Database after creating or editing connection.

parameters:  $arr: array of parameter keys.

rm_pre_display_results:

Add CSS or JS scripts to results template before displaying it.

parameters:  $content: HTML content of the JS code that implements the request.

rm_edit_results_array:

Get results array after the request fulfilled to add more items or edit it.

parameters:  $arr: array of request results.

Actions

rm_store_results_db:

If you’ve chosen o save request results to DB. Add a different query inside this action.

parameters: $arr: array of request results.

What’s an API? Explore Popular useful RESTful APIs

Data is everywhere, and companies are virtually climbing over each other to give it away. Data is opportunity, but accessing that data can take some technical know-how and that’s where WPRM what to step up for. This is a guide to APIs, one of the key methods for accessing 3rd-party data, and also a mini-directory of some of the most useful APIs currently available.

What Is an API?

Let’s start with the official definition – API stands for “Application Programming Interface”. Sorry, I’m not the one who lets engineers name things. Put simply, an API is a way to let you talk to a 3rd-party application, usually either to retrieve data or update that application. We’re going to focus primarily on the first use (retrieving data), and it looks something like this:

Simple API Diagram (Send Request, Get Data)

The API itself isn’t really a box floating in space, so much as a chunk of code that acts as a gatekeeper. That code helps translate the third party’s data into something you can read, and it makes sure that only authorized users can access the data (a process called “authentication”).

Why Should I Care?

There are hundreds of applications on the market that collect useful data, and many of them are making that data available for free or very cheaply. You can use that data to do original research, create unique content or even build your own applications. If you’d rather stick to beet farming, well then that’s cool, too.

Following is a list of hand-selected APIs, broken down into a few industry categories, and alphabetical within each category. For each API, I’ll provide a main link, a documentation link, a brief description of what’s available in that API, and whether or not there’s a free version. APIs are split into five sections:

  • APIs for SEO
  • APIs for PPC
  • APIs for Social
  • Miscellaneous APIs
  • API Support Tools

(1) APIs for SEO

This section contains APIs for organic SEO data, including keyword research and link profiling.

Bing Search (Docs)

The Bing search API allows you to integrate Bing search results and search data directly into your applications, including web search, images, news, videos, related search, and spelling suggestions.

Free Version?  YES, but rate-limited.


Majestic SEO (Docs)

The Majestic API includes a wide range of link metrics, including full back-link lists, discovery dates for links, anchor text, redirection information, and ACRank. Some features are limited to the paid version.

Free Version?  YES, but limited functionality.


Raven Tools (Docs)

The Raven Tools API lets customers access and update account and campaign information. It can also be used to access link data from your Raven campaigns.

Free Version?  NO, paid accounts only.


SEOmoz Mozscape (Docs)

SEOmoz’s API has access to proprietary metrics, including MozRank, Domain Authority, and Page Authority, as well as link metrics such as linking root domains and anchor text data.

Free Version?  YES, but rate-limited.


WordStream Keyword Tool (Docs)

WordStream’s Keyword Tool API lets you access WordStream’s keyword volume metrics, along with related keywords and structured keyword suggestions.

Free Version?  YES, but rate-limited.


(2) APIs for PPC

The following APIs provide access to major ad platforms, including Google, Bing, and Facebook.

Bing Ads API (Docs)

While primarily a campaign management platform, the Bing Ads API does have access to useful data, including keword volume and keyword suggestions/opportunities.

Free Version?  YES, but authorization required.


Facebook Ads API (Docs)

The Facebook Ads API provides access to managing Facebook campaigns, as well as statistics about Facebook keyword searches and audience segments.

Free Version?  YES, but authorization required.


Google AdWords API (Docs)

Like Bing, the Google AdWords API is mainly for campaign management and building AdWords apps, but it also the only portal to Google keyword volume data. Getting authorized can be a long process.

Free Version?  YES, but authorization required.


SEMRush API (Docs)

The SEMRush API has a number of tools for both organic and paid search campaigns, but where it really shines is in competitive analysis, especially for paid search.

Free Version?  NO, starts at $15/month.


(3) APIs for Social

These APIs can access a wealth of information from major social networks and social aggregators.

Facebook Graph (Docs)

Facebook’s “Graph” API is the primariy interface to building Facebook-based apps, updating Facebook accounts, and accessing Facebook social graph data. There are other, secondary Facebook APIs.

Free Version?  YES, but rate-limited.


FollowerWonk (Docs)

FollowerWonk’s Social Authority API scores Twitter users on a 1-100 scale, for simple influence scoring and comparisons (Note: FollowerWonk is a part of SEOmoz).

Free Version?  YES, but rate-limited.


Gnip (Docs)

Gnip provides an enterprise-level API with “firehose” and filtered streams for Twitter, Facebook, Google+, YouTube, and more. Pricing is custom and is aimed at large-scale applications.

Free Version?  YES, but trial only.


Google+ (Docs)

The official Google+ API allows you to manage accounts, build apps, and access to data from user profiles, posts, and comments. It includes some limited search capability.

Free Version?  YES, but rate-limited.


Klout (Docs)

The Klout API provides access to Klout’s aggregate social metrics, including Klout score, influencers, influence graphs, and topics of influence.

Free Version?  YES, but rate-limited.


PeerIndex (Docs)

PeerIndex is another social aggregator, and their API provides data on multiple influence metrics, including activity, authority, and audience scores.

Free Version?  YES, but rate-limited.


SharedCount (Docs)

The SharedCount API lets you access sharing stats on a number of platforms, including Facebook, Twitter, Google+, Reddit, LinkedIn, Digg, Delicious, StumbleUpon, and Pinterest.

Free Version?  YES, but rate-limited.


Topsy (Docs)

The Topsy Otter API is an alternative source for Twitter data, including a number of useful search functions – search by keyword, by links mentioned, by popluar stories on a domain, etc.

Free Version?  YES, but rate-limited.


Twitter (Docs)

The official Twitter RESTful API includes many tools for account management and data gathering, including individual tweet and user data, follower stats, and a variety of search options.

Free Version?  YES, but rate-limited.


(4) Miscellaneous APIs

Here are some other useful APIs, including Google products, analytics, and text processing.

AlchemyAPI (Docs)

AlchemyAPI provides a Natural Language Processing engine to perform tasks such as sentiment analysis, named entity extraction, author extraction, and topic categorization.

Free Version?  YES, but rate-limited.


Google Analytics API (Docs)

The Google Analytics API is a full-featured system to manage GA accounts and profiles, customize tracking codes, and to access and export analytics data.

Free Version?  YES, but authorization required.


Google Places API (Docs)

The Google Places API allows you to access the entire family of Google local data, including Google Maps, Google+ Local, and Google Places search.

Free Version?  YES, but authorization required.


PageSpeed Insights (Docs)

PageSpeed Insights is a Google Developer tool for website performance analysis. The PageSpeed API allows access to PageSpeed scores and recommendations.

Free Version?  YES, but authorization required.


Repustate (Docs)

The Repustate API provides access to a number of advanced algorithms, including sentiment analysis, social media monitioring, and predictive analytics.

Free Version?  YES, but rate-limited.


(5) API Support Tools

If you’re new to APIs, this section can help get you started or find APIs outside the scope of this post.

CodeAcademy API Track

CodeAcademy is a resource for learning programming concepts and languages. The API track has specific online courses designed to help you learn API coding.

Free Version?  YES.


Mashape (Docs)

Mashape is an API marketplace that allows you to access over 2,000 APIs from a single account. Mashape also lets you distribute and monetize your own APIs.

Free Version?  YES, depending on the API.


ProgrammableWeb

ProgrammableWeb is a directory of over 9,000 APIs on a wide variety of topics. ProgrammableWeb has its own API, that allows you to access their search database.

Free Version?  YES.


SEER Interactive SEO Toolbox (Docs)

SEER’s all-in-one interactive toolbox lets you access multple APIs via Excel, including Google Analytics, SEOmoz, Majestic, Raven, Twitter, and Klout.

Free Version?  YES, but rate-limited.


SEOGadget Excel API Extensions (Docs)

The SEOGadget API extension for Excel allows you to easily call link data from Excel spreadsheets, including SEOmoz, Majestic, and additional SEOGadget data.

Free Version?  YES, but rate-limited.


Highly inspired from: Moz.com

WPRM Little Longer Example: relevant related posts from Google

This plugin enables you to manage RESTful APIs data starting from establishing a connection to templating the results. Here is a example puts WPRM in action.

In this example, we will return a  relevant related posts from your favorite site using Google Custom Search API. Please, make sure that:

  1. Establishing Connection:
    If you checked the API’s documentation, as we learnt before, you will need to use a URL which have 2 parts:

    • base url : https://www.googleapis.com/customsearch/v1
    • parameters : key(global Google api access key), cx(custom Search API Engine ID), q(search term), num(number of results).
    • Data format is JSON.
    • If your API are authorized with Email and password, so you can check the option of authorized connection and add username and password.
    • If you have any header extra data (sometimes api documentation need you to add authorization key in the header instead of the parameters), add as many as you like in the ‘Extra header data’ section.

    Once you now that, go to Restful Manager > Connection, add a new connection, give it a relevant name(you will need it soon)  and add the data as in the following screenshot then click Save.
    Note: You can get api key to the API and get Engine ID read the documentation and get the id from here. Also, you will be asked to add a website or a blog to retrieve your results from.
    conn

  2. Create request and Connection Settings:
    Next, we need to assign those parameters to suitable data so that the web service can query it and return the required data response.
    Now, go to Restful Manager > Requests, add a new request. and give it a name, then select the connection name that you have just created. When the parameters show up, populate the parameter values as you see in the following screenshot.
    As you can see, there are a lot of options in Parameter values setting, most of them is to set the dynamic data retrieval which makes this plugin powerful:
    key: will be fixed value since it doesn’t change.
    cx: the same, fixed value.
    q: this one will be dynamic. We want the results to be as relevant as possible so we will use the post title as the search term so now the results will be different once the post ch
    num: here i make it fixed so it only output 3 related posts.
    Once you populated those fields, click save.
    req
  3. Request Display Settings:
    After you save your values, you will find new sections are generated in the request page. One of them is ‘Display Settings’ which responsible for what you want to do with the response results:

    • Display Vs. Save then Display: WPRM give a chance to save selected items from the results in database or just display it in runtime. In this example, we will just choose ‘runtime request’ to just display the results.
    •  Where to display results: decide where to show the results template by selecting post type and then before or after content or you can just use a shortcode to add it wherever you like. We will show the related posts after the post content.
    • Showing repeatable results: select where or not to loop through results. This used only when you have a group of results that share the same group of parameter keys and that is the case here. All search results share the same param key so we will check this option.
    • Repeatable Results Root: Sometimes the part of the results that you need is not quite in the result’s top level but in some deeper level. To populate it, you need to run the initial request with dummy data first(check the results screenshot below).
      Note: the results will be look look this:
      items[
      Repeatable-0 [
      data …
      ],
      Repeatable-1 [
      data …
      ],
      repeatable-2 [
      data …
      ],
      ]
      while Repeatable was referred to as Sequence in older versions.
      display
    • Start Checking dummy data: add all values in this section with full fixed(no dynamic work is here) dummy(but correct) data then click ‘check request’ once you see results check only the data that you want it to show up. Here we will check the 4 main data: htmlTitle, link, htmlSnippet and src(for post thumbnail). Once you’are finished click save.results
  4. Templating Results:
    Now every thing is ready except how the results will look like!! so here comes the last section, ‘Template Settings’. You will find in it 2 parts:

    • Header or non-repeatable Template: this is the template that we’ll use. you can add text inline style and html to template you results. The links below the editor is a shorthand to help you copy and paste to the editor:
      • the results keys
      • Functional helpers like: if/ifExists/section
    • Repeatable template: This will template each repeated item at a time.
      temp
      Save the changes once you finish.

To see the output, open one of your posts scroll to after content section. you will find the results.
samples