Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Quickstart

Dave Timmins edited this page Jan 14, 2015 · 3 revisions

If you are calling a REST operation you will need to create a gateway to manage the request. There are a few different ones but the most basic is called PortalGateway and this can be used for connecting directly to services with ArcGIS Server.

Create an instance of that by specifying the root url of your server and an ISerializer unless you have initialised a default serializer to use. The format of the root url is scheme://host:port/instance so a typical default ArcGIS Server for your local machine would be http://localhost:6080/arcgis, note that you do not need to include rest/services in either the root url or your relative urls as it gets added automatically. One thing to look out for is that the url is case sensitive (I know, I know) so make sure you enter it correctly.

To initialise a default serializer call the static Init method once somewhere before you create a new gateway or tokenprovider.

// somewhere near the app start
JsonDotNetSerializer.Init(); // Using Json.NET

// when you need to call the REST API
var gateway = new PortalGateway("http://sampleserver3.arcgisonline.com/ArcGIS/");

Now you have access to the various operations supported by it. For example to call a query against a service just do

var queryPoint = new Query("Earthquakes/EarthquakesFromLastSevenDays/MapServer/0".AsEndpoint());
var resultPoint = await gateway.Query<Point>(queryPoint);

Clone this wiki locally