Create an API-based Chart

Hey @Danil_Redko :wave:

So, you manage to fix this issue? (Since we’re not able to reproduce, we are still looking for more insights about this :))

Could you detail what is behind APIView ?

As you are creating an API Chart, the only way to ensure the request is allowed would be to check for the JWT authentication token. Here is an example

import uuid

from django_forest.utils.views.base import BaseView

from django.views import generic
from django.http import JsonResponse, HttpResponse

class OrdersStatsTotalAmountAPIView(BaseView):
    def post(self, request):
        if not self.is_authenticated(request):
            return HttpResponse(f'Unauthorized request', status=403)
        res = {
            "data": {
                "attributes": {
                    "value": {"countCurrent": 1}
                },
                "type": "stats",
                "id": uuid.uuid4(),
            }
        }
        return JsonResponse(status=200, data=res)

Let me know if that helps