Products API

Creating Products

POST /api/v1/courses/:course_id/products

Parameters

Name Description
id id
course_id Id of the course
billing_interval day month week year
currency attribute
description description
is_published attribute
is_recurring attribute
name attribute
price amount in cents of product
author_revenue_share % of revenue to go to author, override author revenue share on users

Request

Headers

Accept: application/json
X-Api-Token: 8hqNupUyH9U-VcJiz71-Dy5YsHunXYjj4w
X-Api-Email: user-306@example.com

Route

POST /api/v1/courses/184/products

Body

{"billing_interval":"month","currency":"usd","description":"a  product","is_published":true,"is_recurring":true,"name":"foo","price":15,"author_revenue_share":0.2}

cURL

curl "http://localhost:3000/api/v1/courses/184/products" -d '{"billing_interval":"month","currency":"usd","description":"a  product","is_published":true,"is_recurring":true,"name":"foo","price":15,"author_revenue_share":0.2}' -X POST \
	-H "Accept: application/json" \
	-H "X-Api-Token: 8hqNupUyH9U-VcJiz71-Dy5YsHunXYjj4w" \
	-H "X-Api-Email: user-306@example.com" \
	-H "Content-Type: application/json" \
	-H "Host: school.worksonmy.computer"

Response

Headers

Content-Type: application/json; charset=utf-8
Content-Length: 438

Status

201 Created

Body

{
  "created_at": "2019-10-31T22:03:36Z",
  "formatted_price": "$0.15/m",
  "name": "foo",
  "description": "a  product",
  "billing_interval": "month",
  "detailed_description": null,
  "currency": "usd",
  "position": 2,
  "price": 15,
  "is_recurring": true,
  "is_published": true,
  "course_id": 184,
  "author_revenue_share": 0.2,
  "num_payments_required": null,
  "id": 81,
  "meta": {
    "class": "product",
    "url": "/courses/184/products/81",
    "name": "foo",
    "description": "a  product",
    "image_url": null
  }
}