Free JCI Plugin: Data from playlist with basenode and without

JSON: https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa
Solution:
[jsoncontentimporter url=https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa basenode=now_playing.song] {text}<img src={art}> [/jsoncontentimporter]
or:
[jsoncontentimporter url=https://cast02.siamsa.ie/public/radio_siamsa/api/live/nowplaying/radio_siamsa] {subloop:now_playing:-1} {subloop:now_playing.song:-1} {now_playing.song.text}<img src={now_playing.song.art}> {/subloop:now_playing.song} {/subloop:now_playing} [/jsoncontentimporter]

Books: Current Bestseller

With the free JSON Content Importer Plugin you can display the New York Times Bestseller-Booklist:

Code for that:
[jsoncontentimporter url=https://api.nytimes.com/svc/books/v3/lists/current/hardcover-fiction.json?api-key=YOUR_NYT_API_BOOK_KEY basenode=results] {list_name}<br>{subloop-array:books:-1}<img src="{books.book_image}" title="{books.title}" align="left" width="40" hspace="5"> {books.rank}. <a href="{books.amazon_product_url}" target="_blank">{books.title}</a><br>{books.description}<br clear="all"> <hr>{/subloop-array:books} [/jsoncontentimporter]


In action:

Hardcover Fiction
1. THE 19TH CHRISTMAS
In the 19th installment of the Women's Murder Club series, detective Lindsay Boxer and company take on a fearsome criminal known only as "Loman."


2. WHERE THE CRAWDADS SING
A woman who survived alone in the marsh becomes a murder suspect.

3. WHAT HAPPENS IN PARADISE
In the sequel to "Winter in Paradise," Irene Steele visits the island of St. John to get to the bottom of the mysterious life and death of her husband.

4. NINTH HOUSE
After mysteriously surviving a multiple homicide, Galaxy Stern comes face to face with dark magic, murder and more at Yale University.

5. THE INSTITUTE
Children with special talents are abducted and sequestered in an institution where the sinister staff seeks to extract their gifts through harsh methods.

6. THE WATER DANCER
A young man who was gifted with a mysterious power becomes part of a war between slavers and the enslaved.

7. THE DUTCH HOUSE
A sibling relationship is impacted when the family goes from poverty to wealth and back again over the course of many decades.

8. THE TESTAMENTS
In a sequel to “The Handmaid’s Tale,” old secrets bring three women together as the Republic of Gilead’s theocratic regime shows signs of decay.

9. CHILD'S PLAY
A prestigious New York lawyer learns that the life she constructed for her children and herself isn't exactly what she thought it was.

10. THE GIVER OF STARS
In Depression-era America, five women refuse to be cowed by men or convention as they deliver books throughout the mountains of Kentucky.

11. BLOODY GENIUS
The 12th book in the Virgil Flowers series. A fight between university departments turns deadly.

12. VINCE FLYNN: LETHAL AGENT
Mexican cartels, ISIS and a possible pandemic bring Mitch Rapp back into action.

13. CILKA'S JOURNEY
A 16-year-old, who sleeps with a concentration camp commandant in order to survive, is sentenced to a Siberian prison camp where she cares for the ill.

14. IMAGINARY FRIEND
After disappearing for six days, a boy emerges from the woods with a voice in his head that sends him on a mission.

15. THE ORACLE
A traveler discovers mysteries hidden behind seven locked doors.

JCI and casino.chompcasino.com

Challenge: Load https://casino.chompcasino.com/content/chomp-casino/json/2.1/manifest_multicurrency.json and display those game-items containing a defined title.

Solution: Create a new JCI-template with the following settings.
URL: https://casino.chompcasino.com/content/chomp-casino/json/2.1/manifest_multicurrency.json
urlparam4twig : t

Twig code in template:

{% set t = 'Mont' %}
{% if urlparam.t %}
{% set t = urlparam.t %}
{% endif %}
term: {{t}}<br>
{% for g in games if g.title matches '/'~t~'/i'  %}
title: {{g.title}}<br>
{% for i in g.images %}
{{i.url}}
{% endfor %}
<hr>
{% endfor %}

Create new page with this Shortcode: [jsoncontentimporterpro id=NUMBER_OF_JCI_TEMPLATE]

In Action:

Try also this: http://api.json-content-importer.com/jci-and-casino-chompcasino-com/?t=romance

term: Mont
title: Montezuma
/content/all/images/montezuma/banner.jpg /content/all/images/montezuma/tile.jpg

JCI and TablePress

The Plugin “TablePress” and the PRO version of the JSON Content Importer can work together in this way:

First: Create a new TablePress-Table with e. g. two columns and two rows. Fill the cells with some dummy text. This gives you a shortcode [table id=NUMBER_OF_TABLEPRESS_TABLE].

Second: Create a new JCI-Plugin Template with e. g. some JSON data. The Twig-Code is

name: {{_context.0.name}}
[table “NUMBER_OF_TABLEPRESS_TABLE” not found /]

Third: Create a new WordPress-Page/Post with
[jsoncontentimporterpro id=NUMBER_OF_JCI_TEMPLATE]

Preview this page: You should see some “name”-Data and a Table.

Then change the content of a Table-Cell and insert {{_context.0.name}} there.

Preview the page again: If you see the Twig-Code in the Tablecell go to the JCI-Plugin-Options, Tab Settings and select “first third-party-Shortcodes, 2nd: JSONContentImporter-Shortcode (use this for TablePress, Contact Form 7 etc.)”.

Preview again and you should see the JSON-data in the Table.

If the number of columns or rows is dynamic: Up to my knowleded TablePress has a fixed number of cols and rows. So this is not that flexible.
Maybe Table Sort is an option then.

JCI and Table Press in Action:

name: Do Work You Love Breakfast - 04. Feb - München
1a: {{_context.0.name}}1b
2a2b

API waterservices.usgs.gov and “Auto Refresh API Ajax”

Challenge: Display the data from https://waterservices.usgs.gov/nwis/iv/?format=json&sites=01407600&parameterCd=72279&siteStatus=active

Simply displaying data is easy – create a Plugin template with the above URL and this Twigcode (Shortcode: [jsoncontentimporterpro id=NO_OF_TEMPLATE])

Location:  {{value.timeSeries.0.sourceInfo.siteName}}<br>
Date: {{value.timeSeries.0.values.0.value.0.dateTime | date("Y-m-d",   "America/New_York") }} <br>
Time: {{value.timeSeries.0.values.0.value.0.dateTime | date("H:i",  "America/New_York") }}<br>
Water Level: {{value.timeSeries.0.values.0.value.0.value}}

In Action:

Location: Shrewsbury River at Sea Bright, NJ
Date: 2019-10-18
Time: 21:48
Water Level: -0.11

Display this data with the “Auto Refresh API Ajax” Plugin- Way 1:

  • Install the Plugin
  • Create a HTML-Div like <div id=”araatest”>load data</div>
  • Go to the “Auto Refresh AA” menu and insert this:
  • URL: See above
  • What: value.timeSeries.0.values.0.value.0.value
  • Where: div[id=”araatest”]

Display this data with the “Auto Refresh API Ajax” Plugin- Way 2:

Create a new JSON-Feed by adding a new plugin-template:
URL: https://waterservices.usgs.gov/nwis/iv/?format=json&sites=01407600&parameterCd=72279&siteStatus=active

{"data": "Location:  {{value.timeSeries.0.sourceInfo.siteName}}, Date: {{value.timeSeries.0.values.0.value.0.dateTime | date("Y-m-d",   "America/New_York") }}, Time: {{value.timeSeries.0.values.0.value.0.dateTime | date("H:i",  "America/New_York") }},Water Level: {{value.timeSeries.0.values.0.value.0.value}}"}

Put [jsoncontentimporterpro id=NO_OF_TEMPLATE] on a new page. This page should be something like this:
http://api.json-content-importer.com/json-waterservices-usgs-gov/
Adding “?show=oc” removes the template and gives pure JSON:
http://api.json-content-importer.com/json-waterservices-usgs-gov/?show=oc http://api.json-content-importer.com/json-waterservices-usgs-gov/?show=oc
This JSON we use in “Auto Refresh API Ajax”

In action:

load data

API cryptopanic.com with PRO plugin

Challenge:
How to get access to the data in
https://cryptopanic.com/api/v1/portfolio/?auth_token=… (auth_token needed for real access).

Solution:
For that create a new Plugin-Template with these data
URL: see above
Twig-Template:

portfolio.totals.BTC: {{portfolio.totals.BTC}}<br>
{% for e in portfolio.entries %}
id: {{e.id}}, currency: {{e.currency.title}}, amount_usd: {{e.amount_usd}}<br>
{% endfor %}

Shortcode: [jsoncontentimporterpro id=NO_OF_TEMPLATE]

Live in action:

portfolio.totals.BTC: 1.01098756
id: 99547, currency: Bitcoin, amount_usd: 3517.23513915
id: 99550, currency: Ren, amount_usd: 107.086342464
id: 99548, currency: BitShares, amount_usd: 105.932669292
id: 99549, currency: Gifto, amount_usd: 101.704387806
id: 99591, currency: Request, amount_usd: 75.675883161


Shownotes: Generate Custom Post Types for meetup.com API

Here you find the Code for Copypasting to the Video created to show how the JCI-plugin can generate Custom Post Types out of JSON.

Shownotes
1. Link to JSON:
http://api.json-content-importer.com/extra/json/meetup/1.json

2. Plugin-Settings for Custom Post Tpyes:
type=meetup1;ptredirect=meetup2;ptname=meetups;key=REPLACE_BY_RANDOM_NUMBERS_AND_CHARS

3. Overview-Page: twig-cod

<ul>
{% for m in _parent %}
<li><b>{{m.name}}</b><br>
{{(m.time/1000) | dateformat('%A %m/%d/%y %H:%M:%S ', 'Europe/Berlin', 'en_EN') }}<br>
{{m.venue.address_1}}, {{m.venue.city}}<br>
<a href="/meetup2/id{{m.id}}/">more</a>
</li>
{% endfor %}
</ul>

4. Custom Post Types: twig-code

{{description}}
<hr><b>Location:</b>:<br>
<a href="https://www.google.com/maps?q={{venue.lat}}+{{venue.lon}}" target="_blank">{{venue.address_1}}, {{venue.city}}</a>
Anmerkung: {{how_to_find_us}}
<hr>
<a href="{{link}}" target="_blank">more on meetup.com</a>
<hr>
<a href="/list-of-meetups/">overview on current meetups</a>
<hr>

5. Shortcode for generating page:

[jsoncontentimporterpro url=http://api.json-content-importer.com/extra/json/meetup/1.json id=NUMBER_OF_TEMPLATE_POINT_3 DEAKdebugmode=10 mode=create createoptions='{"type":"meetup1", "loop":"", "title":"{{name}}", "slugname": "id{{id}}", "deleteold":"yes","customfields": #BRO# {"field1":"value1"}, {"field2{{id}}":"date{{#SQM#now#SQM#|date(#SQM#mdY#SQM#)}}"}#BRC#}']

6. WordPress.org Plugin Repository: Cron-Plugins
https://wordpress.org/plugins/search/cron/

API: santannaenergyservices.com

A Job for the PRO plugin is displaying and selecting data from the santannaenergyservices.com API.

Step 1 is creating a plugin-template with this twig-template (instead of concatenating the output you might push it directly)

{% set txt = "" %}
{% for m in model %}
{% set txt = txt ~ "<br>productId: " ~ m.productId%}
{% for r in m.rateScheduleList %}
{% set txt = txt ~ "<br>rateScheduleId: " ~ r.rateScheduleId%}
{% for rsl in r.rateSegmentList if  (rsl.rateSegmentTerm matches '/18 Months/i' ) %}
{% set txt = txt ~ "<br>rateSegmentId: " ~ rsl.rateSegmentId %}
{% for rsdl in rsl.rateSegmentDetailList%}
{% set txt = txt ~ "<br>segmentDetailId: " ~ rsdl.segmentDetailId ~ ", " ~ rsdl.chargeType %}
{% endfor %}
{% endfor %}
{% endfor %}
{% set txt = txt ~ "<hr>" %}
{% endfor %}
{{txt}}

URL:

https://santannaenergyservices.com/productSearch.php?utilityCode=COMILE&stateCode=IL&customerTypeCode=R&serviceTypeCode=E&salesChannelCode=WEB&contractSourceCode=MM

Save the plugin-template and remember the number of the template.
Add this shortcode to an page:

[jsoncontentimporterpro id=NUMBER_OF_TEMPLATE]

This should show you that:


productId: 74
rateScheduleId: 306
rateSegmentId: 306
segmentDetailId: 532, Electric Charges
segmentDetailId: 533, Service Account Charge

productId: 58
rateScheduleId: 164
rateScheduleId: 165
rateScheduleId: 166
rateScheduleId: 167
rateScheduleId: 168
rateScheduleId: 169
rateScheduleId: 170