Fixed some small errors
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# VideoAPI
|
# VideoAPI
|
||||||
|
|
||||||
## Search
|
## Search
|
||||||
`GET \api?param=value`
|
`GET /api/?param=value`
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
| Param | Value |
|
| Param | Value |
|
||||||
@@ -21,6 +21,4 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Examples
|
### 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'])
|
@api_view(['GET'])
|
||||||
def videoAPI(request):
|
def videoAPI(request):
|
||||||
q = request.GET.get('q', '')
|
q = request.GET.get('q', '')
|
||||||
l = request.GET.get('limit', '')
|
l = request.GET.get('limit', '6')
|
||||||
try:
|
try:
|
||||||
l = int(l)
|
l = int(l)
|
||||||
videos = Video.objects.filter(Q(id__contains=q) | Q(name__contains=q))[:l]
|
videos = Video.objects.filter(Q(id__contains=q) | Q(name__contains=q))[:l]
|
||||||
|
|||||||
Reference in New Issue
Block a user