Step 6: Shortcode parameter

Step 5 showed you the basic usage of the Shortcode: There the parameter “url” is used. Besides “url” you can use some more parameter:

Shortcode-Parameter value of parameter
url= http://…json (use http://username:password@www…. for basic authentification)
removeampfromurl= If set to "=yes" then "&" in the URL is replaced by "&". This is needed if 3rd party software like VisualComposer changes the text of a Shortcode
numberofdisplayeditems= number: how many items of level 1 should be displayed? display all: leave empty or set -1
urlgettimeout= number: who many seconds for loading url till timeout?
cachetime= Before Version 3.3.5 all Cache-Settings were in the Plugin-Options and valid for all URLs. Now you can add "cachetime=n" to set the cachetime for this Shortcode to n seconds – regardless of the settings in the plugin-option, even when caching is switched of there.
feedsource= PRO-Feature (from 3.1 on): by using feedsource=file you can load JSON-feeds from the server-filesystem
feedfilename= directories and name of JSON-feed from the server-filesystem (encanced by basepath, see Plugin-Options: "Settings" > "Load JSON-data from server filesystem"

PRO-Feature (from 2.0.9. on) Dynamic JSON-feed URL The Shortcode-Parameter "url" is static by default. If switched on in the Plugin-options with the following 3 Shortcode-Parameter you can change the URL of the JSON-Feed via GET-Parameter.
urlparam= List separated by # of allowed GET-variablename used in the JSON-Feed-URL. E.g. "var1#var2". Special: aaa%5Bbbb%5D / [aaa]=bbb. Some GET-variablename are "forbidden", as WordPress uses them by their own and is filtering it (e.g. "p=…"). So we have to mask those by adding "_nowpquery": Use "p_nowpquery" instead of "p". The plugin will use "p=…" in the API request. If a form (e.g. with checkboxes) passes a []-Field to the Plugin, the urlparam must be set to "model%5B%5D". Then "model[]" can passed to the API.
urladdparam= You can define an URL in the plugins templatemanager. If at a page this URL must be extended you can use the shortcode-parameter “urladdparam”. Example: [jsoncontentimporterpro urladdparam=”?lets=go” id=3] Then “?lets=go” will be added to the URL defined in template 3. So you can work with a template-url and twig code and can specify this a bit at the wordpress-page.In urladdparam you can put shortcodes of 3rd party plugins: For that we have to mask the brackets [ and ] with #BRO# and #BRC#. So it looks like urladdparam\="?mail=#BRO#s2Get%22user_field=user_email#BRC#" to put the shortcode [s2Get user_field=user_email] nto the URL.
pathparam= List separated by # of allowed GET-variablenames for the path of the JSON-Feed-URL. E.g. "path1#path2#pagename"
fileext= Static (not changeable via GET) extension of the JSON-Feed-URL. E.g. if "php" ".php" is added to the URL. If fileext starts with an "?", then no "." is added. This is useful when passing apikeys like "?apikey=007"
Example-URL Lets say url="http://jsonserver…". With the upper examples, this gives us the complete JSON-feedurl in this way: "http://jsonserver…/GET_VALUE_path1/GET_VALUE_path2/GET_VALUE_pagename.php?var1=GET_VALUE_var1&var2=GET_VALUE_var2" where "GET_VALUE_item" the GET-value of "item=…" is when calling the wordpress-page in the browser like "http://wordpressserver…/page?path1=one&path2=two&pagename=mypage&var1=10&var2=40"
customfieldparam= NAMES_OF_CUSTOMFIELDS Define some comma-separated variables in the Shortcode-Parameter “customfieldparam” like “customfieldparam=param1,param2”. In the JSON-feed-URL you can then use this Parameter in this way: “http://wherever/path/<cf_param1>/page.json?par=<cf_param2>”. Then set the WordPress-Customfields param1 and param2 on the page you use this shortcode. When building the page, <cf_param1> and <cf_param2> will be replaced by the customfield-values. See also this example.. The reaulting JSON will contain the value of the Custom Field, so that it is avalable in twig by {{cfp.NAMES_OF_CUSTOMFIELD}}
urlgetaddrandom=yes If set to "yes" the plugin adds a random-parameter to the GET-URL to bust a API-cache. Ignored if not set to "yes".

PRO-Feature Shortcode-Parameter: select template-engine either "JCI" or "twig"
parser=twig if set the twig-1.X-template engine is used. otherwise the JCI-template engine is used by default
parser=twig243 if set the twig-2.4.3-template engine is used (requires PHP 7.0.0. or higher).
trytohealjson=yes Some APIs / URLs deliver invalid JSON (invalid in the sense PHP-libraries can't handle it). This is due to invalid Characters before or after the first square or curled brackets. When setting "trytohealjson=yes" those Characters are emoved from the JSON before used in the Plugin.
debugmode=NUMBER Prior to version 3.3.6 there was either debug=on or off for the whole page. By "debugmode=NUMBER" you can set the debugmode for each shortcode: NUMBER=2 shows some debug infos, NUMBER=10 all available debug infos.
convertjsonnumbers2strings=yes (from Version 3.4.0 on) If set to "yes" any number in the JSON-Feed is converted to a string. This is importaint for very big or small numbers, as those are otherwise displayed in scientific-notation like 1.4e-20

PRO-Feature (from 3.4.0 on) Shortcode-Parameter: create WP-Pages
mode=create If set to "create" the plugin creates Custom-Post-Type pages. So you can create Pages out of a JSON-API-Feed.
createoptions= JSON-coded rules for creating the Custom-Post-Type pages.

PRO-Feature (from 3.0.2 on) Shortcode-Parameter select http-method: "GET" / "POST" / "CURL"
default,no method defined GET-method with wordpress-GET-Function
method="post" The JSON-feeds are retrieved by wordpress-http-GET by default. If you want to switch to wordpress-POST use method="post" as shortcode-parameter.
method="rawget" If you want to switch to PHP-GET use method="rawget" as shortcode-parameter.
method="rawpost" If you want to switch to PHP-GET use method="rawpost" as shortcode-parameter.
method="curlget" If you want to switch to CURL-GET use method="curlget" as shortcode-parameter. See also Plugin-Options "curl-settings" for CURL-Authenatication-Settings.
method="curlpost" If you want to switch to CURL-POST use method="curlpost" as shortcode-parameter. See also Plugin Options "curl-settings" for CURL-Authenatication-Settings.
curloptions="LIST_OF_CURL_OPTIONS" When you check the access to your API-URL the best way is to do it with CURL. Then you can set many CURL-options as the way of authentication, the header etc.. Before Version 3.4.5 this was possible in some ways, but now in all ways. To do this, you can set up the shortcode-parameter “curloptions”. Example: [jsoncontentimporterpro url=… method=curlget curloptions="CURLOPT_HTTPAUTH=CURLAUTH_BASIC;CURLOPT_TIMEOUT=30;CURLOPT_HTTPHEADER=a:b##c:d"]…[/jsoncontentimporterpro]The “CURLOPT_…” must be separated by “;”. Then “CURLOPT_…=value” sets an option. “value” there can be a number or a constant like “CURLAUTH_DIGEST”. Example: “CURLOPT_TIMEOUT=30” sets the timeout to 30 seconds. “CURLOPT_HTTPAUTH=CURLAUTH_BASIC” sets basic auth. If a “CURLOPT_…” needs an array-input you can do it like this (separate array-items by “##”): "CURLOPT_HTTPHEADER=a:b##c:d"
postpayload="JSON_PAYLOAD" Add data to header: Some POST-APIs need inputdata like that. If "JSON_PAYLOAD" contains strings like "POSTGET_something" where something is a letter or number this is replaced by the value of the "something" GET / POST parameter. If "JSON_PAYLOAD" must contain ] or [ use #BRO# ("bracket-open") and #BRC# ("bracket-close") instead, otherwise wordpress gets confused.
urlencodepostpayload=no Add this, if the postpayload should not be urlencoded. It depends on what the API requires.
postbody="JSON_BODYLOAD" Add data to the http-body: Some POST-APIs need inputdata like that. If "JSON_BODYLOAD" must contain ] or [ use #BRO# ("bracket-open") and #BRC# ("bracket-close") instead, otherwise wordpress gets confused.

PRO-Feature Shortcode-Parameter for http-header and Authentication
header="key_a:val_a##b:key_b##…" pass http-header to API, see "List of HTTP header fields"
auth="key_a:val_a##b:key_b##…" usage like "header=…" above, but attached to "headers"-field in http-header.

PRO-Feature Shortcode-Parameter template manager call template from shortcode
id= unique id / number of the template given in the template-manager
nameoftemplate= unique name of the template given in the template-manager

JCI-template engine only ignored when twig-template engine is selected
basenode= starting point of datasets, the base-node in the JSON-Feed where the data is
oneofthesewordsmustbein= default empty, if not empty keywords separated by ','. At least one of these keywords must be in the created text (here: text=code without html-tags)"
oneofthesewordsmustbeindepth= default: 1, number:where in the JSON-tree oneofthesewordsmustbein must be?
oneofthesewordsmustnotbein= default empty, if not empty keywords separated by ','. If at least one of the keywords is in the created text, this text is not displayed"
oneofthesewordsmustnotbeindepth= default: 1, number:where in the JSON-tree oneofthesewordsmustnotbein must be?

PRO-Feature Shortcode-Parameter used only for JCI-template engine ignored when twig-template engine is selected
Display only some JSON-data remove and filter. Yet only possible in the top level of the JSON-tree
requiredfieldsandvalues= default empty, list of #" separated filednamesm where the required value is added by "=". E.g. "code=EUR,CAD#rate=18" means, the either the datafield "rate" has to be 18 OR the datafield "code" has to be EUR or CAD.
requiredfieldsandvaluesdepth= default: 1, number:where in the JSON-tree requiredfieldsandvaluesdepth must be?
requiredfieldsandvalueslogicandbetweentwofields default empty, if yes" the logic between two "#" separated datafields is AND (and not OR!). In the above example then both "rate" and "code" must match. Whereas the "," separated values are always OR connected!
dodisplayonlyif= default empty, define a POST/GET-parameter, that must be in the input. Otherwise nothing is displayed. E.g. POST:varname1:varnamevalue1" means, that in the calling wordpress-site "variablename=variablevalue" must be sent either by POST (GET also possible). Allowed chars for varname1 nd varnamevalue1: [0-9a-zA-Z_-.;] This is for checking if such a call comes from a special form.
filterfieldremove= default empty, "," separated list of filters. If there is an "=" in the filter, the "filter=filtervalue" is handled as such: The value if the datafield "filter" must regexp-match "filtervalue". If there is no "=", then a POST- or GET-input is required: The value of the Post/GET-input is then the value. regexp means, that the parts defined by an regular-expression must match of the "filtervalue". E.g. "test123" can be matched by something like"^([a-z]+)\d{3}$". See… for more. If there is no match, this datafield and his whole underlying tree is removed from the JSON and is not displayed.
filterfieldrequired= default empty, almost the same as "filterfieldremove", but the "," separteded filed/values are connected by OR. So if one of it matches, this JSON-data is not displayed.
Sorting the data from the JSON-feed yet only possible in the top level of the JSON-tree
sortfield= default empty, Sort JSON-feed by the here defined datafield.
sortorderisup= default empty and then set to FALSE. If set to "yes" the sorting order is reversed.
sorttypeisnatural= default FALSE and set to non-natural sorting. If set to "yes" the JSON-feed is sorted "natural". See here for details about "natural sorting".