Hub for Developers - Esri
Transcript of Hub for Developers - Esri
Hub For DevelopersDaniel Fenton@dmfenton
Agenda
• What is Hub?- Basic vs Premium
• Extending Hub- Pages- Custom Apps- [Coming Soon] Initiative Templates
• Hub JS• Hub API
- Search- Download
• Koop• More
- Cedar- ArcGIS REST JS
Extending Hub w/in the Product
Hub Pages and Initiatives Demo
Build your own apps with the same tools we useHub API
Hub API Routes
Purpose RouteSearch /api/v3/datasetsGet Document /api/v3/datasets/:idGet Document Relation /api/v3/datasets/:id/{default, item, org, data}Get Related Documents /api/v3/datasets/:id/relatedGet Connected Content /api/v3/datasets/:id/connectedGet Analytics /api/v3/metrics/:metric/:interval/FeatureServerDownload data /datasets/:id.{zip, csv, kml, geojson, gdb}Get/Manage Domains /utilities/domainsGet Single Domain /utilities/domains/:domain
Hub Search API in Depth: parameters
Parameter Pattern ExampleQuery q=:text q=waterFilter filter[:field]=:operator(:values) filter[tags]=any(water, air)Open Data openData:{true,false} openData=trueCatalog catalog[:field]=:operator(:values) catalog[groupIds]=any(1ef,2ef)Field Set fields[datasets]=:fields fields[datasets]=name,descriptionAggregations aggs=:fields&aggSize=:number aggs=type,tags&aggSize=5Pagination page[number]:count&page[size]:size page[number]=3&page[size]=100Sort sort={+,-}
{relevance,modified,trending,name}sort=-modified
Hub Search API in Depth: Filtering/Catalog
• Pattern: ?filter[:field]=:operator(:values)• Operators: any, all, not, gt, gte, lt, lte, eq• Filters are ANDed together• Catalog: special parameter, all catalog parameters are OR’d together then ANDed to
your search- E.g. filter[type]=Map&catalog[groupIds]=any(1ef, 2ef)&catalog[ids]=any(3ef)- > (where type=Map) AND (groupIds in (1ef, 2ef) OR ids IN (3ef, 4ef))
Hub Search API in Depth: Search Payload
Hub Search/Content API in Depth: Document Payload
Connect Anything to ArcGIShttps://koopjs.github.io
Koop
Koop Example: Google Analytics
• https://hub.arcgis.com/api/v3/metrics/:metric/:dimensions/FeatureServer• https://github.com/koopjs/koop-provider-google-analytics• Powers engagement dashboard for ArcGIS Hub
When to use Koop
• Data is sticky: - i.e. used heavily in existing business processes
• Someone else controls the data- e.g. a subscription based API service
• You want to use the data across ArcGIS toolkit- Not just a custom app
• SDE connection does not exist
Providers
• Translate between any remote API and GeoJSON• Pass-Through
- Communicate with remote API on every request- Data is too big to gather all at once- And/Or API supports filters and geometry queries- E.g. https://github.com/koopjs/koop-provider-yelp
• Cached- Gather all data at once- Data is small or doesn’t change often- E.g. https://github.com/dmfenton/koop-provider-craigslist
How to write a provider
• Find API docs or Reverse Engineer API via network tab• Implement `getData` function• Configure settings• Launch Server
From: https://washingtondc.craigslist.org/jsonsearch/apa/
To: http://adapters.koopernetes.com/craigslist/washingtondc/apartments/FeatureServer/0
Koop Example: Google Analytics
• https://hub.arcgis.com/api/v3/metrics/:metric/:dimensions/FeatureServer• https://github.com/koopjs/koop-provider-google-analytics• Powers engagement dashboard for ArcGIS Hub
Work with objects in the Hub Domain ModelHub JS
Make charts and graphs out of feature servicesCedar
Low level JavaScript library for working with ArcGIS REST APIsArcGIS REST JS
Please Take Our Survey on the AppDownload the Esri Events app and find your event
Select the session you attended
Scroll down to find the feedback section
Complete answersand select “Submit”