Open tomsaleeba opened 4 years ago
We need WOW to support creating records that support presence/absence mapping. iNat has a feature for this: Trips.
So we need WOW to support creating Trips in iNat. Currently there's no API endpoints for Trips in the iNat API so we'll have to add that ourselves.
To see how Trips work and what kinds of data they need, I created a trip using the iNat dashboard and it made this request:
POST https://dev.inat.techotom.com/trips utf8: ✓ authenticity_token: ...blah trip[title]: firsty trip trip[body]: some desc trip[distance]: 123 trip[number]: 666 trip[start_time]: 2020-08-27 09:00 +0930 trip[stop_time]: 2020-08-27 17:00 +0930 trip[place_id]: location: trip[latitude]: -30 trip[longitude]: 130 trip[radius]: 444 reptilia: reptilia aves: aves trip[trip_purposes_attributes][1598493611864][trip_id]: trip[trip_purposes_attributes][1598493611864][resource_type]: Taxon trip[trip_purposes_attributes][1598493611864][resource_id]: 5 trip[trip_purposes_attributes][1598493611864][complete]: true trip[trip_purposes_attributes][1598493611864][_destroy]: false trip[trip_purposes_attributes][1598493612702][trip_id]: trip[trip_purposes_attributes][1598493612702][resource_type]: Taxon trip[trip_purposes_attributes][1598493612702][resource_id]: 6 trip[trip_purposes_attributes][1598493612702][complete]: true trip[trip_purposes_attributes][1598493612702][_destroy]: false new_goal_taxon: commit: Save
...from a UI that looked like:
The response is a 301 that sends the user to the page for that trip. Getting the JSON for that new trip page looks like:
{ trip: { id: 16, parent_id: 1, parent_type: 'User', user_id: 1, published_at: null, title: 'firsty trip', body: 'some desc', created_at: '2020-08-27T11:30:20.073+09:30', updated_at: '2020-08-27T11:30:20.073+09:30', start_time: '2020-08-27T09:00:00.000+09:30', stop_time: '2020-08-27T17:00:00.000+09:30', place_id: null, latitude: '-30.0', longitude: '130.0', radius: 444, distance: 123, number: 666, uuid: '2603e29f-f166-48eb-93d6-476946177c26', trip_taxa: [], trip_purposes: [ { id: 2, trip_id: 16, purpose: null, resource_type: 'Taxon', resource_id: 6, success: null, complete: true, created_at: '2020-08-27T11:30:20.148+09:30', updated_at: '2020-08-27T11:30:20.148+09:30', resource: { id: 6, name: 'Reptilia', rank: 'class', created_at: '2019-07-26T14:16:16.783+09:30', updated_at: '2019-07-26T14:16:17.749+09:30', iconic_taxon_id: 6, is_iconic: true, observations_count: 2, listed_taxa_count: 1, rank_level: 50, unique_name: 'reptiles', ancestry: '1/2/4', is_active: true, complete_rank: null, complete: null, taxon_framework_relationship_id: null, uuid: null, photos_locked: false, }, }, { id: 1, trip_id: 16, purpose: null, resource_type: 'Taxon', resource_id: 5, success: null, complete: true, created_at: '2020-08-27T11:30:20.119+09:30', updated_at: '2020-08-27T11:30:20.119+09:30', resource: { id: 5, name: 'Aves', rank: 'class', created_at: '2019-07-26T14:16:13.544+09:30', updated_at: '2019-07-26T14:16:14.713+09:30', iconic_taxon_id: 5, is_iconic: true, observations_count: 3, listed_taxa_count: 1, rank_level: 50, unique_name: 'birds', ancestry: '1/2/4', is_active: true, complete_rank: null, complete: null, taxon_framework_relationship_id: null, uuid: null, photos_locked: false, }, }, ], }, }
We need WOW to support creating records that support presence/absence mapping. iNat has a feature for this: Trips.
So we need WOW to support creating Trips in iNat. Currently there's no API endpoints for Trips in the iNat API so we'll have to add that ourselves.
To see how Trips work and what kinds of data they need, I created a trip using the iNat dashboard and it made this request:
...from a UI that looked like:
The response is a 301 that sends the user to the page for that trip. Getting the JSON for that new trip page looks like: