Hi @samforsberg, @Kal_Lam, it sounds like there are two issues here:
- In the UI, we only show deployed versions in the history. This is a known limitation that we would like to fix. What I believe happened in this case is that a form had various revisions without ever being deployed (as shown in this screenshot)—and we do store these—but we don’t offer any way to recover them in the UI.
- Something is wrong with cloning a form and subsequently editing a new form, where the new form somehow overwrites the previous one. This sounds like a serious issue that we’ve never heard about before, and any help you can provide, @samforsberg, in the form of reproduction steps would be very much appreciated.
To get out of the current predicament (revert the form content now that you’ve found the correct JSON), you need to manually PATCH the JSON to the asset where it belongs. I’ll show an example where I’ve created a form with only one question; I’ll then overwrite that form with different JSON content.
- The destination form:
- Note its UID,
ab72MkqfFN8g3aY4SvnhT2
- Note its UID,
- The “raw data” form shown at the asset detail endpoint for this form,
https://kf.kobotoolbox.org/api/v2/assets/ab72MkqfFN8g3aY4SvnhT2/
(observe use of form UID in the URL):
- I’ll now erase everything from the “Content:” box and replace it with my desired form JSON surrounded with the following context:
Don’t worry about making the indentation consistent, but make sure you include the closing curly brace at the end. In my example, the form JSON with context looks like:{"content": PASTE FORM JSON HERE }
{"content": { "schema": "1", "survey": [ { "name": "start", "type": "start", "$kuid": "CJjKco56O", "$autoname": "start" }, { "name": "end", "type": "end", "$kuid": "wmyuj7O5M", "$autoname": "end" }, { "type": "select_one", "$kuid": "fo8dv50", "label": [ "What's your favorite fruit?" ], "required": false, "$autoname": "What_s_your_favorite_fruit", "select_from_list_name": "nz7yq33" } ], "choices": [ { "name": "persimmon", "$kuid": "jAmHkjb5R", "label": [ "Persimmon" ], "list_name": "nz7yq33", "$autovalue": "persimmon" }, { "name": "peach", "$kuid": "t1MEPE5zX", "label": [ "Peach" ], "list_name": "nz7yq33", "$autovalue": "peach" }, { "name": "plum", "$kuid": "tiy5DzzIp", "label": [ "Plum" ], "list_name": "nz7yq33", "$autovalue": "plum" }, { "name": "pear", "$kuid": "rliyn6r49", "label": [ "Pear" ], "list_name": "nz7yq33", "$autovalue": "pear" } ], "settings": {}, "translated": [ "label" ], "translations": [ null ] } }
- Before the next step, make sure neither you nor anyone else who has edit access to the form has the form open in a tab where they might accidentally click SAVE. If they save the broken form after you’ve done the next step, they will undo all of your work.
- Click the blue PATCH button;
- Once the page reloads, look for “CURRENT ENDPOINT”. I’d suggest using Control/Command+F in your browser. You should see
PATCH /api/v2/assets/YOUR-FORM-UID/
followed byHTTP 200 OK
, for example:
- At this point, your form should be restored. You can navigate away from the API endpoint or close the tab and return to the normal UI:
Let us know if you’re able to complete this successfully.