Fixed some small errors
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# VideoAPI
|
||||
|
||||
## Search
|
||||
`GET \api?param=value`
|
||||
`GET /api/?param=value`
|
||||
|
||||
### Parameters
|
||||
| Param | Value |
|
||||
@@ -21,6 +21,4 @@
|
||||
```
|
||||
|
||||
### Examples
|
||||
> `GET /api?q=foo&limit=3` will return the first 3 videos with "foo" in their name.
|
||||
|
||||
|
||||
> `GET /api/?q=foo&limit=3` will return the first 3 videos with "foo" in their name.
|
||||
|
||||
@@ -7,7 +7,7 @@ from core.serializers import VideoSerializer
|
||||
@api_view(['GET'])
|
||||
def videoAPI(request):
|
||||
q = request.GET.get('q', '')
|
||||
l = request.GET.get('limit', '')
|
||||
l = request.GET.get('limit', '6')
|
||||
try:
|
||||
l = int(l)
|
||||
videos = Video.objects.filter(Q(id__contains=q) | Q(name__contains=q))[:l]
|
||||
|
||||
Reference in New Issue
Block a user