Skip to content

Commit 6c4472b

Browse files
committed
Start to replace APIC-EM with DNA Center Sandbox
1 parent 4c9e233 commit 6c4472b

File tree

32 files changed

+160
-175
lines changed

32 files changed

+160
-175
lines changed

labs/coding-101-rest-basics-ga/1.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Coding 101 - REST API Basics with APIC-EM
2+
# Coding 101 - REST API Basics
33

44
This Learning Lab explains the basics of using a REST API. It also shows how to use Postman to explore a REST API.
55

@@ -10,37 +10,28 @@ This Learning Lab explains the basics of using a REST API. It also shows how to
1010

1111
## Prerequisites
1212

13-
- <a href="https://www.getpostman.com" target="_blank">Postman</a> installed.
14-
If you are on a DevNet Zone station, <a href="https://www.getpostman.com" target="_blank">Postman</a> is already installed. You can start it from the Google App Launcher or Chrome by clicking <a href="https://www.getpostman.com" target="_blank">here</a> and clicking **Launch App**.
13+
- [Postman](https://www.getpostman.com) installed.
14+
If you are on a DevNet Zone station, Postman is already installed.
1515

16-
- Access to an APIC-EM Controller. To run the code samples, you need access to an APIC-EM controller. If you are not using your APIC-EM controller, you can use the APIC-EM Lab:
17-
* https://sandboxapicem.cisco.com
16+
- Access to DNA Center. To run the code samples, you need access to DNA Center. You can use the DNA Center DevNet Sandbox:
17+
* https://sandboxdnac.cisco.com
1818
* **username:** devnetuser
1919
* **password:** Cisco123!
2020

21-
## Step 1. Find the APIC-EM API Resources and Documentation
21+
## Step 1. Find the DNA Center API Resources and Documentation
2222

23-
A good starting point to understand any API is to look at the documentation for the API. Now, find documentation for the APIC-EM API.
23+
A good starting point to understand any API is to look at the documentation for the API. Now, find documentation for the DNA Center API.
2424

25-
1. In a browser, navigate to the <a href="https://developer.cisco.com" target="_blank">DevNet</a> home page.
26-
2. Click the **Login** link located at the top right of the webpage.
27-
![](/posts/files/coding-101-rest-basics-ga/assets/images/login.png)<br/><br/>
28-
3. On the Log In page, enter your credentials.
29-
To log in with a Cisco ID but do not have a Cisco Connection Online ID (CCO ID) click the **Register Now** button and follow the instructions. Then, return to the Log In webpage and enter your credentials.
30-
<br/><br/>
31-
4. Use the menu at the top to navigate to the APIC-EM web portal.
25+
1. In a browser, navigate to the [DevNet](https://developer.cisco.com/) home page.
26+
1. Use the menu at the top to navigate to the .
3227
* Click the **Technologies** link to see the submenu.
3328
* Click **Networking**
34-
* From the list of technologies, click **APIC Enterprise Module (APIC-EM)**<br/>The APIC-EM webpage appears.
29+
* From the list of technologies, click **DNA Center Platform)**.
3530
![](/posts/files/coding-101-rest-basics-ga/assets/images/Menu.png)
3631
<br/>
37-
5. On the APIC-EM webpage. Click the `Docs` link.<br/>
38-
![](/posts/files/coding-101-rest-basics-ga/assets/images/apic-em-main.png)
39-
6. Click on `API Reference`.
40-
7. Select the latest API version.
41-
8. Keep the APIC-EM API Reference documentation open in a separate tab. This will be a useful reference while you work on this lab.
42-
![](/posts/files/coding-101-rest-basics-ga/assets/images/Ref.png)
43-
<br/>
44-
<br/>
32+
1. On the DNA Center Platform page, click the `Docs` link.
33+
1. Click `API Reference`.
34+
1. Select the latest API version.
35+
1. Keep the DNA Center API Reference documentation open in a separate tab. This will be a useful reference while you work on this lab.
4536

4637
### Next Step: Learn about the REST Web Service

labs/coding-101-rest-basics-ga/2.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Step 2. So what is a REST web service?
1+
## Step 2: So what is a REST web service?
22

33
### What is a Web Service?
44

@@ -10,24 +10,23 @@ There are two major types of web services – **REST** and **SOAP**.
1010
REST is an architecture style for designing networked applications.
1111
A REST web service is as easy to call as making an HTTP request.
1212
RESTful interfaces usually offer the CRUD (Create, Read, Update, Delete) operations.
13-
To know more about REST in general, this is a great <a href="https://en.m.wikipedia.org/wiki/Representational_state_transfer" target="_blank">REST definition</a>.
14-
13+
To know more about REST in general, this is a great [REST definition](https://en.m.wikipedia.org/wiki/Representational_state_transfer).
1514

1615
### What are the benefits of REST?
1716

1817
***REST is easy to use on any platform***
1918

2019
![](/posts/files/coding-101-rest-basics-ga/assets/images/RESTisGreat.jpg)
2120

22-
### APIC-EM API is a REST API
21+
### DNA Center API is a REST API
2322

24-
For this lab, you are going to use the <a href="https://developer.cisco.com/site/apic-em/" target="_blank">APIC-EM APIs</a>.
23+
For this lab, you are going to use the [DNA Center APIs](https://developer.cisco.com/site/dna-center-rest-api/).
2524

26-
The Application Policy Infrastructure Control (APIC) Enterprise Module (EM), Application Programming Interface (API), <a href="https://developer.cisco.com/site/apic-em/" target="_blank">APIC-EM APIs</a>, enables deploying and running application policies across your networking infrastructure.
25+
DNA Center APIs enable deploying and running application policies across your networking infrastructure.
2726

28-
Using the APIC-EM APIs, you can retrieve information about devices on your network including a list of hosts, network devices, or users. You are going to use these features as examples to learn how to make REST calls from Python.
27+
Using the DNA Center APIs, you can retrieve information about devices on your network including a list of hosts, network devices, or users. You are going to use these features as examples to learn how to make REST calls from Python.
2928

30-
Look at the <a href="https://developer.cisco.com/site/apic-em-rest-api//" target="_blank">APIC-EM Reference Docs</a> to see the details of the APIC-EM functions.
29+
Look at the [DNA Center documentation](https://developer.cisco.com/site/dna-center-rest-api/) to see the details of the functions.
3130

3231

3332
### How does this work?
@@ -38,8 +37,8 @@ REST is centered around the HTTP request and response model. Consuming an API is
3837

3938
In this example, you request the list of hosts, and that information is returned to you in the response. The data returned in the response is usually formatted as JSON or XML.
4039

41-
(<a href="https://www.json.org/" target="_blank">JSON</a> -- JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange.)
40+
* [JSON](https://www.json.org/") - JSON, or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange.
4241

43-
(<a href="https://www.w3schools.com/xml/xml_whatis.asp" target="_blank">XML</a> -- eXtensible Markup Language, a language designed to store and transport data.)
42+
* [XML](https://www.w3schools.com/xml/xml_whatis.asp) - XML, or eXtensible Markup Language, a language designed to store and transport data.
4443

45-
### Next Step: HTTP Response Request Facts
44+
### Next Step: HTTP response and request facts

labs/coding-101-rest-basics-ga/3.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Step 3. What do I need to know to make a Request?
1+
## Step 3: What do I need to know to make a request?
22

33
To construct a request, determine the following information for the API that you are calling. You can find this information in the API reference documentation.
44

@@ -11,9 +11,9 @@ Choose one of the following http methods:
1111

1212
- **URL**
1313
* Determine the URL of the endpoint you want to call.
14-
* Example: `https://{APIC-EMController}/api/v1/ticket`
15-
* Where `{APIC-EMController}` is the controller IP or hostname.
16-
* Use the Cisco DevNet Learning Lab's APIC-EM controller, at https://sandboxapicem.cisco.com/, or enter the URL/IP address of an APIC-EM controller on your network.
14+
* Example: `https://sandboxdnac.cisco.com/api/system/v1/auth/token`
15+
* Where `sandboxdnac.cisco.com` is the controller IP or hostname.
16+
* Use the Cisco DevNet Learning Lab's DNA Center, at https://sandboxdnac.cisco.com/, or enter the URL/IP address of an DNA Center on your network.
1717
- **URL Parameters**
1818
* If the endpoint requires URL parameters, pass them as part of the URL. To get this information, refer to the reference documentation for the particular endpoint.
1919
- **Authentication**
@@ -34,7 +34,7 @@ REST APIs have three common methods to authenticate users:
3434
* **OAuth:** Open standard for HTTP authentication and session management. Creates an access token associated with a specific user that also specifies the user rights. The token identifies the user and rights when making API calls to verify access and control. See [OAuth](https://en.wikipedia.org/wiki/OAuth) for more information.
3535
3. **Token:** As with OAuth, a token is created and passed with each API call, but there is no session management and tracking of clients. This simplifies interaction between the server and client. APIC-EM uses this design for authentication management. See [Token Based Authentication](https://scotch.io/tutorials/the-ins-and-outs-of-token-based-authentication) for more information.
3636

37-
APIC-EM uses token-based authentication. So the first request you need to make creates a token. In APIC-EM, this token is called a *service ticket*. The controller uses the service ticket to determine which endpoints you can access. The service ticket must be included in every API call except the one that creates the ticket.
37+
APIC-EM uses token-based authentication. So the first request you need to make creates a token. In APIC-EM, this token is called a *token*. The controller uses the token to determine which endpoints you can access. The token must be included in every API call except the one that creates the ticket.
3838

3939
The steps for using the APIC-EM authentication token are:
4040

labs/coding-101-rest-basics-ga/4.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
### APIC-EM Example: POST Create a Ticket
44

5-
Now, look at how to use the API to create a service ticket for authentication.
5+
Now, look at how to use the API to create a token for authentication.
66

7-
You need to know how to construct the request to retrieve the service ticket. Use the API docs to determine the:
7+
You need to know how to construct the request to retrieve the token. Use the API docs to determine the:
88

99
* Method
1010
* URL
@@ -20,29 +20,29 @@ https://{APIC-EM-Server}/api/v1
2020
2121
```
2222

23-
Get the description of the ticket API call from the -- <a href="https://developer.cisco.com/site/apic-em/docs/api.html?version=1.6" target="_blank">APIC-EM API Docs</a>. Choose the proper API version.
23+
Get the description of the ticket API call from the -- <a href="https://developer.cisco.com/site/apic-em/docs/api.html?version=1.6" target="_blank">DNA Center API Docs</a>. Choose the proper API version.
2424

2525
`POST /api/v1/ticket`: This method creates a new user ticket
2626

2727

28-
The HTTP call to a create a service ticket is easy.
28+
The HTTP call to a create a token is easy.
2929
```http
3030
3131
https://{APIC-EM-Server}/api/v1/ticket
3232
3333
```
3434

35-
To get the service ticket your request will look like this:
35+
To get the token your request will look like this:
3636

3737
* **Method** - `POST`
3838
* **URL** - `https://{APIC-EM-Server}/api/v1/ticket`
39-
* Substitute `{APIC-EM-Server}` with the IP address or hostname of the APIC-EM controller you are using. For example, the Cisco DevNet Learning Labs APIC-EM controller is `https://sandboxapicem.cisco.com/`.
39+
* Substitute `{APIC-EM-Server}` with the IP address or hostname of the DNA Center you are using. For example, the Cisco DevNet Learning Labs DNA Center is `https://sandboxdnac.cisco.com/`.
4040
* **Headers**
4141
* Specify the 'Content-Type' as 'application/json'. It's typical to include this header with all HTTP methods (GET, POST, PUT, DELETE) calls.
4242
* **Authentication**
4343
* In this API call, the authentication data is passed in the body.
4444
* **Body**
45-
* Provide the username and password for logging into the APIC-EM Controller in JSON format.
45+
* Provide the username and password for logging into the DNA Center in JSON format.
4646

4747
![](/posts/files/coding-101-rest-basics-ga/assets/images/apic-em-request.png)
4848

labs/coding-101-rest-basics-ga/5.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ There are HTTP clients you can use to quickly test web services. They provide a
77
* Command Line using curl - [https://curl.haxx.se/docs/httpscripting.html# POST](https://curl.haxx.se/docs/httpscripting.html# POST)
88
* SOAPUI - [https://www.soapui.org/](https://www.soapui.org/)
99

10-
Many IDEs have also consoles for testing REST Services built in
10+
Many IDEs have also consoles for testing REST Services built in.
1111

1212
In this lab, you use Postman as an example of a REST client.
1313

@@ -16,21 +16,18 @@ On OS X, to use Python 3.4, you may need to accept the SSL certificate before ca
1616

1717
1. Open Chrome.
1818

19-
2. If you are using the DevNet APIC-EM Sandbox, go to [https://sandboxapicem.cisco.com](https://sandboxapicem.cisco.com).
19+
2. If you are using the DevNet DNA Center Platform Sandbox, go to [https://sandboxdnac.cisco.com](https://sandboxdnac.cisco.com).
2020

21-
3. If you receive a message specifying that there is a certificate issue, click the **Advanced** link. Otherwise, if you are taken to the APIC-EM UI login screen skip to the 'Using Postman to make REST API Calls' section.<br/><br/>
22-
![](/posts/files/coding-101-rest-basics-ga/assets/images/ssl1.png)<br/>
21+
3. If you receive a message specifying that there is a certificate issue, click the **Advanced** link. Otherwise, if you are taken to the login screen skip to the 'Using Postman to make REST API Calls' section.
2322

24-
4. Click the **Proceed to &lt;your IP>** link<br/><br/>
25-
![](/posts/files/coding-101-rest-basics-ga/assets/images/ssl2.png)<br/>
23+
4. Click the **Proceed to &lt;your IP>** link.
2624

27-
5. You should then be taken the APIC-EM login screen. Now you are ready to start working in Postman.<br/><br/>
25+
5. You should then be taken the login screen. Now you are ready to start working in Postman.<br/><br/>
2826
![](/posts/files/coding-101-rest-basics-ga/assets/images/ssl3.png)
2927

3028
### Using Postman to make REST API Calls
3129

32-
1. Start Chrome and open Postman.
33-
* If you are on a DevNet Zone station, Postman is already installed and can be launched either from the Google App Launcher or Chrome by clicking <a href="https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en" target="_blank">Postman</a> and hitting Launch App. Otherwise, make sure that you are viewing this page in the Chrome browser, click the Postman link and follow the instructions to install and launch Postman.
30+
1. Start Chrome and open Postman. If you are on a DevNet Zone station, Postman is already installed.
3431

3532
2. For your request to retrieve the list of hosts into the appropriate Postman fields, enter the following information:
3633

@@ -39,10 +36,9 @@ On OS X, to use Python 3.4, you may need to accept the SSL certificate before ca
3936
* **Method**
4037
* ``A.`` Select **POST**.
4138
* **URL**
42-
* ``B.`` Enter `https://{APIC-EMController}/api/v1/ticket`
43-
* If you are not using your APIC-EM controller, use the APIC-EM Lab: <a href="https://devnetapi.cisco.com/sandbox/apic_em">https://sandboxapicem.cisco.com/</a>.
39+
* ``B.`` Enter `https://sandboxdnac.cisco.com/api/system/v1/auth/token` to use the DevNet Sandbox, or enter your own API endpoint.
4440
* **Body**
45-
* ``C.`` Enter the username and password in JSON format. These credentials are used to log into the APIC-EM Controller. If you are accessing the DevNet APIC-EM Lab, enter the username and password, as specified earlier. Otherwise, enter the required username and password for your APIC-EM Controller.
41+
* ``C.`` Enter the username and password in JSON format. These credentials are used to log into the DNA Center. If you are accessing the DNA Center Platform Sandbox, enter the username and password, as specified earlier. Otherwise, enter the required username and password for your DNA Center.
4642
* **Headers**
4743
* ``A.`` In the header, enter: `Content-Type` followed by `application/json`.<br/><br/>
4844
![](/posts/files/coding-101-rest-basics-ga/assets/images/postman2.png)<br/><br/>
@@ -51,9 +47,8 @@ On OS X, to use Python 3.4, you may need to accept the SSL certificate before ca
5147
3. Click **Send**.
5248
4. Postman sends the request to the server and displays the response.
5349
* The **Response Code**, `200`, appears in the **Status** field.
54-
* The **JSON** response contains a **serviceTicket** attribute. You've highlighted an example service ticket value. The actual value will be different. **Copy and paste this value into a text file to use for the next steps!**<br/><br/>
55-
![](/posts/files/coding-101-rest-basics-ga/assets/images/postman3.png "Response")
50+
* The **JSON** response contains a **token** attribute. You've highlighted an example token value. The actual value will be different. **Copy and paste this value into a text file to use for the next steps!**
5651

5752
#### Congratulations! You made your first REST API call!
5853

59-
### Next Step: APIC-EM Hosts API URL
54+
### Next Step: Hosts API URL

labs/coding-101-rest-basics-ga/6.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Now, look at the Get Hosts endpoint. A host is an end device attached to the network, such as a computer connected to a wireless device. Your goal is to find the hosts and display information about them.
66

7-
To construct a request that retrieves a list of hosts, refer to the <a href="https://developer.cisco.com/site/apic-em-rest-api//" target="_blank">APIC-EM API Docs</a>. Click on Inventory under Services to find Get /host. These provide the following information:
7+
To construct a request that retrieves a list of hosts, refer to the <a href="https://developer.cisco.com/site/apic-em-rest-api//" target="_blank">DNA Center API Docs</a>. Click on Inventory under Services to find Get /host. These provide the following information:
88

99
* Method
1010
* URL
@@ -38,9 +38,9 @@ To get the entire list of hosts, your request will be like this:
3838

3939
* **Method** - `GET`
4040
* **URL** - `https://{APIC-EM-Server}/api/v1/host`
41-
* Insert the IP address or hostname of the APIC-EM controller.
41+
* Insert the IP address or hostname of the DNA Center.
4242
* **Headers**
43-
* For authentication, add the service ticket that was created earlier. On the left side of the header, add the text 'X-Auth-Token'. On the right side, add the service ticket value. See screenshot on next page for information on how to set this up in Postman.
43+
* For authentication, add the token that was created earlier. On the left side of the header, add the text 'X-Auth-Token'. On the right side, add the token value. See screenshot on next page for information on how to set this up in Postman.
4444
* When using GET, a content header is not required. However, it's a good practice to specify the content in the header anyway as 'Content-Type' 'application/json'.
4545
* **Authentication**
4646
* Handled in the header.

0 commit comments

Comments
 (0)