Skip to content

Keys and replacement

Every record in the questionnaire schema has a key. Sending a key RedJade already has updates or replaces that record. Sending a new key adds a record.

Record created by Its key
Your application The string you sent. RedJade stores it and returns it unchanged.
RedJade A key RedJade assigns once and keeps. It is normally the record’s RedJade ID as a string.

Your application never needs to know which case applies. Store the key you receive and send it back to refer to the same record.

Treat a key as an opaque string. Do not convert it to a number or build one from an ID. If your application already used a record’s RedJade ID as the key of a different record in the same scope, RedJade assigns the RedJade-created record a different key. This includes external_id values. A key that belonged to a deleted record is not given to another record.

A participant’s key is your ID for the person. A participant who entered a survey through a link with external_id has that value as their key.

A key is unique within its scope. The same string can be reused in a different scope.

Record Unique within
context.project, context.test Your company
context.event The test
participant The test
questionnaire The test
questionnaire.repetition Your company
Question The questionnaire
Option, grid row The question
samples[] The project
Demographic category The test
Demographic option The category

Keys are matched exactly, including case. A misspelled key creates a new record.

A repetition is one participant’s pass through one questionnaire. questionnaire.repetition.key identifies it.

You send Result
A new repetition key RedJade adds a repetition and returns 201 with status: "created"
An existing repetition key RedJade replaces that repetition’s responses and returns 200 with status: "replaced"
No repetition key RedJade adds a repetition and returns the key it assigned

For example, one member answers the same poll three times:

Request Repetitions afterwards
Key poll-member-17-a, response yes One: yes
Key poll-member-17-b, response no Two: yes, no
Key poll-member-17-a, response no Two: no, no

A poll that allows one vote per member uses one key per member and poll. Sending it again changes the vote. An application that records repeated evaluations uses a new key each time.

Replacing a repetition replaces all of its responses. Send every response you want to keep. The participant, questionnaire, and sample must stay the same; a replacement that changes them returns 409.

Send the repetition key on the first request. If the HTTP response is lost, sending the same request again replaces the same repetition. Without a key, the retry adds a second one.

repetition.number counts a participant’s repetitions of one questionnaire for one sample, starting at 1. RedJade assigns it. Two samples evaluated by the same participant each have a repetition numbered 1, so the number does not identify a repetition without the participant, questionnaire, and sample. The key does.

When a participant retakes a questionnaire in RedJade, the repetition keeps its key and number, and its responses are replaced.

When RedJade staff reset a repetition, its responses are deleted and the repetition keeps its key and number. Sending that key again fills the same repetition and returns 200 with status: "replaced".

A repetition that was deleted in RedJade keeps its key reserved. A repetition that was excluded in RedJade accepts no responses. Sending either key returns 409.

Either kind of request creates the participant: sending responses or sending demographics. Later requests to the same test with the same participant.key refer to the same person, whichever came first.

If you also send participant.code, it must belong to the same participant as the key. A conflict returns 409.

A responses request to a test key RedJade does not have creates the test. A new questionnaire.key or sample key creates that record in the test or its project. An existing key reuses the record, and a name you send updates its label.

A new test is placed in the project named by context.project.key. Without one, RedJade creates a project. An existing test stays in its project.

The request that creates a test must name its owner in context.test.owner_email: the email address of an active RedJade user in your company. That user owns the test and any project created with it. Requests to an existing test do not need an owner.

Item Limit
Any key 255 UTF-8 bytes
Option and row keys Letters, digits, and hyphens only