People Import Helper
This document defines the People Import Helper resource.
The People import helper is a helper endpoint to aid in the import of a batch of People resources via POST. It provides a quick and easy way to add multiple people to an OSDI system.
The collection of people to be imported is represented in an array with the attribute name “signups”. Each element in the signups array is equivalent to the representation of a Person Signup Helper request.
Some systems may attempt to match inputs via the People import helper to existing people in the database and update their record instead of creating a new person for every POST. The method used for matching will be detailed in that system’s documentation.
The response to a successful People import helper POST is an empty body, if there were no errors on any of the signups.
If errors occurred on individual signups, the response should contain an osdi:error
object for batch requests indicating the individual status information.
Sections:
Endpoints and URL structures
OSDI does not specify specific endpoints and link structures for compliant systems to use. Rather, because OSDI is a HAL+JSON API, endpoints and structures are defined in the links section of each returned resource, starting with the API Entry Point link.
HAL’s link structure lets an API consumer move through API levels, resources, and collections by parsing and following links. While most systems will not change the value of their links often and obey RESTful design principles, the value of each link when that resource is retrieved is the only canonical value, and it can change at any time.
The link relation label for the People import helper is osdi:people_import_helper
.
Fields
The field names for this resource, with standard names, punctuation and capitalization, and values where appropriate.
Note: As with the entire OSDI specification, the specific fields a compliant system implements will vary between each system, as will the fields each system requires when creating or updating resources, which fields are writeable, and the operations you are allowed to perform on each resource.
People import helper Fields
A list of fields specific for POSTing via the People import helper.
Name | Type | Description |
---|---|---|
signups | PersonSignupHelper[] | An array of Person Signup Helper request representations. |
Control Headers
An “osdi:control” JSON object may contain common OSDI control headers which can be used on an OSDI POST, PUT, PATCH, Helper or other function calls to modify server behavior. Read More
Name | Type | Description |
---|---|---|
return_response | boolean | Defaults to true, if specified as false, the operation does not need to return the resource representation in the response |
Import Response Fields
A list of fields for the response to People import helper.
Name | Type | Description |
---|---|---|
statistics | object | A vendor defined se |
submitted | integer | A count of submitted records |
processed | integer | A count of successfully processed records |
errors | integer | A count of records which caused errors |
updated | integer | A count of updated records |
created | integer | A count of newly created records |
osdi:error | OsdiError | OPTIONAL details of errors |
Helper Action Functions
Helper Action Functions are additional actions that the OSDI server will perform along with inserting or updating the associated person.
Name | Type | Description |
---|---|---|
add_tags | strings[] | An array of tag names corresponding to previously created tags to add to this person when it is created. |
add_tags_uri | strings[] | An array of tag URIs corresponding to previously created tags to add to this person when it is created. |
add_lists | strings[] | An array of list names corresponding to previously created lists to add to this person when it is created. |
add_lists_uri | strings[] | An array of list URIs corresponding to previously created lists to add to this person when it is created. |
add_questions_responses_uri | QuestionResponseObject | An array of Question Response Objects, indicating answers which should be applied to the person. |
triggers | Triggers | An object hash representing responses a user would like to trigger from the server as part of the POST, such as sending an autoresponse email back to the person who took action with this helper. |
Question Response Object Fields
Name | Type | Description |
---|---|---|
question | string | The identifier for the Question which is being answered |
responses | string[] | One or more responses to the Question, if the corresponding question_type is SingleChoice or MultiChoice; should be a subset of the responses available for the question |
value | string | A free-text response to the question, if the corresponding question_type is Paragraph. |
Triggers
Here autoresponse identifiers are handled independent of the OSDI specification’s identifier schema. The autoresponse sent is determined by the server that is being interacted with, the system, and the id
.
Three types of autoresponse triggers are defined below and those types should follow this specification and format.
Name | Type | Description |
---|---|---|
autoresponse | object | An object hash representing the autoresponse email trigger type. |
autoresponse.enabled | boolean | A boolean indicating whether the autoresponse email should be sent or not. |
autoresponse.identifiers | strings[] | A unique string array of identifiers in the format [system name]:[id] . |
Name | Type | Description |
---|---|---|
sms_response | object | An object hash representing the autoresponse sms trigger type. |
sms_response.enabled | boolean | A boolean indicating whether the autoresponse sms should be sent or not. |
sms_response.identifiers | strings[] | A unique string array of identifiers in the format [system name]:[id] . |
Name | Type | Description |
---|---|---|
call_response | object | An object hash representing the autoresponse call trigger type. |
call_response.enabled | boolean | A boolean indicating whether the autoresponse call should be sent or not. |
call_response.identifiers | strings[] | A unique string array of identifiers in the format [system name]:[id] . |
Related Objects
These JSON hashes included in the table above are broken out into their own tables for readability, rather than independent resources with their own endpoints.
Statistics
|Name |Type |Description |———– |———–|————–
Related Resources
Scenarios
The scenarios below show common create (POST) operations that can be performed on this helper. While the canonical definitions of fields are above, these examples should be complete as well.
Scenario: Importing People With Errors (POST)
Posting to the people import helper endpoint will allow you to upload a collection of people, as well as invoke helper action functions to add tags, lists, etc., for each person.
Request
POST https://osdi-sample-system.org/api/v1/people/people_import_helper
Header:
OSDI-API-Token:[your api key here]
{
"signups": [
{
"person": {
"identifiers": [
"foreign_system:1"
],
"family_name": "Edwin",
"given_name": "Labadie",
"additional_name": "Marques",
"origin_system": "OpenSupporter",
"email_addresses": [
{
"address":"test-3@example.com",
"primary": true,
"address_type": "Personal"
}
],
},
"add_tags": [
"volunteer",
"donor"
],
"add_lists": [
"supporters"
],
"add_questions_responses_uri": [
{
"question": "https://osdi-sample-system.org/api/v1/questions/c945d6fe-929e-11e3-a2e9-12313d316c29",
"responses": [ "r1", "r2", "r2"]
}
]
},
{
"person": {
"identifiers": [
"osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3",
"foreign_system:1"
],
"origin_system": "OSDI Sample System",
"created_date": "2014-03-20T21:04:31Z",
"modified_date": "2014-03-20T21:04:31Z",
"given_name": "John",
"family_name": "Smith",
"honorific_prefix": "Mx.",
"honorific_suffix": "Ph.D",
"email_addresses": [
{
"primary": true,
"address": "johnsmith@mail.com",
"address_type": "Personal",
"status": "subscribed"
}
],
"phone_numbers": [
{
"number": "1-800-OSDI-RULES",
"number_type": "Home"
}
]
},
"add_tags": [
"volunteer",
"donor"
],
"add_lists": [
"supporters"
],
"add_questions_responses_uri": [
{
"question": "https://osdi-sample-system.org/api/v1/questions/c945d6fe-929e-11e3-a2e9-12313d316c29",
"responses": [ "r1", "r2", "r2"]
}
]
}
]
}
Response
207 Multistatus
Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate
{
"submitted": 2,
"successful": 1,
"errors": 1,
"osdi:error": {
"request_type": "batch",
"response_code": 200,
"batch_errors": [
{
"request_type": "non-atomic",
"response_code": 207,
"resource_status": [
{
"resource": "osdi:person",
"response_code": 201
},
{
"resource": "osdi:tagging",
"response_code": 400,
"errors": [
{
"code": "TAG_NAME_DOES_NOT_EXIST",
"description": "The tag name 'volunteer' does not exist.",
"properties": [ 'add_tags' ]
},
]
},
]
},
{
"request_type": "non-atomic",
"response_code": 400,
"resource_status": [
{
"resource": "osdi:person",
"response_code": 400,
"errors": [
{
"code": "INVALID PHONE NUMBER",
"description": "The phone number '1-800-OSDI-RULES' is not a valid phone number.",
"properties": [ 'phone_numbers[0].number' ]
},
]
}
]
}
]
}
}
Scenario: Importing People Without Errors (POST)
Posting to the people import helper endpoint will allow you to upload a collection of people, as well as invoke helper action functions to add tags, lists, etc., for each person.
Request
POST https://osdi-sample-system.org/api/v1/people/people_import_helper
Header:
OSDI-API-Token:[your api key here]
{
"signups": [
{
"person": {
"identifiers": [
"foreign_system:1"
],
"family_name": "Edwin",
"given_name": "Labadie",
"additional_name": "Marques",
"origin_system": "OpenSupporter",
"email_addresses": [
{
"address":"test-3@example.com",
"primary": true,
"address_type": "Personal"
}
],
},
"add_tags": [
"volunteer",
"donor"
],
"add_lists": [
"supporters"
],
"add_questions_responses_uri": [
{
"question": "https://osdi-sample-system.org/api/v1/questions/c945d6fe-929e-11e3-a2e9-12313d316c29",
"responses": [ "r1", "r2", "r2"]
}
]
},
{
"person": {
"identifiers": [
"osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3",
"foreign_system:1"
],
"origin_system": "OSDI Sample System",
"created_date": "2014-03-20T21:04:31Z",
"modified_date": "2014-03-20T21:04:31Z",
"given_name": "John",
"family_name": "Smith",
"honorific_prefix": "Mx.",
"honorific_suffix": "Ph.D",
"email_addresses": [
{
"primary": true,
"address": "johnsmith@mail.com",
"address_type": "Personal",
"status": "subscribed"
}
],
"phone_numbers": [
{
"number": "1-800-OSDI-RULES",
"number_type": "Home"
}
]
},
"add_tags": [
"volunteer",
"donor"
],
"add_lists": [
"supporters"
],
"add_questions_responses_uri": [
{
"question": "https://osdi-sample-system.org/api/v1/questions/c945d6fe-929e-11e3-a2e9-12313d316c29",
"responses": [ "r1", "r2", "r2"]
}
]
}
]
}
Response
200 OK
Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate
{
"submitted": 2,
"successful": 1,
"errors": 1,
"osdi:error": {
"request_type": "batch",
"response_code": 200,
"batch_errors": [
{
"request_type": "non-atomic",
"response_code": 207,
"resource_status": [
{
"resource": "osdi:person",
"response_code": 201
},
{
"resource": "osdi:tagging",
"response_code": 400,
"errors": [
{
"code": "TAG_NAME_DOES_NOT_EXIST",
"description": "The tag name 'volunteer' does not exist.",
"properties": [ 'add_tags' ]
}
]
}
]
},
{
"request_type": "non-atomic",
"response_code": 400,
"resource_status": [
{
"resource": "osdi:person",
"response_code": 400,
"errors": [
{
"code": "INVALID PHONE NUMBER",
"description": "The phone number '1-800-OSDI-RULES' is not a valid phone number.",
"properties": [ 'phone_numbers[0].number' ]
}
]
}
]
}
]
}
}