Release 2.x‎ > ‎Development‎ > ‎

Data Structure Definition Guide

subject Data Structures

These Data Structures apply to the subject uri Resource: openptk/resources/contexts/{contextId}/subjects. These data structures use the OpenPTK Structure class to "model" the requests and response data used by the following Operations.

Create

HTTP POST: openptk/resources/contexts/{contextId}/subjects

Structure
subject
  attributes
    attribute_name type="TYPE" value(s)
    ...
    attribute_name type="..." ...
JSON
{
   "subject" : { 
      "attributes" : { 
         "lastname" : "User", 
         "title" : "REST User", 
         "firstname" : "Curl", 
         "telephone" : "123-456-7890", 
         "email" : "curl@openptk.org",
         "manager" : null
      }
   }
}

XML
<subject>
   <attributes>
      <lastname type="string">User</lastname>
      <title type="string">REST User</title>
      <firstname type="string">Curl</firstname>
      <telephone type="string">123-456-7890</telephone>
      <email type="string">curl@openptk.org</email>
      <manager type="string"></manager>
   </attributes>
</subject>



Read

HTTP GET: openptk/resources/contexts/{contextId}/subjects/{uniqueId}

Structure
response
  uri type="string"
  subject
    uniqueid type="string"
    attributes
      attribute_name type="TYPE" value(s)
      ...
      attribute_name type="..."
  resources
    resource
    ...
    resource
JSON
{
    "response" : {
        "uri" : "http:\/\/localhost:8080\/openptk\/resources\/engine\/contexts\/Employees-MySQL-JDBC\/subjects\/ja1324",
        "subject" : {
            "uniqueid" : "ja1324",
            "attributes" : {
                "title" : "Jersey (JSR-311) Expert",
                "organization" : "Corporate Executive",
                "manager" : "sa15346",
                "email" : "restful@openptk.org",
                "location" : "loc35      ",
                "forgottenPasswordAnswers" : ["Smith","Denver","3333"],
                "roles" : "emp",
                "lastname" : "Andrews",
                "forgottenPasswordQuestions" : ["Mothers Maiden Name","City you were born","Last 4 digits of Frequent Flyer"],
                "firstname" : "John",
                "telephone" : "303-191-5506",
                "fullname" : "John Andrews"
            }
        },
        "resources" : {
            "resource" : {
                "description" : "Relationships",
                "uri" : "http:\/\/localhost:8080\/openptk\/resources\/engine\/contexts\/Employees-MySQL-JDBC\/subjects\/ja1324\/relationships"
            },
            "resource" : {
                "description" : "Views",
                "uri" : "http:\/\/localhost:8080\/openptk\/resources\/engine\/contexts\/Employees-MySQL-JDBC\/subjects\/ja1324\/views"
            }
        }
    }
}

XML
<response>
   <uri type="string">http://localhost:8080/openptk/resources/engine/contexts/Employees-MySQL-JDBC/subjects/ja1324</uri>
   <subject>
      <uniqueid type="string">ja1324</uniqueid>
      <attributes>
         <title type="string">Jersey (JSR-311) Expert</title>
         <organization type="string">Corporate Executive</organization>
         <manager type="string">sa15346</manager>
         <email type="string">restful@openptk.org</email>
         <location type="string">loc35      </location>
         <forgottenPasswordAnswers type="string">
            <values>
               <value>Smith</value>
               <value>Chicago</value>
               <value>1234</value>
            </values>
         </forgottenPasswordAnswers>
         <roles type="string">emp</roles>
         <lastname type="string">Andrews</lastname>
         <forgottenPasswordQuestions type="string">
            <values>
               <value>Mothers Maiden Name</value>
               <value>City you were born</value>
               <value>Last 4 digits of Frequent Flyer</value>
            </values>
         </forgottenPasswordQuestions>
         <firstname type="string">John</firstname>
         <telephone type="string">303-191-5506</telephone>
         <fullname type="string">John Andrews</fullname>
      </attributes>
   </subject>
   <resources>
      <resource>
         <description type="string">Relationships</description>
         <uri type="string">http://localhost:8080/openptk/resources/engine/contexts/Employees-MySQL-JDBC/subjects/ja1324/relationships</uri>
      </resource>
      <resource>
         <description type="string">Views</description>
         <uri type="string">http://localhost:8080/openptk/resources/engine/contexts/Employees-MySQL-JDBC/subjects/ja1324/views</uri>
      </resource>
   </resources>
</response>



Update

HTTP PUT: openptk/resources/contexts/{contextId}/subjects/{uniqueId}

Structure
subject
  attributes
    attribute_name type="TYPE" value(s)
    ...
    attribute
JSON
{ 
   "subject" : { 
      "attributes" : { 
         "title" : "Jersey (JSR-311) Expert", 
         "email" : "restful@openptk.org"
      } 
   } 
}

{ 
   "subject" : { 
      "attributes" : { 
         "forgottenPasswordAnswers" : [ "Smith","Chicago","1234" ], 
         "forgottenPasswordQuestions" : [ 
            "Mothers Maiden Name",
            "City you were born",
            "Last 4 digits of Frequent Flyer" 
         ] 
      } 
   } 
}

XML
<subject>
  <attributes>
    <title type="string">Jersey (JSR-311) Expert</title>
    <email type="string">restful@openptk.org</email>
  </attributes>
