Skip to content

Instantly share code, notes, and snippets.

@mwean
Last active December 21, 2015 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mwean/6314994 to your computer and use it in GitHub Desktop.
Save mwean/6314994 to your computer and use it in GitHub Desktop.

Accounts

Create an account

POST /accounts

Input

  • account_id

Response

{ "neon_api_key": "some-api-key-1234" }

Update an account

PUT /accounts/:account_id

Input

  • processing_minutes
  • plan_start_date

Get account status

GET /accounts/:account_id/status

Response

Number of videos in each state and number of minutes used of plan. { "in_progress": 2, "finished": 10, "failed": 0, "minutes_used": 200 }

General

  • Requests return 2xx status on success and 4xx status on failure with JSON response
  • All dates are formatted YYYY-MM-DD

Authentication

  • Account creation not authenticated
  • All other requests must have X-Neon-API-Key header with API key

Jobs

Check job status

GET /jobs/:job_id

Response

{ "status": "in_progress" }

options for status are in_progress, finished, and failed

Integrations

Add a Brightcove integration

POST /accounts/:account_id/brightcove_integrations

Input

  • integration_id
  • publisher_id
  • read_token
  • write_token
  • auto_update: whether or not to automatically set the Neon-chosen thumbnail; value is either true or false

Response

Either 201 status code or 409 status and error message: { "error": "integration already exists" }

Update a Brightcove integration

PUT or PATCH /brightcove_integrations/:integration_id

Input

  • read_token
  • write_token
  • auto_update

Process/reprocess a video

POST /accounts/:account_id/brightcove_integrations/:integration_id/create_video_request

Input

  • video_id

Response

Either 202 status code and job_id: { "job_id": "job1234" } or 409 status and error message

Add a YouTube integration

POST /accounts/:account_id/youtube_integrations

Input

  • integration_id
  • access_token
  • refresh_token
  • expires
  • auto_update: whether or not to automatically set the Neon-chosen thumbnail; value is either true or false

Response

Either 201 status code or 409 status and error message: { "error": message }

Update a YouTube integration

PUT or PATCH /youtube_integrations/:integration_id

Input

  • access_token
  • refresh_token
  • auto_update

Process/reprocess a video

POST /accounts/:account_id/youtube_integrations/:integration_id/create_video_request

Input

  • video_id
  • video_url: URL to download video

Response

Either 202 status code and job_id: { "job_id": "job1234" } or 409 status and error message

Videos

Get videos for an account

GET /accounts/:account_id/videos

Input

  • limit: number of videos to return
  • page: 1-based page number
  • integration_types: array of integration types to include, e.g. ["brightcove", "youtube"]

Response

{ "videos": [
  {
    "video_id": "v123",
    "integration_type": "brightcove",
    "integration_id": "1234",
    "title": "sample",
    "duration": 10,
    "publish_date": "2013-01-01",
    "status": "in_progress",
    "current_thumbnail_id": "1234"
    "thumbnails": [
      {
        "url": "http://thumb1",
        "created": "2013-01-01",
        "enabled": "2013-01-01",
        "width": 480,
        "height": 360,
        "type": "neon1"
      },
      {
        ...
      }
    ]
  },
  {
    ...
  }]
}
  • options for integration_type are brightcove and youtube
  • duration is in minutes
  • options for status are in_progress, finished, and failed
  • options for type are neon-n (e.g. neon1, neon2...), brightcove, youtube

Get a particular video

GET /videos/:video_id

Response

{
  "video_id": "v123",
  "integration_type": "brightcove",
  "integration_id": "1234",
  "title": "sample",
  "duration": 10,
  "publish_date": "2013-01-01",
  "status": "in_progress",
  "current_thumbnail_id": "1234"
  "thumbnails": [
    {
      "thumbnail_id": "1234"
      "url": "http://thumb1",
      "created": "2013-01-01",
      "enabled": "2013-01-01",
      "width": 480,
      "height": 360,
      "type": "neon1"
    },
    {
      ...
    }
  ]
}

Update thumbnail for a video

PUT or PATCH /videos/:video_id

Input

  • thumbnail_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment