Shortcode parameter

Step 1 and Step 2 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).The following several features are PRO-Plugin only: 1. If you define a relative URL (starting with "/") here, home_url is added. This helps when switching domains (e. g. from dev- to live-server). Also you can insert twig-code (e. g. {{urlparam.GETPARAM}}, ##param1## and ##param2## in the URL as placeholder. The twig-code is executed with an empty JSON and ##param1/2## is replaced by the values of the shortcode-parameters with the same name.\n 2. Try "dummyrequest" for having JSON with basic Page-Parameters. 3. <post.FIELD> in the URL is replaced by Value of FIELD of the Page (e. g. PageID).
removeampfromurl= If set to "=yes" then "&amp;" in the URL is replaced by "&". This is needed if 3rd party software like VisualComposer changes the text of a Shortcode. PRO-Plugin: Put the URL into a JCI-plugin template.
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= 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: by using feedsource=file you can load JSON-feeds from the server-filesystem
feedfilename= PRO-Feature: directories and name of JSON-feed from the server-filesystem (encanced by basepath, see Plugin-Options: "Settings" > "Load JSON-data from server filesystem"
httpstatuscodemustbe200=no If set to "no": accepts that some APIs deliver valid and usable JSON and an http-error (aka no "200"). Without that, the plugins says: No http-ok from the API, hence ignore JSON.
nojsonvalue=y If "nojsonvalue=y" the API-Answer is available as {nojsonvalue}, helpful if the API answer is not JSON (only free JCI-Plugin as of 1.3.11, the PRO-Plugin is doing this automatically if needed)

PRO-Feature 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.
urlparam4twig= Same as "urlparam" but esp. designed for use in twig-code
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%22 user_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 resulting JSON will contain the value of the Custom Field, so that it is available in twig with {{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".
secret=PASSWORD if set in the shortcode the plugin expects the GET-param "sec=PASSWORD" in the calling WordPress-URL. If the PASSWORD is invalid the plugin aborts
inputtype=XML if your API gives you XML, this shortcode-parameter tries to convert the XML to JSON. if needed "" and "" is removed at SOAP-request – otherwise the conversion will fail
inputtype=csv if your API gives you csv, this shortcode-parameter tries to convert the csv to JSON.
inputtypeparam=.. Define, how the csv should be converted to JSON by the PHP-function str_getcsv: The settings must be encoded in a valid JSON-Set like this: {"delimiter": ",", "enclosure": "#QM#", "escape":"#BS#", "csvline": "#LF#", "skipempty": "yes"} – for 4 special chars some placeholders must be used: #QM# stands for a quotation mark, #BS# for Backslash, #LF# for Linefeed and #CR# for carriage return – if skipempty is "yes" emtpy line in the csv are ignored

PRO-Feature Shortcode-Parameter: select template-engine either "JCI" or "twig"
parser=twig3 if set the twig-3-template engine is used (recommended).
parser=twig243 if set the twig-2.4.3-template engine is used.
parser=twig if set the twig-1.X-template engine is used. otherwise the JCI-template engine is used by default
trytohealjson=yes (parser=twig or parser=twi243 required!) 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 removed 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
maskspecialcharsinjson=no (from Version 3.4.8 on) If set to "no": switches off some usually very good handling of JSON (rare JSON needs that)
addpostdata2json=y If set to "y", JSON-data is added to the API-received data: In the node "jcipageparam" the values of the WP_Post OBJECT ("get_post", e. g. Page-ID, post_date), permalink, home_url, current-user-id are inserted. By {{}} etc. twig can work with this data.
addcpf2json=y If set to "y", JSON-data is added to the API-received data: In the object "jcipageparam" the values of the Custom Post Fields (if there are some). By {{jcipageparam.custom_fields.NAME_OF_CPF}} and similar twig can work with this data.
displayapireturn= If an API does not give JSON,but the pure data like for an images you can use this parameter. The data is put into an JSON like {{"data":"…"}}, so {{data}} gives the magedata for display via HTML. displayapireturn=1 (pass directly), displayapireturn=2 (pass base64_encoded), displayapireturn=4 (remove linefeeds)
encodingofsource=… the plugin needs UTF-8 encoded data. If the API does not gives UTF-8 encoded data, it has to be converted. The value of encodingofsource is used for iconv to do this. E. g. is "utf-16le"
orderofshortcodeeval= if set, it overrides the settings of "Usage of Shortcodes (JCI or other) in the JCI-twig-Template" at the tab "Shortcode-Settings". Importaint when having other shortcodes in the twig-Template. If set to 1 (default) first the twig-code in the JSONContentImporter-Shortcode is executed and after that remaining Shortcodes. If set to 2, shortcodes are executed and then twig. any other value: No shortcode-execution, which is ok: You can execute shortcodes in twig by "doshortcode".

PRO-Feature 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 Shortcode-Parameter select http-method: "GET" / "POST" / "CURL"
method you can set the method for the API-request in the shortcode. But it is highly recommended to do this in the PRO-plugin template. There you can select GET, POST, PUT via functions from WordPress, Raw-PHP or CURL
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”. It is highly reccomended to set the curloptions via the plugins-template-manager! Example: [jsoncontentimporterpro url=… method=curlget curloptions="CURLOPT_HTTPAUTH=CURLAUTH_BASIC;CURLOPT_TIMEOUT=30;CURLOPT_HTTPHEADER=a:b##c:d;CURLOPT_POSTFIELDS=e:f##g::h"]…[/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". CURLOPT_POSTFIELDS=e:f##g::h sends an array to the API (then "multipart/form-data"). If CURLOPT_POSTFIELDS is an valid JSON-String (via template-manager), a string is sent to the API (then "application/x-www-form-urlencoded"). It depends on the API what way is ok.
curloption CURLOPT_UPLOAD_POSTFIELDS There is a JCI-proprietary Curl-option "CURLOPT_UPLOAD_POSTFIELDS". This can be used when you upload a file with a HTML-Uploadform for storing this file in ther WordPress-Medialibrary or send this Upload to an API. Example for the syntax: CURLOPT_UPLOAD_POSTFIELDS={\"field1\": \"value field 1\", \"field 2\":\"value of field 2\", \"jciuploadfiles\": #BRO# { \"name\": \"FileUpload\", \"filename\":\"name-of-file\", \"store_upload_in_library\":\"yes\", \"library_file_name\":\"name-of-file-in-wp-lib\", \"uploadsamefilename\":\"no\" } #BRC# }
postpayload="JSON_PAYLOAD" Add data to header: Some POST-APIs need inputdata like that. If "JSON_PAYLOAD" must contain valid JSON! 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 ] or [ is in the JSON use #BRO# ("bracket-open") and #BRC# ("bracket-close") instead, otherwise wordpress gets confused.
showapiresponse=1 if you upload mediafiles with the JCI-plugin (see CURLOPT_UPLOAD_POSTFIELDS with store_upload_in_library=yes), "showapiresponse=1" adds a JSON-node "apiresponseinfo" with info on the uploaded file (like "attachment_id") to be able to use this upload in the JCI-template

PRO-Feature Shortcode-Parameter for http-header and Authentication effect
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
forcetemplate= if set to 1, then all settings from the JCI-Template are used (otherwise a parameter set in the Shortcode overwrites it´s template-parameter)

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".