API: api.coinpaprika.com with free and PRO JCI-Plugin

Challenge:
Show data from https://api.coinpaprika.com/v1/exchanges/paribu?quotes=TRY
Solution with the free JCI-Plugin:
[jsoncontentimporter url=https://api.coinpaprika.com/v1/exchanges/paribu?quotes=TRY]
{subloop:quotes:-1}
{subloop:quotes.TRY:-1}
reported_volume_24h = {quotes.TRY.reported_volume_24h}
{/subloop:quotes.TRY}
{/subloop:quotes}
[/jsoncontentimporter]

In Action:
reported_volume_24h = 68503846.3082
Solution with the PRO JCI-Plugin:
Create a template with URL https://api.coinpaprika.com/v1/exchanges/paribu?quotes=TRY and this twig-code:
{% set lire = quotes.TRY.reported_volume_24h|split('.') %}
reported_volume_24h = {{lire.0 | formatnumber(0, '', ',') }}.{{lire.1}}

Store this JCI-Template and use it in a shortcode in this way:
[jsoncontentimporterpro id=_NO_OF_TEMPLATE convertjsonnumbers2strings=yes]

In Action:
reported_volume_24h = 68,503,846.30823986

Numbers and Strings in free and PRO plugin

Numbers and Strings:
See this JSON:
{"num": 3.5050, "str": "3.4040" }

There is a little difference: “num” is without quotation marks, “str” is with. The JSON Content Importer Plugin and the PHP behind that handles the “num” as numeric data and removes the 0 at the end.
Free jsoncontentimporter:
[jsoncontentimporter url=http://api.json-content-importer.com/extra/json/number.json]num: {num}, str:  {str}[/jsoncontentimporter]

gives us this:
num: 3.505, str: 3.4040
To “save” the 0 you need the PRO plugin – unfortunately: There “convertjsonnumbers2strings=yes” converts the JSON to do this.
[jsoncontentimporterpro url=http://api.json-content-importer.com/extra/json/number.json convertjsonnumbers2strings=yes  parser=twig]
{{num}} {{str}}[/jsoncontentimporterpro]

gives us this:
num: 3.5050, str: 3.4040

PRO JCI Plugin and the API of openweathermap.org

The API of openweathermap.org gives Feeds like https://samples.openweathermap.org/ and inside that JSON like https://samples.openweathermap.org/data/2.5/weather?q=London&appid=…

This can be used by the PRO JSON Content Importer Plugin for searching the weather:

For that you need a Shortcode and a JCI-Template.


1. The Shortcode:

Continue reading “PRO JCI Plugin and the API of openweathermap.org”

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. SOOLEY
Samuel Sooleymon receives a basketball scholarship to North Carolina Central and determines to bring his family over from a civil war-ravaged South Sudan.


2. THE HILL WE CLIMB
The poem read on President Joe Biden's Inauguration Day, by the youngest poet to write and perform an inaugural poem.

3. FINDING ASHLEY
Two estranged sisters, one a former best-selling author, the other a nun, reconnect as one searches for the child the other gave up.

4. A GAMBLING MAN
Aloysius Archer, a World War II veteran, seeks to apprentice with Willie Dash, a private eye, in a corrupt California town.

5. THE FOUR WINDS
As dust storms roll during the Great Depression, Elsa must choose between saving the family and farm or heading West.

6. THE MIDNIGHT LIBRARY
Nora Seed finds a library beyond the edge of the universe that contains books with multiple possibilities of the lives one could have lived.

7. OCEAN PREY
The 31st book in the Prey series. When federal officers are killed, Lucas Davenport and Virgil Flowers team up to investigate matters.

8. WHEREABOUTS
A woman who feels lost in life finds solace in the city she calls home and gets a new outlook while visiting the sea.

9. THE INVISIBLE LIFE OF ADDIE LARUE
A Faustian bargain comes with a curse that affects the adventure Addie LaRue has across centuries.

10. THRAWN ASCENDANCY: GREATER GOOD
In this Star Wars saga, Thrawn and the Expansionary Defense Fleet discover how their enemy truly operates.

11. A DISTANT SHORE
A secret agent with the F.B.I. and a young woman betrothed by her father to a drug lord pretend to be in love for a mission.

12. THE VANISHING HALF
The lives of twin sisters who run away from a Southern Black community at age 16 diverge as one returns and the other takes on a different racial identity but their fates intertwine.

13. KLARA AND THE SUN
An “Artificial Friend” named Klara is purchased to serve as a companion to an ailing 14-year-old girl.

14. FUGITIVE TELEMETRY
The sixth book in the Murderbot Diaries series. When a dead body turns up on Preservation Station, Murderbot must speak to humans.

15. REUNION BEACH
A collection of stories and other writing inspired by the work of the late author Dorothea Benton Frank.

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

Twig-Error: Unexpected token "name" of value "if" ("end of statement block" expected).