</subject>

<subject>
  <attributes>
    <forgottenPasswordQuestions type="string">
      <values>
        <value>Mothers Maiden Name</value>
        <value>City you were born</value>
        <value>Last 4 digits of Frequent Flyer</value>
      </values>
    </forgottenPasswordQuestions>
    <forgottenPasswordAnswers type="string">
      <values>
        <value>Smith</value>
        <value>Chicago</value>
        <value>1234</value>
      </values>
    </forgottenPasswordAnswers>
  </attributes>
</subject>



Delete

HTTP DELETE: openptk/resources/contexts/{contextId}/subjects/{subjectId}

There are no data structures for this Operation



Search

HTTP GET: openptk/resources/contexts/{contextId}/subjects

Structure
response
  uri type="string"
  length type="number"
  offset type="number"
  quantity type="number"
  subjects was results
    subject
      uniqueid type="string"
      attributes
        attribute_name type="TYPE" value(s)
        ...
        attribute_name type="..."
    ...
    subject
JSON
{
    "response" : {
        "uri" : "http:\/\/localhost:8080\/openptk\/resources\/engine\/contexts\/Employees-MySQL-JDBC\/subjects",
        "length" : 2,
        "offset" : 0,
        "quantity" : 2,
        "results" : [
            {
                "subject" : {
                    "uri" : "http:\/\/localhost:8080\/openptk\/resources\/engine\/contexts\/Employees-MySQL-JDBC\/subjects\/sa15346",
                    "uniqueid" : "sa15346",
                    "attributes" : {
                        "title" : null,
                        "manager" : "ITAdministrator",
                        "email" : "Scott.Anderson@openptk.com",
                        "lastname" : "Anderson",
                        "firstname" : "Scott",
                        "fullname" : "Scott Anderson",
                        "lastcommafirst" : "Anderson, Scott"
                    }
                }
            },
            {
                "subject" : {
                    "uri" : "http:\/\/localhost:8080\/openptk\/resources\/engine\/contexts\/Employees-MySQL-JDBC\/subjects\/st82921",
                    "uniqueid" : "st82921",
                    "attributes" : {
                        "title" : null,
                        "manager" : "gm84036",
                        "email" : "Scott.Townsend@openptk.com",
                        "lastname" : "Townsend",
                        "firstname" : "Scott",
                        "fullname" : "Scott Townsend",
                        "lastcommafirst" : "Townsend, Scott"
                    }
                }
            }
        ]
    }
}

XML
<response>
   <uri type="string">http://localhost:8080/openptk/resources/engine/contexts/Employees-MySQL-JDBC/subjects</uri>
   <length type="number">2</length>
   <offset type="number">0</offset>
   <quantity type="number">2</quantity>
   <results>
      <subject>
         <uri type="string">http://localhost:8080/openptk/resources/engine/contexts/Employees-MySQL-JDBC/subjects/sa15346</uri>
         <uniqueid type="string">sa15346</uniqueid>
         <attributes>
            <title type="string" />
            <manager type="string">ITAdministrator</manager>
            <email type="string">Scott.Anderson@openptk.com</email>
            <lastname type="string">Anderson</lastname>
            <firstname type="string">Scott</firstname>
            <fullname type="string">Scott Anderson</fullname>
            <lastcommafirst type="string">Anderson, Scott</lastcommafirst>
         </attributes>
      </subject>
      <subject>
         <uri type="string">http://localhost:8080/openptk/resources/engine/contexts/Employees-MySQL-JDBC/subjects/st82921</uri>
         <uniqueid type="string">st82921</uniqueid>
         <attributes>
            <title type="string" />
            <manager type="string">gm84036</manager>
            <email type="string">Scott.Townsend@openptk.com</email>
            <lastname type="string">Townsend</lastname>
            <firstname type="string">Scott</firstname>
            <fullname type="string">Scott Townsend</fullname>
            <lastcommafirst type="string">Townsend, Scott</lastcommafirst>
         </attributes>
      </subject>
   </results>
</response>



Password Change

HTTP PUT: openptk/resources/contexts/{contextId}/subjects/{subjectId}/password/change

Structure
subject
  attributes
    password type="string" value
JSON
{ 
   "subject" : { 
      "attributes" : { 
         "password" : "Passw0rd" 
      }
   }
}

XML
<subject>
   <attributes>
      <password type="string">Passw0rd</password>
   </attributes>
</subject>

Top


Password Reset

HTTP GET: openptk/resources/contexts/{contextId}/subjects/{subjectId}/password/reset

Structure
response
  uri type="string"
  subject
    uniqueid type="string"
    attributes
      password type="string" value
JSON
{
    "response" : {
        "uri" : "http:\/\/localhost:8080\/openptk\/resources\/contexts\/Employees-MySQL-JDBC\/subjects\/ja1324\/password\/reset",
        "subject" : {
            "uniqueid" : "ja1324",
            "attributes" : {
                "password" : "25Ouw3ab"
            }
        }
    }
}

XML
<response>
   <uri type="string">http://localhost:8080/openptk/resources/contexts/Employees-MySQL-JDBC/subjects/ja1324/password/reset</uri>
   <subject>
      <uniqueid type="string">ja1324</uniqueid>
      <attributes>
         <password type="string">U3NJDNku</password>
      </attributes>
   </subject>
</response>



Password Forgot



Comments