Translations of this page:


array readAPI(string API ID, string request, [string API Key])

APIs (standardized interfaces, Application Programming Interface) allow third-party services to be incorporated into the developer's own software or questionnaire. The function readAPI() accesses these services directly within the questionnaire.

  • API ID
    The ID of the service to be used. Currently, SoSci Survey supports the following APIs:
  • request
    the request to the API, coded in GET format
  • API Key
    If the use of the API requires a key to be specifed, this is entered as the third parameter. Normally a key is used to calculate the bill for API services.

The function translates the answer of the API directly into an array, which can be set up relatively easily in PHP. Use the function debug() to display the content of the answer.


// request to Google Maps (search for a street using coordinates)
$v = readAPI('google.maps.v3','latlng=40.714224,-73.961452&sensor=false');
// output of street found
html('<p>Straße: '.$v['results'][0]['address_components'][1]['long_name'].'</p>');
// request to Cloudmade
$v = readAPI('cloudmade.geocoding.v2','around=52.4870,13.4248&distance=closest&object_type=address&return_location=true','API-KEY');
en/create/functions/readapi.txt · Last modified: 26.11.2014 16:25 by alexander.ritter
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki