Hub for Developers - Esri

24
Hub For Developers Daniel Fenton @dmfenton

Transcript of Hub for Developers - Esri

Page 1: Hub for Developers - Esri

Hub For DevelopersDaniel Fenton@dmfenton

Page 2: Hub for Developers - Esri

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

Page 3: Hub for Developers - Esri
Page 4: Hub for Developers - Esri

Extending Hub w/in the Product

Page 5: Hub for Developers - Esri
Page 6: Hub for Developers - Esri

Hub Pages and Initiatives Demo

Page 7: Hub for Developers - Esri

Build your own apps with the same tools we useHub API

Page 8: Hub for Developers - Esri

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

Page 9: Hub for Developers - Esri

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

Page 10: Hub for Developers - Esri

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))

Page 11: Hub for Developers - Esri

Hub Search API in Depth: Search Payload

Page 12: Hub for Developers - Esri

Hub Search/Content API in Depth: Document Payload

Page 13: Hub for Developers - Esri

Connect Anything to ArcGIShttps://koopjs.github.io

Koop

Page 14: Hub for Developers - Esri
Page 15: Hub for Developers - Esri

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

Page 16: Hub for Developers - Esri

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

Page 17: Hub for Developers - Esri

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

Page 18: Hub for Developers - Esri

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

Page 19: Hub for Developers - Esri

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

Page 20: Hub for Developers - Esri

Work with objects in the Hub Domain ModelHub JS

Page 21: Hub for Developers - Esri

Make charts and graphs out of feature servicesCedar

Page 22: Hub for Developers - Esri

Low level JavaScript library for working with ArcGIS REST APIsArcGIS REST JS

Page 23: Hub for Developers - Esri
Page 24: Hub for Developers - Esri

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”