Inhaltsverzeichnis

API for Data Retrieval

SoSci Survey offers an API for data retrieval. Navigate to Collected DataAPI for Data Retrieval to create an API link.

API formats include:

Before you create the API link ('+' symbol in the top right corner), you may choose which records (e.g., interview and/or pretest data, interview date, etc.) may be retrieved (and may not be retrieved).

JSON data retrieval

By default, the API link retrieves all collected data (according to the retrieval criteria defined for the API link).

Export

The JSON file contains the following attributes.

{
  "metadata": {
    "project": "z2018",
    "datetime": "2018-08-01 22:35:18",
    "filter": [
      "Only selected cases: CASE 120, 121"
    ],
    "language": "ger"
  },
  "data": {
    "C120": {
      "CASE": 120,
      "SERIAL": "H3PVKWVM6H",
      "QUESTNNR": "short",
      "MODE": "interview",
      "STARTED": "2018-03-30 21:16:33",
      "T109_01": 4,
      "FINISHED": 1,
      "Q_VIEWER": 0,
      "LASTPAGE": 2,
      "MAXPAGE": 2
    },
    "C121": {
      "CASE": 121,
      "SERIAL": "LSFK1ZX25B",
      "QUESTNNR": "short",
      "MODE": "interview",
      "STARTED": "2018-03-30 21:16:55",
      "T109_01": 2,
      "FINISHED": 1,
      "Q_VIEWER": 0,
      "LASTPAGE": 2,
      "MAXPAGE": 2
    }
  }
}

Parameter

All parameters are optional. If no parameters are added to the API link, all cases (as defined in the retrieval criteria) will be retrieved.

* Multiple SERIALs can be specified separated by commas, e.g. ABCD12,BCDE23. * If both cases and SERIAL are specified, only cases that meet both criteria at the same time are retrieved (intersection).

Examples:

Plain API link:

  https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY

Retrieve only cases 120 and 121 and skip dwell time variables:

  https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY&vSkipTime&cases=120,121

Retrieve only variables STARTED, AB01, AB02 and AB03_01 for cases that changed data after 2018-08-01 12:00:00:

  https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY&vList=STARTED,AB01,AB02,AB03_01&changed=2018-08-01T12:00:00

Retrieve only variable labels:

  https://www.soscisurvey.de/PROJEKT/?act=uDywDXaYyNEY&cases=none&infoValues
  

Data retrieval as CSV

CSV (Comma Separated Values) files are compatible with almost any spreadsheet and statistics program. The same Parameters are available as for JSON retrieval.

CSV for Excel

In „CSV for Excel“, the data is optimized for import into Excel. The following parameters allow to customize the format:

CSV for R

With „CSV for R“ the data are formatted in such a way that they can be read optimally into GNU R. In addition, the parameter type=rScript can be used to retrieve an R script to import the CSV file. This script either uses local data if the parameter csvFile is specified or fetches the current data from the server using API.

Display of Individual Questionnaires

If an API link to view individual questionnaires is called in the browser, SoSci Survey offers an open input field for the number of the desired questionnaire (CASE). After entering the number the print preview is shown.

Note: If the API link only allows access to a single case, it will be displayed immediately without asking for the number.

Note: The print view is subject to the same restrictions as when called up via Collected dataView data → Printer icon. Among other things, questions with rotated items in completed interviews use a different (random) order of items than in the interview.

Records by Person Code (SERIAL)

An API link for listing records by person code must have a SERIAL parameter added to the call, e.g.

  https://www.soscisurvey.de/project/?act=sIyhrICdaBxl6qiMagedOU1K&SERIAL=ABC12345
  

Returned is an object in JSON notation that contains the query status (result) and some meta data (meta) as well as an array of which records have this person identifier (SERIAL) in the record.

{
    "result":"ok",
    "meta":{
        "project":"project",
        "datetime":"2020-07-14 16:03:00",
        "count":1
    },
    "cases":[
        {
            "CASE":"145",
            "SERIAL":"ABC12345",
            "FINISHED":true
        }
    ]
}

The meta-information count refers to the number of matching records. Only those records that meet the criteria specified when the API link was created will be searched.