Class: V1::ParticipantImportsController

Inherits:
ApiController
  • Object
show all
Defined in:
api/app/api/v1/participant_imports_controller.rb

Overview

Participant Imports represent a payload given to RedJade to add participants to a given event

Instance Method Summary collapse

Instance Method Details

#createHash<String, ParticipantImport>

This endpoint allows you to pass us a set of participants from an outside system intended for a particular event

Participant Import Options

  • [Integer] external_event_id (required) manually set by project managers inside the sensory test wizard (on the location step). If this has not been set already, your POST will return 404 (Not Found)
  • [Boolean] act_if_valid (default false) setting this to true indicates that you want us to act on the import immediately. In other words, we will proceed with the import, assuming everything is valid and/or sufficiently ignored. For example, skip_invalid being true means not much may happen if all your participants have invalid emails/locales, but with act_if_invalid set to true we will still try to import anything that is valid immediately.

The following 6 options are only used only if act_if_valid is true.

  • [Boolean] save_missing_categories (default true) save any missing demographic categories included in your payload.
  • [Boolean] only_demographics (default false) only create the included demographics for matched participants (we connected existing participants with external id or email)
  • [Boolean] destroy_existing_demographics (default false) destroy all existing demographics for matched participants (we connected existing participants with external id or email)
  • [Boolean] destroy_unmatched_participants (default false) destroy all existing participants for this event that were not included in the payload (and matched on external id or email)
  • [Boolean] skip_invalid (default false) ignores all invalid participants
  • [Boolean] skip_duplicate_identity_matches: (default false) skip over any duplicates when importing

Participant Properties

  • [String] external_id: an external system id used to reconcile participant identity on subsequent imports
  • [String] name a first and last name or any identifier. Can include spaces.
  • [String] email must be a valid email
  • [String] locale Must be one of the following values: ar_EG, bn_BN, cs_CS, de_DE, da_DA, el_EL, en_US, en_AU, en_GB, es_ES, et_EE, fi_FI, fr_FR, hi_IN, hu_HU, it_IT, ja_JP, ko_KR, ms_MY, nb_NO, nl_BE, pl_PL, pt_BR, ro_RO, ru_RU, sv_SE, tl_PH, tr_TR, uk_UA, vi_VI, zh_CN
  • [String] note any string
  • [String] demographics case-insensitive string matched against the existing demographic categories/demographics associated with the test. Exclusive means a participant can only be assigned one demographic from a particular category.

Example A sample payload

    {
      "external_event_id": "SOME_ID",
      "act_if_valid": false,
      "save_missing_categories": true,
      "only_demographics": false,
      "destroy_existing_demographics": false,
      "destroy_existing_demographics": false,
      "destroy_unmatched_participants": false,
      "skip_invalid": false,
      "skip_duplicate_identity_matches: false,
      "participants": [
        {
          "external_id": "PANELIST_1",
          "name": "Gal Montague",
          "email": "gal@montague.com",
          "locale": "en_US",
          "note": "Mall participant 6/4",
          "demographics": [
            {
              "demographic_category_name": "gender",
              "demographic_name": "female",
              "exclusive": true
            }
          ]
        },
        ...
      ]
    }

Next steps

The next step after RedJade successfuly receives your ParticipantImport

Returns:

#destroyObject

Deletes an import

Returns:

  • true

#exportHash<string, Document>

Creates a Document to download the contents of a ParticipantImport. This would be used by the "Download" button via the UI

Returns:

#indexHash<String, Array<ParticipantImport>>

Retrieve all ParticipantImport for a given event.

Options

  • [Integer] event_id (required) event you would like to retrieve imports for

Example

Fetch a list of ParticipantImport for event 12345

    curl -X GET "https://app.redjade.net/api/v1/participant_imports/?event_id=12345" -H "authorization: Bearer $bearer_token"
    {
      "response": [
          {
              "id": 6,
              "event_id": 10,
              "company_id": 1,
              "created_by_id": 2,
              "created_by_type": "OauthApplication",
              "document_file_name": null,
              "document_content_type": null,
              "document_updated_at": null
          },
          ....
          count: 5
     ]
    }

Returns:

#lookupObject

static GET for information on the available columns/schema for participant imports

#parserObject

Retrieve detailed information on how we interpretted the data given in a ParticipantImport

Example

Fetch parsed information for an import

    curl -X GET "https://app.redjade.net/api/v1/participant_imports/1/parser/" -H "authorization: Bearer $bearer_token"
    {
      "response": {
          "participants": [
              {
                  "name": "Gal Montague",
                  "note": "Mall participant 6/4",
                  "email": "gal@montague.com",
                  "locale": "en_US",
                  "external_id": "PANELIST_1",
                  "demographics": [
                      {
                          "exclusive": true,
                          "demographic_name": "female",
                          "demographic_category_name": "gender",
                          "demographic_category_id": 7,
                          "demographic_id": 13
                      }
                  ],
                  "row_number": 1,
                  "demographic_ids": [
                      13
                  ],
                  "invalid_fields": [],
                  "participant_id": 79,
                  "match_field": "external_id"
              },
              ....
          ]
      }
    }

#showHash<String, ParticipantImport>

Retrieve a particular ParticipantImport.

Returns: