4 ms·
If you look at the Django REST Framework project you can see this kind of behavior by default. For example: http://rest.ep.io/pygments/ http://rest.ep.io/pygme
by po 15y ago
If you look at the Django REST Framework project you can see this kind of behavior by default. For example:
http://rest.ep.io/pygments/ http://rest.ep.io/pygments/
Notice the OPTIONS button on the top right of the browse-able interface. For example:
$ curl -X OPTIONS http://rest.ep.io/pygments/ http://rest.ep.io/pygments/
{"fields":
{
"lexer": "ChoiceField", "code": "CharField", "style": "ChoiceField", "linenos": "BooleanField", "title": "CharField"},
"parses": ["application/json", "application/x-www-form-urlencoded", "multipart/form-data", "application/xml", "application/yaml"],
"renders": ["application/json", "application/json-p", "text/html", "application/xhtml+xml", "text/plain", "application/xml", "application/yaml"],
"name": "Pygments Root",
"description": "\nThis example demonstrates a simple RESTful Web API around the awesome pygments library.\nThis top level resource is used to create highlighted code snippets, and to list all the existing code snippets.\n"
}
- eloisius 15y agoAwesome! I had no idea Django was doing this already.
- wahnfrieden 15y agoIt doesn't, this is the name of the project: "Django REST Framework". https://github.com/tomchristie/django-rest-framework https://github.com/tomchristie/django-rest-framework :) It deserves more attention, it's put together well.
- eloisius 15y agoOh, nice.