# Install the command line client
$ pip install coreapi-cli
<!-- Load the JavaScript client library --><scriptsrc="/static/rest_framework/js/coreapi-0.1.1.js"></script><scriptsrc="/docs/schema.js"></script>
# Install the Python client library
$ pip install coreapi
api-token-auth
create
POST/api-token-auth/
Request Body
The request body should be a "application/json" encoded object, containing the following items.
Parameter
Description
usernamerequired
Valid username for authentication
passwordrequired
Valid password for authentication
# Load the schema document
$ coreapi get http://xn--90au4d.xn--80aswg/docs/
# Interact with the API endpoint
$ coreapi action api-token-auth create -p username=... -p password=...
varcoreapi=window.coreapi// Loaded by `coreapi.js`varschema=window.schema// Loaded by `schema.js`// Initialize a clientvarclient=newcoreapi.Client()// Interact with the API endpointvaraction=["api-token-auth","create"]varparams={username:...,password:...,}client.action(schema,action,params).then(function(result){// Return value is in 'result'})
importcoreapi# Initialize a client & load the schema documentclient=coreapi.Client()schema=client.get("http://xn--90au4d.xn--80aswg/docs/")# Interact with the API endpointaction=["api-token-auth","create"]params={"username":...,"password":...,}result=client.action(schema,action,params=params)