Batch Custom Field Answers

Update custom field answers for a set of applicants in a single API request using a batch action. A batch action is an asynchronous operation that can be created using a first endpoint and then have its result checked using another endpoint. First the batch action is created using the POST (create) endpoint by sending in the request body, the JSON describing all the changes to apply. The creation endpoint validates the changes and then schedules the batch to be executed returning a batch id to check the result later on. Then the GET (show) endpoint can be used to check the completion of the scheduled batch, using the id returned by the previous POST. Once the batch has finished, the result will be included in the batch object.

Attributes

Name Type Description Example
batch:id integer Unique identifier of this batch. 74780
batch:results nullable array List of the updated custom field answers [{"custom_field_answer":{"custom_field_id":99,"label":"Are you a citizen?","field_type":"boolean","value":false},"applicant_cas_id":"123456789","errors":null},{"custom_field_answer":{"custom_field_id":123,"label":"What is your favorite fruit?","field_type":"string","value":"banana"},"applicant_cas_id":"987654321","errors":{"applicant":"No applicant found for that applicant_cas_id"}}]
batch:results/applicant_cas_id string The CAS unique identifier of the applicant. "123456789"
batch:results/custom_field_answer:custom_field_id integer Unique identifier of the custom field that this answers. 99
batch:results/custom_field_answer:field_type string Type of data that the custom field stores. "boolean"
batch:results/custom_field_answer:label string Human-readable label for the custom field.. "What is your favorite color?"
batch:results/custom_field_answer:value string The value to be stored as an answer to the custom field. false
batch:results/errors nullable object null
batch:results/errors:applicant string An error message indicating that the applicant_cas_id provided was invalid. "No applicant found for that applicant_cas_id"
batch:results/errors:creation_error string A message explaining why a change could not be completed. "A newer update (setting custom_field_answers to {\"field_type\":\"string\",\"value\":\"Boston\"}) is overriding this update"
batch:results/errors:custom_field string An error message indicating that the custom_field_id provided was invalid. "No custom field found for that custom_field_id"
batch:results/errors:update_error string An error message explaining why the update could not be applied. "ActiveRecord::ConnectionNotEstablished"
batch:status string Current status of this batch.
one of:"Queued" or "In Progress" or "Available" or "Success With Errors" or "Failed"
"Available"
href string Hypertext reference to the batch.
pattern: /api/v2/user_identities/\d+/programs/\d+/batch_custom_field_answers/\d+
"/api/v2/user_identities/1/programs/42023191739237/batch_custom_field_answers/74780"

Batch Custom Field Answers Show

Retrieve the status of a running/done batch action initiated with a previous POST. The id parameter is required. It is the id of the batch that you wish to check the status of. You may continue to issue this call over a reasonable polling interval (10s) until the batch has finished. Once the status of the batch becomes "Available", the detailed information of the modification applied will be in the "result" property of the batch object in the response.

GET /api/v2/user_identities/:user_identity_id/programs/:program_id/batch_custom_field_answers/:id

Required Parameters

Name Type Description Example
id integer Unique identifier of this batch. 74780

Curl Example

$ curl -n https://api.webadmit.org/api/v2/user_identities/:user_identity_id/programs/:program_id/batch_custom_field_answers/:id \
 -G \
  -d id=74780 \
  -H "x-api-key: 0123456789abcdef0123456789abcdef"

Response Example

HTTP/1.1 200 OK
{
  "href": "/api/v2/user_identities/1/programs/42023191739237/batch_custom_field_answers/74780",
  "batch": {
    "id": 74780,
    "status": "Available",
    "results": [
      {
        "custom_field_answer": {
          "custom_field_id": 99,
          "label": "Are you a citizen?",
          "field_type": "boolean",
          "value": false
        },
        "applicant_cas_id": "123456789",
        "errors": null
      },
      {
        "custom_field_answer": {
          "custom_field_id": 123,
          "label": "What is your favorite fruit?",
          "field_type": "string",
          "value": "banana"
        },
        "applicant_cas_id": "987654321",
        "errors": {
          "applicant": "No applicant found for that applicant_cas_id"
        }
      }
    ]
  }
}

Batch Custom Field Answers Create

Schedule the update of multiple custom field answers with the given applicant CAS IDs and program ID, by creating a batch.

POST /api/v2/user_identities/:user_identity_id/programs/:program_id/batch_custom_field_answers

Required Parameters

Name Type Description Example
custom_field_answers:applicant_cas_id string The CAS unique identifier of the applicant. "123456789"
custom_field_answers:custom_field_id integer Unique identifier of the custom field that this answers. 4
custom_field_answers:field_type string Type of data that the custom field stores.
one of:"boolean" or "number" or "date" or "string" or "select"
"boolean"
custom_field_answers:value nullable [boolean, string, number, date, select] The value to be stored as an answer to the custom field. false

Curl Example

$ curl -n -X POST https://api.webadmit.org/api/v2/user_identities/:user_identity_id/programs/:program_id/batch_custom_field_answers \
  -d '{
  "custom_field_answers": [
    {
      "applicant_cas_id": "123456789",
      "custom_field_id": 4,
      "field_type": "boolean",
      "value": false
    }
  ]
}' \
  -H "Content-Type: application/json" \
  -H "x-api-key: 0123456789abcdef0123456789abcdef"

Response Example

HTTP/1.1 201 Created
{
  "href": "/api/v2/user_identities/1/programs/42023191739237/batch_custom_field_answers/74780",
  "batch": {
    "id": 74780,
    "status": "Queued"
  }
}

Errors

Response Example

HTTP/1.1 422 Unprocessable Entity
{
  "errors": {
    "schema": [
      "The property '#/' did not contain a required property of 'custom_field_answers'"
    ]
  }
}

The request body did not match the expected request schema. Please check your parameters and try again.

{
  "errors": {
    "schema": [
      "The property '#/custom_question_answers/0/applicant_cas_id' of type Fixnum did not match the following type: string"
    ]
  }
}

The request body did not match the expected value type. In that example, the applicant_cas_id property of the first object (that is, at the 0 index) must be a String, not an Integer.

Not Found

Specific error messages

HTTP/1.1 404 Not Found

When the user_identity is not found

{
  "message": "User identity '999' not found."
}

When the program is not found

{
  "message": "Program '99999999999' not found."
}

Unauthorized

Response Example

HTTP/1.1 401 Unauthorized

(Empty response body.)