Understanding and Using the Satshot Services API, Version 2
An introductory guide to the concepts and capabilities of the Services API
Avi
Blackmore
Head Programmer/Administrator
2013
Agri ImaGIS Technologies, Inc.
Table of Contents
IntroductionThe Satshot Services API is a set of methods which provide a high level, flexible interface to Satshot's server-side GIS capabilities. These capabilities include basic
mapping, image analysis, precision agriculture tools, exporting of data to various data formats, user and entity tracking, and many other features. There are five core
principles behind the design of the Services API:
- Client programs should not need to have any client-side GIS capability in order to do useful work. A client may well be a full GIS system in its own right, but it may also be a
simple graphical interface over the Services API, or it may be a command line or a "headless" batch script running as a background process. The API makes no assumptions about
what the client will do with data returned by API methods, or how its users interact with the API and the client.
- As much as possible, allow for various methods to be called in any desired fashion, with as much flexibility and as few interdependencies as possible. Obviously, there are a
few things which have to be done in a certain order, and some methods and related capabilities have certain restrictions on them, but we've tried to keep this to a minimum.
- Do not require client programs to be programmed in any particular language, or for any particular operating system. Portability is paramount. To this end, we use XML-RPC over
HTTP as our communication interface.
- As much as possible, be self-documenting. The API code makes use of long, descriptive method names, which help (hopefully) to make code that uses them easier to
understand. Also, it is extensively documented with reference material. This tutorial complements that material.
- Minimize the number of calls necessary to accomplish a task. Server calls have a cost in network latency, and performing a looped operation on the server is much more
efficient use of bandwidth than iterating on the client side. Oftentimes it makes more sense for a client program to perform an operation on multiple pieces of data at
once, while at other times, manipulating a single datum at a time makes more sense. When possible, methods are offered in both "singular" and "plural" versions, where
the plural version operates on a set of the data that the singular version manipulates one at a time. For example: load_map() and load_maps(),
respectively, load a single map context (see below) or a set of them. In this tutorial, the singular version of a method is given first, and then the plural in
parentheses.
Requirements for a client program are minimal. In order to communicate
with the Services API, a client must have:
- A network connection.
- An XML-RPC library.
- HTTP (and HTTPS) transport library which accepts and handles HTTP cookies, OR
- An HTTP (and HTTPS) transport library which allows URL parameters.
There is only one cookie value set by the API, which is called "idtoken". If using URL parameters, the parameter is also named "idtoken". Connections to the server are made
securely via HTTPS.
Otherwise, the Services API does not need to know or care about what sort of client is talking to it. Clients can be written in any language, for any platform, which has
access to the above capabilities.
Reference DocumentationThe accompanying reference documentation follows certain conventions. Method names are cross-referenced, while parameter names are given in all uppercase. The meanings of
all parameters are described in full, as well as any exceptions that may be thrown. The documentation refers to the API's component libraries as classes; this is an artifact
of the implementation, but does create a useful separation of capabilities. The methods described in this document are grouped into three classes: CORE_API, which contains
methods that all Satshot Services servers will support; MAPCENTER_API, for precision agriculture methods; and CLU_MAPCENTER_API, which adds support for the attributed CLU
methods.
Bear in mind that, while the PHP code on the server uses object oriented design, this does not necessarily mean that a client program must do so. The same is true for the
use of exceptions; XML-RPC translates exceptions into a portable format that can work with any sort of client-side error checking.
Quick Start Reference- XML-RPC services URL: https://SITENAME.satshot.com/xmlrpc.php
- Available sites: us.satshot.com, ca.satshot.com, mexico.satshot.com
- XMLRPC client library must store and return cookies, or must use URL parameters. URL parameter required: "?idtoken=" + session token, which is return value of
login().
- Call logout() to end session.
| Prev |
|
Next |
|
|
Basic Access and Map Services |
|
|