Class based view to support endpoint with parameters

I am trying to use class based views where I need to implement 3 different endpoints on GET method.

/coupons
/coupons/{id}
/coupons/{id}/{code}

Should I define 3 different classes or can this be accomodated inside a single class.

Three classes. Each class can have a single url.

Thanks @ahopkins. This definetly helps.

1 Like