Configuration¶
The various “fetch” methods of the connector all take the same parameters:
Parameter | Data type | Description |
---|---|---|
uri | string | URI of the JSON resource to read. This may be any of the following syntaxes:
|
encoding | string | Encoding of the data found in the file. This value must match any of the encoding values recognized by the PHP libray “mbstring”. See https://www.php.net/manual/en/mbstring.supported-encodings.php |
headers | array | Key-value pairs of headers that should be sent along with the request. The syntax is as follows: Example: 'headers' => [
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:75.0) Gecko/20100101 Firefox/75.0'
'Accept' => 'application/json'
]
|
useragent | string | This parameter was removed. Please use “headers” instead. User agent to fake. This is sometimes necessary to bypass access restrictions on some sites. Don’t include the “User-Agent:” part of the header. Example: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 |
accept | string | This parameter was removed. Please use “headers” instead. Type of content accepted. This is sometimes necessary to really get the data in JSON format. Don’t include the “Accept:” part of the header. Example: application/json |
Note
When using this connector with external_import, please mind that the JSON data may not fit the structure expected by external_import. Indeed this extension expects data of type array to be purely two-dimensional, i.e. an indexed list of associative sub-arrays.
Use a hook like processArray
in svconnector_json to transform the
data’s structure before feeding it into external_import.