Rest APIs : REST API : Getting started : Understanding the REST API
Understanding the REST API
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.