You are on page 1of 2

DevNet-Python-APIC-EM

1. REST API Review


Recall that Representational State Transfer (REST) is a standardized way of allowing
systems on the Internet to interact with one another. It uses the standard HTTP methods and
stateless transport to POST or PUT data and requests to an API and to GET responses from
the API.
REST APIs include the following characteristics:
● Use HTTP protocol methods and transport.
● API endpoints exist as server processes that are accessed through URIs.
● Webpages present data and functionality in human-machine interaction driven by a
user.
● APIs present data and functionality in machine-machine interactions driven by
software.

2. REST API Operation


An application is used to issue requests to an API endpoint that is accepting HTTP requests.
Each endpoint can may have different requirements for the format of the REST request.
These requirements are available in the API documentation that is provided to developers.

3. REST Request Elements


REST requests require the following elements (requirements may differ depending on the
API):
Method
● GET, POST, PUT, DELETE
URL
● Example: http://{APIC-EMController}/api/v1/host
Authentication
● Basic HTTP, OAuth, none, Custom
Custom Headers
● HTTP Headers
● Example: Content-Type: application/JSON
Request Body
● JSON or XML containing data needed to complete request
4. REST REspond Elements
The REST response includes the following elements:
● HTTP Status Code:
○ 200 OK
DevNet-Python-APIC-EM

○ 201 Created
○ 401, 403 Authorization error
○ 404 Resource not found
○ 500 Internal Error
● Headers
● Body
○ JSON
○ XML
5. Authenticating with the APIC-EM
Recall that authenticating a RESTful request is done in one of four ways:
● None: The API resource is public and anybody can place the request.
● Basic HTTP: The username and password are passed to the server in an encoded
string. This method is less common than token and OAuth authentication.
● Token: A secret key generally retrieved from the Web API developer portal.
● Open Authorization (OAuth): An open standard for retrieving an access token
from an Identity Provider. The token is then passed with each API call.

You might also like