This is the scope of this exercise:
- Create an endpoint
GET /v1/howmanybooks/author+namethat will return a phrase stating how many books the specified author has - The Open Library Search API should be used
This is the scope of this exercise:
GET /v1/howmanybooks/author+name that will return a phrase stating how many books the specified author has| from django.conf.urls import url | |
| from apps.wpe_tdd_mob_programming.views import StatusView, numberofbooksbyauthor | |
| urlpatterns = [ | |
| url(r'^v1/numberofbooksbyauthor/(?P<author_name>.+)/?$', numberofbooksbyauthor), | |
| ] |
| @api_view(['GET']) | |
| @permission_classes((IsAuthenticatedOrReadOnly,)) | |
| @parser_classes((JSONParser,)) | |
| def numberofbooksbyauthor(request, author_name): | |
| return JsonResponse({'num_found': 384}) |