You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are on a DevNet Zone station, <ahref="https://www.getpostman.com"target="_blank">Postman</a> is already installed. You can start it from the Google App Launcher or Chrome by clicking <ahref="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.
15
15
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
18
18
***username:** devnetuser
19
19
***password:** Cisco123!
20
20
21
-
## Step 1. Find the APIC-EM API Resources and Documentation
21
+
## Step 1. Find the DNA Center API Resources and Documentation
22
22
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.
24
24
25
-
1. In a browser, navigate to the <ahref="https://developer.cisco.com"target="_blank">DevNet</a> home page.
26
-
2. Click the **Login** link located at the top right of the webpage.
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 .
32
27
* Click the **Technologies** link to see the submenu.
33
28
* 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)**.
@@ -10,24 +10,23 @@ There are two major types of web services – **REST** and **SOAP**.
10
10
REST is an architecture style for designing networked applications.
11
11
A REST web service is as easy to call as making an HTTP request.
12
12
RESTful interfaces usually offer the CRUD (Create, Read, Update, Delete) operations.
13
-
To know more about REST in general, this is a great <ahref="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).
For this lab, you are going to use the <ahref="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/).
25
24
26
-
The Application Policy Infrastructure Control (APIC) Enterprise Module (EM), Application Programming Interface (API), <ahref="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.
27
26
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.
29
28
30
-
Look at the <ahref="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.
31
30
32
31
33
32
### How does this work?
@@ -38,8 +37,8 @@ REST is centered around the HTTP request and response model. Consuming an API is
38
37
39
38
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.
40
39
41
-
(<ahref="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.
42
41
43
-
(<ahref="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.
Copy file name to clipboardExpand all lines: labs/coding-101-rest-basics-ga/3.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff 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?
2
2
3
3
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.
4
4
@@ -11,9 +11,9 @@ Choose one of the following http methods:
11
11
12
12
-**URL**
13
13
* Determine the URL of the endpoint you want to call.
* 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.
* 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.
17
17
-**URL Parameters**
18
18
* 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.
19
19
-**Authentication**
@@ -34,7 +34,7 @@ REST APIs have three common methods to authenticate users:
34
34
***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.
35
35
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.
36
36
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.
38
38
39
39
The steps for using the APIC-EM authentication token are:
Get the description of the ticket API call from the -- <ahref="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 -- <ahref="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.
24
24
25
25
`POST /api/v1/ticket`: This method creates a new user ticket
26
26
27
27
28
-
The HTTP call to a create a service ticket is easy.
28
+
The HTTP call to a create a token is easy.
29
29
```http
30
30
31
31
https://{APIC-EM-Server}/api/v1/ticket
32
32
33
33
```
34
34
35
-
To get the service ticket your request will look like this:
35
+
To get the token your request will look like this:
* 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/`.
40
40
***Headers**
41
41
* Specify the 'Content-Type' as 'application/json'. It's typical to include this header with all HTTP methods (GET, POST, PUT, DELETE) calls.
42
42
***Authentication**
43
43
* In this API call, the authentication data is passed in the body.
44
44
***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.
Many IDEs have also consoles for testing REST Services built in
10
+
Many IDEs have also consoles for testing REST Services built in.
11
11
12
12
In this lab, you use Postman as an example of a REST client.
13
13
@@ -16,21 +16,18 @@ On OS X, to use Python 3.4, you may need to accept the SSL certificate before ca
16
16
17
17
1. Open Chrome.
18
18
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).
20
20
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/>
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.
23
22
24
-
4. Click the **Proceed to <your IP>** link<br/><br/>
* 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 <ahref="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.
34
31
35
32
2. For your request to retrieve the list of hosts into the appropriate Postman fields, enter the following information:
36
33
@@ -39,10 +36,9 @@ On OS X, to use Python 3.4, you may need to accept the SSL certificate before ca
39
36
* **Method**
40
37
* ``A.`` Select **POST**.
41
38
* **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.
44
40
* **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.
46
42
* **Headers**
47
43
* ``A.`` In the header, enter: `Content-Type` followed by `application/json`.<br/><br/>
@@ -51,9 +47,8 @@ On OS X, to use Python 3.4, you may need to accept the SSL certificate before ca
51
47
3. Click **Send**.
52
48
4. Postman sends the request to the server and displays the response.
53
49
* 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/>
* 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!**
56
51
57
52
#### Congratulations! You made your first REST API call!
Copy file name to clipboardExpand all lines: labs/coding-101-rest-basics-ga/6.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
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.
6
6
7
-
To construct a request that retrieves a list of hosts, refer to the <ahref="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 <ahref="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:
8
8
9
9
* Method
10
10
* URL
@@ -38,9 +38,9 @@ To get the entire list of hosts, your request will be like this:
38
38
39
39
***Method** - `GET`
40
40
***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.
42
42
***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.
44
44
* 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'.
0 commit comments