update
13 min
this allows you to update values on fields on your applicants forms this is broadly similar to get info , except that its scope is limited to updating fields and does not include system fields (anything which starts with an underscore, such as usercart ) for adding products see add product parameters name type required description fields string, integer, or array true these are the fields present in your forms see the section "fields" for more submit forms boolean false this prevents the user's forms from submitting this is generally advised if you want to prevent the update from activating triggers that are set in your project false will prevent the forms from submitting, but true is the default mark forms complete array or string false marks the user's forms complete pass an array of form ids, or "all" (as a string value) for every form the user has in their current form set only valid on action update see section for mark forms complete below for more example curl x post "https //www regpack com/reg/api2/users/" \\ h "content type application/json" \\ h "accept application/json" \\ h "api id 15263" \\ h "api user api admin\@regpacks com" \\ h "api token cd2e514f 7gab 3cde 62fg 51abcd4e7362" \\ d '{ "action" "update", "group id" 100909072, "clogin id" 102670541, "connected to" 102670540, "doc" { "your instrument" "piano", "will you record an album with jimi hendrix" \[ "no" ], "f 251473 6251473" "a field id looks like f 251473 6251473 by default, and has words like your instrument only when you map it" } }import requests import json users endpoint = https //www regpack com/reg/api2/users/ headers = { "content type" "application/json", "accept" "application/json", "api id" "15263", "api user" "api admin\@regpacks com", "api token" "cd2e514f 7gab 3cde 62fg 51abcd4e7362", } payload = { "action" "update", "group id" 100909072, "clogin id" 102670541, "connected to" 102670540, "doc" { "your instrument" "piano", "will you record an album with jimi hendrix" \[ "no" ], "f 251473 6251473" "a field id looks like f 251473 6251473 by default, and has words like your instrument only when you map it" } } update json = json dumps(payload) update response = requests post(url=users endpoint, data=update json, headers=headers, timeout=10) response { "msg" "user updated ", "system action" \[ "user updated" ], "success" true, "user info" { "clogin id" "102715741", "group id" "100909072", "connected to" "102715741" }, "meta info" { "u name" "jim hall", "total forms" "2", "completed forms" "0", "total user forms" "2", "total completed user forms" "0", "total user mandatory forms" "2", "total completed user mandatory forms" "0", "total order" "0 00", "total paid" "0 00", "total balance" "0 00", "status id" "0", "status name" null, "status color" null, "application date" "dec 8th 2021 17 20", "application date raw" "2021 12 08 17 20 08", "u comments" "0", "group id" "100909072", "uid" "4085257", "clogin id" "102715741", "excluded" "0", "connected to" "102715741", "total user tags" "0", "user tag ids" null, "total non excluded children" "0", "star" "0", "admin initials" null, "admin color" null, "assigned admin id" null } } mark forms complete mark forms complete is a top level field of the request (a sibling of action , group id , clogin id , connected to , and doc ), and it is only used while action update it marks one or more of a user's forms as complete — the same "complete" state a form reaches when the user finishes and submits it in the browser this is useful when you set a user's data through the api and want their forms to show as complete without the user having to open and submit each one it accepts either an array of form ids (mark exactly those forms complete) or the string "all" (mark every form the user currently has complete) only forms that belong to the user — the clogin id within group id — can be marked complete; any other ids are ignored and returned under skipped, each with a reason, such as the id not being in the user's form list the call is idempotent marking an already complete form complete does nothing, and it never un completes a form, so it is safe to call repeatedly a form can be marked complete even if some of its mandatory fields are still empty the call still succeeds and the form is marked complete, and a message is added to notices identifying the form and the first missing field, so you are aware doc is optional when you use mark forms complete — you can send the field on its own, with no field values, just to mark forms complete when both doc field values and mark forms complete are sent in one call, the field values are saved first, then the forms are marked complete mark specific forms complete sending a list of form id's allows you to mark those forms complete note the call below also happens to include field values ( "your instrument" "piano" ) when both doc field values and mark forms complete are sent in one call, the field values are saved first, then the forms are marked complete request curl x post "https //www regpack com/reg/api2/users/" \\ h "content type application/json" \\ h "accept application/json" \\ h "api id 15263" \\ h "api user api admin\@regpacks com" \\ h "api token cd2e514f 7gab 3cde 62fg 51abcd4e7362" \\ d '{ "action" "update", "group id" 100909072, "clogin id" 102670541, "connected to" 102670540, "doc" { "your instrument" "piano" }, "mark forms complete" \[250943, 250960] }'import requests import json users endpoint = "https //www regpack com/reg/api2/users/" headers = { "content type" "application/json", "accept" "application/json", "api id" "15263", "api user" "api admin\@regpacks com", "api token" "cd2e514f 7gab 3cde 62fg 51abcd4e7362", } payload = { "action" "update", "group id" 100909072, "clogin id" 102670541, "connected to" 102670540, "doc" { "your instrument" "piano" }, "mark forms complete" \[250943, 250960] } update json = json dumps(payload) update response = requests post(url=users endpoint, data=update json, headers=headers, timeout=10) response { "success" true, "msg" "information updated", "marked complete" \["250943", "250960"], "skipped" \[], "notices" \[] } mark every form the user has complete when "all" is sent as a string, all of the forms in the user's current form set will be marked complete request curl x post "https //www regpack com/reg/api2/users/" \\ h "content type application/json" \\ h "accept application/json" \\ h "api id 15263" \\ h "api user api admin\@regpacks com" \\ h "api token cd2e514f 7gab 3cde 62fg 51abcd4e7362" \\ d '{ "action" "update", "group id" 100909072, "clogin id" 102670541, "connected to" 102670540, "mark forms complete" "all" }'import requests import json users endpoint = "https //www regpack com/reg/api2/users/" headers = { "content type" "application/json", "accept" "application/json", "api id" "15263", "api user" "api admin\@regpacks com", "api token" "cd2e514f 7gab 3cde 62fg 51abcd4e7362", } payload = { "action" "update", "group id" 100909072, "clogin id" 102670541, "connected to" 102670540, "mark forms complete" "all" } update json = json dumps(payload) update response = requests post(url=users endpoint, data=update json, headers=headers, timeout=10) response { "success" true, "msg" "forms marked complete ", "marked complete" \["250943", "250960", "250961"], "skipped" \[], "notices" \[] } response fields added by mark forms complete field type meaning marked complete array of form id strings forms that were marked complete skipped array of { form id, reason } ids that were not marked complete (for example, the user does not have that form) notices array of strings informational messages, such as a form that was marked complete while it still has empty mandatory fields validation and troubleshooting it is important to note that there are a number of behind the scenes validation actions that are occurring whenever you attempt to update a user via the api to get an overview of the basic validation options for each type of field make sure to check out the section on fields situations in which no updates occur there are three common scenarios in which an update call will be made, but no information will be updated for the user if you attempt to update a user that does not exist in the project, the system will not update any information if you attempt to update a user that does exist but the answer to the field (such as a multiple choice answer; see more below) or the field itself does not exist, then the system will not update any information finally, if you attempt to update a user who does exist but they do not have the form that contains the field you are trying to update, then the system will not update any information additional multi select validation as mentioned in the section on fields, multiple choice fields should be sent in the api as an array of strings where a single answer update is an array of length one when a string within this array is parsed, we first test whether the string matches any of the existing values within that field if no match can be found, then the html is stripped from the string, and the entire string is converted to lowercase if after this the string still doesn't match any of the values within your project, then the system would proceed to not update the value the trouble with triggers if a call is otherwise correct and you set submit forms to false , then a few specific things happen the value will save as expected, and the form on which the field exists will not submit for the user the effect this has in practice is that it prevents subsequent triggers within forms, emails, products, etc from reacting to the submission of the form this being said, if there are any fields that are triggered to show within the form itself in response to the value you are updating, then those triggers will still activate generally this is not a big deal, and the emails, products, or subsequent forms are the things you're worried about activating
