Edit project breaks entirely for project with undefined user

this appears to be possible. i was able to change a test project by including only the items that i wanted to change in the payload:

  1. change the project description (to “test”):
    curl "https://api.inaturalist.org/v1/projects/pisum-s-personal-project" -X "PUT" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: JWT" -d "{\"project\":{\"description\":\"test\"}}"

  2. delete a particular user (1 of 2) from the “include” list (note destroy=true, and does not work if project_observation_rules_attributes[i].id is excluded):
    curl "https://api.inaturalist.org/v1/projects/pisum-s-personal-project" -X "PUT" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: JWT" -d "{\"project\":{\"project_observation_rules_attributes\":[{\"operator\":\"observed_by_user?\",\"operand_type\":\"User\",\"operand_id\":779571,\"id\":831929,\"_destroy\":true}]}}"

  3. add the user back to the “include” list:
    curl "https://api.inaturalist.org/v1/projects/pisum-s-personal-project" -X "PUT" -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: JWT" -d "{\"project\":{\"project_observation_rules_attributes\":[{\"operator\":\"observed_by_user?\",\"operand_type\":\"User\",\"operand_id\":779571}]}}"

hope this helps. let me know if you need anything else.

5 Likes