Question: I am using django-rest-framwork and django-rest-swagger.

The problem is that I'm fetching data directly from the body of the request:

```
def put(self, request, format=None):
    """                                                                                                                                                                                                
    This text is the description for this API                                                                                                                                                          
    username -- username                                                                                                                                                                               
    password -- password                                                                                                                                                                               
    """
    username = request.DATA['username']
    password = request.DATA['password']

```

but when I try the request from the swagger-ui I can't specify the "parameter type" (it's by default query and can't find a way to change it from the docstring)

I have managed to get around my problem by changing some line in the function *build\_query\_params\_from\_docstring* from the file *"introspectors.py"* but I was wondering if there is another way to do it.

Answer: 
UPDATE: This answer only works for django-rest-swagger < 2, see the comment from @krd below.

The docs: <http://django-rest-swagger.readthedocs.org/en/latest/yaml.html>

If you want to put form-data:

```
def put(self, request, format=None):
    """
    This text is the description for this API.

    ---
    parameters:
    - name: username
      description: Foobar long description goes here
      required: true
      type: string
      paramType: form
    - name: password
      paramType: form
      required: true
      type: string
    """
    username = request.DATA['username']
    password = request.DATA['password']

```

For a JSON body you can do something like:

```
def put(...):
    """
    ...

    ---
    parameters:
    - name: body
      description: JSON object containing two strings: password and username.
      required: true
      paramType: body
      pytype: RequestSerializer
    """
    ...

```
[enter image description here][1]For me it worked with the `ManualSchema`. You have to define the description and fields. See:

```
from rest_framework import views
import coreapi
import coreschema
from rest_framework.schemas import ManualSchema

class RegisterView(views.APIView):

    schema = ManualSchema(
        description="User register endpoint.",
        fields=[
            coreapi.Field(
                'username',
                required=True,
                location='path',
                description='A unique username',
                schema=coreschema.String(),
                ),
            coreapi.Field(
                'password',
                required=True,
                location='path',
                schema=coreschema.String(),
                ),
            ]
        )

    )
    ...

```