-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create new dataset (entity list) or property via the API #1105
Conversation
Once |
Ah I missed this in the PR description:
Could |
Backend part of these two issues:
getodk/central#575
getodk/central#576
Two new endpoints
POST /v1/projects/1/datasets
{ name: 'trees' }
POST /v1/projects/1/datasets/trees/properties
{ name: 'height' }
Still to do:
dataset.create
verb and use itWhat has been done to verify that this works as intended?
Tests.
Why is this the best possible solution? Were any other approaches considered?
I considered a different endpoint for adding properties. Maybe POSTing an array properties to a dataset, or PATCHing the dataset, but it didn't feel right. One reason is the existing
PATCH .../dataset/:name
endpoint is used for setting theapprovalRequired
flag, which feels like it's at a different level than dataset properties. Dataset properties have more to them, and they seem to deserve their own endpoint withPOST .../properties
.We could have a matching
GET .../properties
, but for now, the properties are returned in the main dataset getter.I tried to gate dataset creation via forms with the
dataset.create
verb, but it didn't quite make sense. We need to parse the whole form and get the dataset info out, and we would need to pass the auth mechanism along kind of deep insideform.createNew
. Also, we have oneDataset.createOrMerge
function that handles both new dataset and existing dataset cases, so we don't know if we're creating a dataset or not.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Does this change require updates to the API documentation? If so, please update docs/api.md as part of this PR.
Yes, I need to add documentation with this PR. (#1096)
Before submitting this PR, please make sure you have:
make test
and confirmed all checks still pass OR confirm CircleCI build passes