Skip to content

Instantly share code, notes, and snippets.

@amoslanka
Last active August 29, 2015 14:09
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 amoslanka/d91d71ff30b2d84aecd0 to your computer and use it in GitHub Desktop.
Save amoslanka/d91d71ff30b2d84aecd0 to your computer and use it in GitHub Desktop.
JSON metadata examples

GET /syllabi/1 Using wrapper objects

{
  "type": "syllabus",
  "properties": {
    "id": 1,
    "title": "Build a Simple Website",
    "description": "Smells Like Bakin",

    "stages": [
      {
        "type": "stage",
        "properties": {
          "id": 173,
          "badge_id": 159,
          "steps": [
            {
              "type": "Video",
              "properties": {
                "id": 891,
                "title": "Introduction to the Project",
                "duration_in_seconds": 132,
              }
            }
          ]
        }
      }
    ]
  }
}

GET /syllabi/1 Using flat meta objects

{
  "_type": "syllabus",
  "id": 1,
  "title": "Build a Simple Website",
  "description": "Smells Like Bakin",

  "stages": [
    {
      "_type": "stage",
      "id": 173,
      "badge_id": 159,
      "steps": [
        {
          "_type": "Video",
          "id": 891,
          "title": "Introduction to the Project"
        }
      ]
    }
  ]
}

GET /syllabi/1 Using wrapper objects and embedded objects as meta

{
  "type": "syllabus",
  "properties": {
    "id": 1,
    "title": "Build a Simple Website",
    "description": "Smells Like Bakin",
  }
  "embedded": {
    "stages": [
      {
        "type": "stage",
        "properties": {
          "id": 173,
          "badge_id": 159
        }
        "embedded": {
          "steps": [
            {
              "type": "Video",
              "properties": {
                "id": 891,
                "title": "Introduction to the Project",
                "duration_in_seconds": 132
              }
            }
          ]
        }
      }
    ]
  }
}

GET /syllabi Adding meta data on the collection

{
  "_type": "collection",
  "_count": 100,
  "_links": {},

  "items": [
    {
      "_type": "syllabus",
      "id": 1,
      "title": "Build a Simple Website",
      "description": "Smells Like Bakin",

      "stages": {
        "_type": "collection",
        "_count": 100,
        "_links": {},
        "items": [
          {
            "_type": "stage",
            "id": 173,
            "badge_id": 159,
            "steps": {
              "_type": "collection",
              "_count": 100,
              "_links": {},
              "items": [
                {
                  "_type": "Video",
                  "id": 891,
                  "title": "Introduction to the Project"
                }
              ]
            }
          }
        ]
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment