PUT
/
users
/
{handle}
/
subscription
curl --request PUT \
  --url https://codecombat.com/api/users/{handle}/subscription \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "ends": "<string>"
}'
{
  "_id": "<string>",
  "email": "<string>",
  "name": "<string>",
  "slug": "<string>",
  "role": "<string>",
  "stats": {
    "gamesCompleted": 123,
    "concepts": {},
    "playTime": 123
  },
  "oAuthIdentities": [
    {
      "provider": "<string>",
      "id": "<string>"
    }
  ],
  "subscription": {
    "ends": "<string>",
    "active": true
  },
  "license": {
    "ends": "<string>",
    "active": true
  }
}
url = `https://codecombat.com/api/users/${userID}/subscription`
json = { ends: new Date('2017-01-01').toISOString() }
request.put({ url, json, auth }, (err, res) => {
  console.log(res.body.subscription) // { ends: '2017-01-01T00:00:00.000Z', active: true }
})

Authorizations

Authorization
string
headerrequired

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Path Parameters

handle
string
required

The document's _id or slug.

Body

application/json
ends
string
required

Response

200 - application/json
_id
string | null
email
string | null
name
string | null
slug
string | null
role
string | null

Usually either 'teacher' or 'student'

stats
object | null
oAuthIdentities
object[] | null
subscription
object | null
license
object | null