Actions

REST API: Difference between revisions

From LimeSurvey Manual

No edit summary
No edit summary
Line 34: Line 34:
==Endpoints==
==Endpoints==


See the  [https://api.limesurvey.org/swagger Swagger Documentation] for more details.
See the  [https://api.limesurvey.org/swagger Swagger Documentation] for full details.


{| class="wikitable"
; /rest/v1/
! Method !! Prefix !! Endpoint !! Notes !! HEADER params !! URL Path params !! POST params !! GET params !! Command Class !! Command Params
: session
|-
: session
|  ||  ||  ||  ||  ||  ||  ||  ||  ||
: siteSettings
|-
: siteSettings/<setting-name>
|  || /rest/v1/ ||  ||  ||  ||  ||  ||  ||  ||
: survey
|-
: survey/<id>
| POST || * || session || create new session token ||  ||  || (string)username, (string)password, (string)?plugin ||  || SessionKeyCreate || (string)username, (string)password, (string)?plugin
: questionGroup/<surveyId>
|-
: questionGroup
| DELETE  || * || session ||  || Authorization ||  ||  ||  || SessionKeyRelease || (string)sessionKey
: questionGroup/<groupId>
|-
: questionGroupProperties/<groupId>  
|  ||  ||  ||  ||  ||  ||  ||  ||  ||
: questioGroupProperties/<groupId>  
|-
| GET || * || siteSettings || list || Authorization ||  ||  ||  || SiteSettingsGet || (string)sessionKey, (string)?settingName
|-
| GET || * || siteSettings/<setting-name> || single || Authorization || settingName ||  ||  || SiteSettingsGet || (string)sessionKey, (string)?settingName
|-
|  ||  ||  ||  ||  ||  ||  ||  ||  ||
|-
| POST ||  || survey ||  || Authorization ||  || (int)surveyID, (string)surveyTitle, (string)surveyLanguage, (string)format ||  || SurveyAdd || (string)sessionKey, (int)?surveyID, (string)surveyTitle, (string)surveyLanguage, (string)format
|-
| DELETE ||  || survey/<id> ||  || Authorization || id ||  ||  || SurveyDelete || (string)sessionKey, (int)surveyID
|-
|  ||  ||  ||  ||  ||  ||  ||  ||  ||
|-
|  ||  ||  ||  ||  ||  ||  ||  ||  ||
|-
|  ||  ||  ||  ||  ||  ||  ||  ||  ||
|-
| GET || * || questionGroup/<surveyId> || list || Authorization || id ||  || groupSettings, language ||  || (string)sessionKey,
|-
| POST || * || questionGroup || create || Authorization ||  || (int)surveyID, (string)groupTitle, (string)groupDescription || (string)language ||  || (string)sessionKey, (int)surveyID, (string)groupTitle, (string)groupDescription
|-
| DELETE || * || questionGroup/<groupId> || delete || Authorization || id ||  ||  ||  || (string)sessionKey, (int)surveyID, (int)groupID
|-
| GET || * || questionGroupProperties/<groupId> || single || Authorization || id || (array)groupSettings, (string)language ||  ||  || (string)sessionKey
|-
| PUT || * || questioGroupProperties/<groupId> || update || Authorization || id ||  ||  ||  || (string)sessionKey,
|}


=Examples=
=Examples=


==PHP Example==
==PHP Example==

Revision as of 13:33, 18 October 2022

TODO

Under development

Available from version x (LS 5.5.0?)

Available API endpoints

Technical specification. UML.

Introduction

LimeSurvey REST API v1 is available in LS 5.5.0 or more recent which offers various API endpoints.

Setup

Configure

In order to use REST API you must first enable the service, and then adjust the settings to suit your needs. To enable login to the LimeSurvey administration, go to Global settings, choose the tab 'Interfaces' and select 'Publish API on /rest'.

Security

The REST API uses the same security measures as the normal administration login. That means that the permission set of the used username and password is the same as if you would login in the administration with that user/password. Also the REST API is protected against brute-force password cracking - like the normal administration login.

Usage

API Location

The REST API URL is http://www.yourdomain.com/rest/v1 .

The available API endpoints are documented using swagger https://api.limesurvey.org/swagger.

Sessions

Endpoints

See the Swagger Documentation for full details.

/rest/v1/
session
session
siteSettings
siteSettings/<setting-name>
survey
survey/<id>
questionGroup/<surveyId>
questionGroup
questionGroup/<groupId>
questionGroupProperties/<groupId>
questioGroupProperties/<groupId>

Examples

PHP Example