[DEPRECATED] Create or Update a Person

The ability to update people and get login links via this endpoint has been deprecated and will be removed in the near future.  Please use the Create a Person or Update a Person endpoints.

This Example Project demonstrates how to consume this API endpoint within a Java project.

This Example Project demonstrates how to consume this API endpoint within a C# project.

This endpoint is primarily designed to create and/or update cardholder users.  It is not designed to update office users or director, so many fields are disabled and cannot be changed from their default settings using this endpoint.  If you need full access to update a user, please refer to the Update a Person page.

URI: https://api.onlinephotosubmission.com/api/people 

HTTP Method: POST

Required Headers: X-Auth-Token (see: Authentication)

Optional URL Parameters: 

  • sendInvitation=[true|false] default is true
    If sendInvitation is false, cardholders will not receive an email invitation.

    If sendInvitation is true (or not specified), the user's password will be reset, all previous login links will be deprovisioned, and an email invitation will be sent to the cardholder.
  • allowUpdate=[true|false] default is false
    If allowUpdate is true and CloudCard finds a person with the same email address or identifier, CloudCard will update the person with the information contained in this request.
  • getLoginLink=[true|false] default is false
    If getLoginLink is true, the user's password will be reset, all previous login links will be deprovisioned, and a new link will be returned in the response.


By default, this request results in an email being sent to the newly created user. If you don't want an email to be sent, you can use the sendInvitation url parameter to turn emails off:
https://app.cloudcardtools.com/api/people?sendInvitation=false
(note that sendInvitation=true has no effect, as true is the default value.


Example HTTP Request Body - Email Only
{
  "email": "jon.doe@foo.edu"
}
Example HTTP Request Body - Using option "identifier" field to set ID Number
{
  "email": "jon.doe@foo.edu",
  "identifier":"ABC123"
}
Example HTTP Request Body - Set the user's custom fields
{
  "email": "jon.doe@foo.edu",
  "identifier":"ABC123",
  "customFields":{ 
    "Last_Name":"Card",
    "First Name":"Carry A",
    "Upload Date":"2017 - 06 - 22 11:17AM",
    "Batch":"1"
  }
}


Example Response (w/ getLoginLink=true)
201 created
{ 

   "accountExpired":false,
   "accountLocked":false,
   "activatedDate":null,
   "authorities":[ 
      { 
         "class":"com.campuscardtools.myphotoid.Role",
         "id":3,
         "authority":"ROLE_CARDHOLDER"
      }
   ],
   "currentPhoto":null,
   "customFields":{ 
      "Upload Date":{ 
         "class":"com.campuscardtools.myphotoid.CustomFieldValue",
         "id":3541,
         "customField":{ 
            "class":"com.campuscardtools.myphotoid.CustomField",
            "id":34
         },
         "lastUpdated":"2017-06-26T20:00:47Z",
         "person":{ 
            "class":"com.campuscardtools.myphotoid.Person",
            "id":123
         },
         "value":"2017 - 06 - 22 11:17AM"
      },
      "Last Name":null,
      "First Name":{ 
         "class":"com.campuscardtools.myphotoid.CustomFieldValue",
         "id":3540,
         "customField":{ 
            "class":"com.campuscardtools.myphotoid.CustomField",
            "id":31
         },
         "lastUpdated":"2017-06-26T20:00:47Z",
         "person":{ 
            "class":"com.campuscardtools.myphotoid.Person",
            "id":123
         },
         "value":"Carry A"
      },
      "Batch":{ 
         "class":"com.campuscardtools.myphotoid.CustomFieldValue",
         "id":3542,
         "customField":{ 
            "class":"com.campuscardtools.myphotoid.CustomField",
            "id":33
         },
         "lastUpdated":"2017-06-26T20:00:47Z",
         "person":{ 
            "class":"com.campuscardtools.myphotoid.Person",
            "id":123
         },
         "value":"1"
      }
   },
   "dateTermsAccepted":null,
   "domainClass":"com.campuscardtools.myphotoid.Person",
   "email":"john.doe@foo.edu",
   "enabled":true,
   "id":123,
   "identifier":"ABC123",
   "latestPhoto": null,
    "links": {
        "login": "https://app.onlinephotosubmission.com/#/login?access_token=lotsOfRandomLettersAndNumbersLotsOfRandomLettersAndNumbers"
    },
   "organization":{ ... },
   "passwordExpired":false,
   "passwordResetRequired":false,
   "readOnly":false,
   "username":"john.doe@foo.edu"
}

One frequent use case for this endpoint is to create and retrieve login links for a user, so they can be forwarded directly to CloudCard from another application witthout having to login again.  This is described on the Single Sign-On page.  This process works equally well for new or existing users.

Process

  1. Gather necessary information, (i.e. email, identifier, custom field values).
  2. Submit the following request

    .../api/people?allowUpdate=true&getLoginLink=true
    // for a new cardholder or if you're not sure if it's a new cardholder, send all the cardholder's information
    {
    	"email": "jack.sparrow@pirates.com",
    	"identifier": "180214-01",
    	"customFields": {...}
    }
    
    // for an existing cardholder, you only need to send email or identifier
    { "identifier": "123456" }


    Example Response (w/ getLoginLink=true)
    201 created or 200 OK
    { 
       "accountExpired":false,
       "accountLocked":false,
       "activatedDate":null,
       "authorities":[...],
       "currentPhoto":null,
       "customFields":{...},
       "dateTermsAccepted":null,
       "domainClass":"com.campuscardtools.myphotoid.Person",
       "email":"john.doe@foo.edu",
       "enabled":true,
       "id":123,
       "identifier":"ABC123",
       "latestPhoto": null,
        "links": {
            "login": "https://app.onlinephotosubmission.com/#/login?access_token=lotsOfRandomLettersAndNumbersLotsOfRandomLettersAndNumbers"
        },
       "organization":{ ... },
       "passwordExpired":false,
       "passwordResetRequired":false,
       "readOnly":false,
       "username":"john.doe@foo.edu"
    }

    allowUpdate must be true if you are using this with an existing cardholder because getting a new login link resets the cardholder's password, invalidates all old login links, and creates a new login link for the cardholder. 

    Any other fields in the request body will update the corresponding values for the cardholder.

  3. Forward the user or display a link to the URL specified in the login.link field.