-
Notifications
You must be signed in to change notification settings - Fork 197
Query Setup. Generic
With the Generic module you can fetch data from a lot of different APIs. For this an API needs to fulfill two preconditions: it has to deliver JSON encoded data and access should be possible without sophisticated authorization procedures. One example for APIs meeting these criteria is Google+, see the presets coming with Facepager and the providers documentation. Authorization is sometimes done by access tokens, which you get from the provider and set as parameters in the Query Setup.
The URL of your request is assembled by concatenating the Base path, Resource and Parameters. It is up to you which part of the URL you put into the Base path or the Resource. You even can put the full URL into the Base path and omit Resource and Parameter setting.
Please remind: This screenshot was taken on 25th of June in 2018. If you try this out yourself, remind that APIs are changing constantly, so this approach may be outdated by the time you read this text.
Query settings | Explanation |
---|---|
Base path | Enter the first part of the URL to the API into this field. The specific URLs have to be looked up in the documentation of the API provider. |
Resource | The resource value simply is added to the base path. You can use placeholders to refer to node data, see the help section about placeholders and keys. |
Parameters | Every URL consists of different parts. One of these parts is called the query string, which consists of name-value pairs concatenated with ampersands. The query string starts with a question mark. For example, the query string of the URL https://gdata.youtube.com/feeds/api/videos?q=Facepager&alt=json&v=2 is ?q=Facepager&alt=json& v=2 . By using parameters you define the name-value pairs in the query string. You don’t need to use the parameter fields, the full URL may be entered into the URL path field as well. The parameter field is just a convenient way to assemble query strings and to define placeholders. |
Headers | In addition to an URL you can sent so called headers to a server. Headers are used to set the preferred language settings, to send cookies and for a lot of other things. See https://en.wikipedia.org/wiki/List_of_HTTP_header_fields for a general explanation. You may need to use headers to authorize. For example, if you want to fetch data from Google APIs you need to send your access token with a header field like explained in the presets. |
Key to extract | Use this setting to specify which objects you are interested in. To find out the right value try it out with a blank value first. Then lool into the Data View to find the key which contains the data you aim for. Facepager will extract the data addressed by the key and create a childnode. If the addressed data consists of a list, one childnode for every list item is created. The not addressed, remaining data will be put into an additional childnode of the type “offcut”. Alternatively you can create childnodes from a list manually after fetching data with the “Unpack List” button found above the Data View. |
Key for ObjectID | With this setting you choose the value which (after extraction) should denote the Object ID of the node. |
Some interesting APIs may be found on www.programmableweb.com.
Searching for more answers and explanations? Just read our FAQ.