Profile profile

Irakli Nadareishvili edited this page Oct 8, 2013 · 25 revisions

What now?

As virtually every other document in PMP, a document that represents a profile definition is also of Collection.doc+JSON media type. Its profile is, well: profile, which makes saying "profile profile" really awkward, but, for what it's worth:

Profile Definition

{
  "version": "1.0"
, "attributes": {
    "guid": "0b942a0a-d7d6-4617-bd5a-8dd5bab3d948"
  , "title": "Profile Profile"
  , "valid": {
      "from": "2013-02-11T13:21:31.598Z"
    , "to": "3013-05-11T13:21:31.598Z"
    }
  }
, "links": {
    "profile": [
      {
        "href": "http://api.pmp.io/profiles/profile"
      , "type": "application/vnd.pmp.collection.doc+json"
      }
    ]
  , "self": [
      {
        "href": "http://api.pmp.io/docs/0b942a0a-d7d6-4617-bd5a-8dd5bab3d948"
      , "type": "application/vnd.pmp.collection.doc+json"
      }
    ]
  , "documentation": [
      {
        "href": "https://github.com/publicmediaplatform/pmpdocs/wiki/Profile-Profile"
      , "type": "text/html"
      }
    ]
  , "schema": [
      {
        "href": "http://api.pmp.io/schemas/profile"
      , "scope": "update"
      , "type": "application/schema+json"
      }
    ]
  , "alternate": [
      {
        "href": "http://api.pmp.io/profiles/profile"
      }
    ]
  }
}

Example Document

{
  "version" : "1.0"
, "data" : {  
    "guid"        : "b9ce545e-01a2-44d0-9a15-a73da4ed304b"
  , "title"       : "Story Profile"
  , "valid"       : { "from" : "2013-02-11T13:21:31.598Z"
                    , "to"   : "3013-05-11T13:21:31.598Z"}
  }
, "items" : []      
, "links" : {
    "profile"      : [ { "href" : "http://api.pmp.io/profiles/profile"
                       , "type" : "application/vnd.pmp.collection.doc+json" }]
  , "extends"      : [ { "href" : "http://api.pmp.io/profiles/base"
                       , "type" : "application/vnd.pmp.collection.doc+json" }]
  , "self"         : [ { "href" : "http://api.pmp.io/docs/b9ce545e-01a2-44d0-9a15-a73da4ed304b"
                       , "type" : "application/vnd.pmp.collection.doc+json" }]
  , "documentation": [ { "href" : "https://github.com/publicmediaplatform/pmpdocs/wiki/News-Story-Profile"
                       , "type" : "text/html"}]
  , "schema"       : [ { "href"  : "http://api.pmp.io/schemas/story", 
                       , "scope" : "update", "type" : "application/schema+json"} 
                       }
                     , { "href"  : "http://api.pmp.io/schemas/story-view", 
                       , "scope" : "read", "type" : "application/schema+json"} 
                       }]
  , "alternate"    : [ { "href" : "http://api.pmp.io/profiles/story" }]
  , "edit-form"    : [ { "href" : "http://api.pmp.io/docs-validator", "type" :   "application/json"}]
  }  
, "error" : {OBJECT}
}

Fields

  • Title - optional. Title of the profile.

Link Relations

  • extends - optional, indicates a parent profile being extended (if any).
    • only one parent profile may be indicated, and any additional profiles after the first will be ignored.
    • if omitted, the profile only inherits from the Collection.doc+JSON media type
  • documentation - human-readable documentation (typically: HTML, but can be PDF or anything else) of the additional semantics provided by the profile to assist API Client coders to implement the semantics.
  • schema - optional. JSON Schema[s] used to validate the document structure during input/output.
    • scope="update" - optional. JSON Schema used during saving. If none is provided only Collection.doc+JSON semantics will be checked.
    • scope="read" - optional. JSON schema used during display. If missing, validation is skipped.
  • alternate - optional. Aliased (typically human-friendly) URL for the profile

Restrictions:

  • A profile cannot be removed if there are other profiles extending it or other documents referencing it as the profile. An attempt to delete such profile will return an error message with enough information about dependencies to clean things up and retry.

  • A profile's valid.to and valid.from fields cannot be changed in a way that would leave the profiles that are extending it, or documents referencing it in an invalid state. Such attempt should return an error with enough information to remedy the problem.