Survey Template API

SurveyTemplateSerializer

Create:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type:application/json" -X POST --data '{"name": "survey name", "user": "/rest-api/users/1/"}' http://HOSTNAME_IP/rest-api/survey-template/

Response:

HTTP/1.0 201 CREATED
Date: Fri, 14 Jun 2013 09:52:27 GMT
Server: WSGIServer/0.1 Python/2.7.3
Vary: Accept, Accept-Language, Cookie
Content-Type: application/json; charset=utf-8
Content-Language: en-us
Location: http://HOSTNAME_IP/rest-api/survey-template/1/
Allow: GET, POST, HEAD, OPTIONS

{
    "url": "http://127.0.0.1:8000/rest-api/survey-template/27/",
    "name": "Survey created from API",
    "description":null,
    "created_date": "2021-06-19T20:34:47.283180+02:00",
    "updated_date": "2021-06-19T20:34:47.283199+02:00",
    "user": "http://127.0.0.1:8000/rest-api/users/1/"
}

Read:

CURL Usage:

curl -u username:password -H 'Accept: application/json' http://HOSTNAME_IP/rest-api/survey-template/

    or

curl -u username:password -H 'Accept: application/json' http://HOSTNAME_IP/rest-api/survey-template/%survey-template-id%/

Response:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "url": "http://HOSTNAME_IP/rest-api/survey-template/1/",
            "name": "Sample survey campaign",
            "description": "ok",
            "created_date": "2016-01-13T12:42:18.148",
            "updated_date": "2016-01-13T12:42:31.527",
            "user": "http://HOSTNAME_IP/rest-api/users/1/"
        }
    ]
}

Update:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X PATCH --data '{"name": "sample survey"}' http://HOSTNAME_IP/rest-api/survey-template/%survey-template-id%/

Response:

HTTP/1.0 202 NO CONTENT
Date: Fri, 23 Sep 2011 06:46:12 GMT
Server: WSGIServer/0.1 Python/2.7.1+
Vary: Accept-Language, Cookie
Content-Length: 0
Content-Type: text/html; charset=utf-8
Content-Language: en-us

Delete:

CURL Usage:

curl -u username:password --dump-header - -H "Content-Type: application/json" -X DELETE  http://HOSTNAME_IP/rest-api/survey-template/%survey-template-id%/