Skip to content

Instantly share code, notes, and snippets.

@martastain
Last active May 13, 2019 19:03
Show Gist options
  • Save martastain/5c7270833dd3f72f9cbb2d9f7f3af7c5 to your computer and use it in GitHub Desktop.
Save martastain/5c7270833dd3f72f9cbb2d9f7f3af7c5 to your computer and use it in GitHub Desktop.
Nebula API reference

Nebula API reference

GET

/get method is used to search, list and retrieve metadata of Nebula objects.

object_type

  • Type: String. One of "asset", "item", "event", "bin", "user"
  • Default: "asset"

ids

  • Type: List of integers

If 'ids' parameter is used, result will contain all metadata of requested assets. Other parameters (except object_type) will be ignored:

Examples

>>> get(ids=[1])

{'count': 1,
 'data': [
   'content_type': 2,
   'ctime': 1556619500.936014,
   'duration': 1.4,
   'file/ctime': 1546940340,
   'file/mtime': 1546940340,
   'file/size': 32383249,
   'id': 1,
   'id_folder': 7,
   'id_storage': 1,
   'job_created/1': 1,
   'media_type': 1,
   'mtime': 1556619525.0932105,
   'num_frames': 35.0,
   'path': 'media.dir/jingles/short01.mov',
   'status': 1,
   'title': 'short01',
   ],
 'message': '1 assets returned in 0.00023s',
 'response': 200}

id_view

  • Type: Integer

This parameter only makes sense if object_type is "asset"

conds

  • Type: List of strings

fulltext

  • Type: String

result_type

  • Type: Can be one of
    • list of strings (metadata keys)
    • string "ids"

If not specified, response will contain list of all metadata of matching assets. If result_type is set to ids, only list of matching asset ids will be returned. You may also specify list of required metadata keys and their formats.

Examples

>>> get(id_view=1, result=["id", "mtime"])

{'count': 14,
 'data': [[43, 1557599311.429924],
  [42, 1556796564.324024],
  [41, 1556795506.4788477],
  [40, 1556794642.8925517],
  [39, 1556787086.3461306],
  [38, 1556811539.6703582],
  [37, 1556633903.819026],
  [36, 1556632913.502891],
  [35, 1556632850.9164526],
  [34, 1556632812.4267015],
  [33, 1556632750.9373784],
  [32, 1556632767.944466],
  [31, 1556632823.6198819],
  [30, 1556632837.8753388]],
 'message': '14 assets returned in 0.0087s',
 'response': 200}

@ suffix with additional formatting options may be used

>>> get(id_view=1, result=["id", "mtime@{\"format\": \"%Y-%m-%d\"}"])

{'count': 14,
 'data': [[43, '2019-05-11'],
  [42, '2019-05-02'],
  [41, '2019-05-02'],
  [40, '2019-05-02'],
  [39, '2019-05-02'],
  [38, '2019-05-02'],
  [37, '2019-04-30'],
  [36, '2019-04-30'],
  [35, '2019-04-30'],
  [34, '2019-04-30'],
  [33, '2019-04-30'],
  [32, '2019-04-30'],
  [31, '2019-04-30'],
  [30, '2019-04-30']],
 'message': '14 assets returned in 0.0095s',
 'response': 200}

order

  • Type: String
  • Default: "ctime DESC"

SQL "ORDER BY" part. This will be rewritten to allow any metadata key to be used without using JSONb syntax.

limit

  • Type: Integer
  • Default: 1000

offset

  • Type: Integer
  • Default: 0

Nebula API reference

SET

object_type"

  • Type: String. One of "asset", "item", "event", "bin", "user"
  • Default: "asset"

objects

  • Type: List of integers

data

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