REST APIs : Getting started : Understanding the REST API
Understanding the REST API
Page Contents
Supported REST API environments
Assumptions about you
The REST API allows you to send changes to or receive data from one application using another application.
Tip! Feedback — We want to hear from you. If you have a question and need a response, click the “E-mail” icon above to send private feedback to VIAVI about the specific page you are on. –Or– If no response is necessary, at the bottom of every page is a form to submit anonymous comments and questions about the content.
REST is REpresentational State Transfer. REST uses the HTTP protocol to interact with applications.
REST is an architecture, not a language or a protocol. It describes how an application is structured. Using URIs you can descend into and interact with the application.
REST is also client-server. Observer Apex or Observer Management Server (OMS) are always considered the server and requests come from clients, such as a web browser or other applications.
REST is stateless, which means that the server does not store any details about the client. Each and every request that a client sends must contain all of the information necessary for the server to complete the request.
REST sometimes is referred to as using QCRUD, where each letter stands for a different action that can be taken: Query, Create, Read, Update, Delete. The REST API is comprised of these HTTP actions:
GET: used to query for or read data from the server, like user IDs or dashboard results. GET is considered a “safe” method because no changes on the server are made.
POST: used to create new objects, like users, users, or dashboards. For a POST method, the HTTP response contains the URI path and {ID} of the newly created resource in the “Location” HTTP header. For example, when a new user is created, the “Location” HTTP header will contain: "/users/9D24469A-976E-11E4-B88F-002590365523".
PUT: used to update an existing object. All PUT methods must always take the full resource definition, not just fields being modified. A PUT request is considered Idempotent or “unsafe” because it can change an existing object. This is not to imply that PUT actions should not be done. Not at all. Instead, it means simply that you must ensure that the definition you send has exactly the values you want it to have before issuing the PUT.
DELETE: used to delete an object. A DELETE is also considered Idempotent. After an object has been deleted with the DELETE method, it cannot be restored. There is no confirmation requested like there is in the web interface. Use with care!
The REST API is not magic. Everything that can be done in the web UI for Apex or OMS can also be done with the REST API. Moreover, the REST API does not contain special power to do any extra actions that cannot be done in the web UI. In short, there is a one-to-one relationship between REST API actions and web UI actions. What the REST API does is allow you to control or maninpulate the product using something other than the web interface.
Supported REST API environments
You may use any programming or scripting language you wish to develop your calls; however, if you have an issue for which you require technical support, you must be using one of these.
Python 3.4 or above
Assumptions about you
We assume that you have experience working with REST APIs.
Although we briefly introduce what REST is, we assume you already know what it is and how it works. Further, we assume you have:
Experience using REST APIs to integrate data from one application into another
A deep understanding of your target application if you are pulling data from Observer Platform
A deep understanding of your source application if you are pushing changes into Observer Platform
Experience with Python or whatever programming language or environment you choose to use. See supported languages.
Experience with XPath to reference specific elements if you use XML.
Experience with JavaScript to locate specific attribute-value pairs or arrays if you use JSON.