Fixed some small errors

This commit is contained in:
david 2023-05-19 17:03:06 +02:00
parent c4af1d1808
commit 76fee9b57a
2 changed files with 3 additions and 5 deletions

View File

@ -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.

View File

@ -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]