Got it

RestFull API using USG6510E Firewall

Created: Jan 3, 2020 11:56:08Latest reply: Jan 6, 2020 00:39:01 845 13 0 0 0
  Rewarded HiCoins: 2 (problem resolved)

I enabled API following this guide in order to enable API https://support.huawei.com/enterprise/en/doc/EDOC1000179526    at chapter 6.1 Constructing a Development Environment. , I can not understand how to send get or post URL, I have USG and I can access its web portal by writing this URL in a browser
https://10.10.0.254:10443.
I enabled https API on port 9000
so if I want to send get Request I am using this address
https://10.10.0.254:9000/restconf/data/huawei-smart-link:smart-link/smart-link-profile
but nothings coming and gave me 404 error
so please tell me how can I do that

this is how I send request using postman but I get nothings 


Postman


Featured Answers

Recommended answer

chenhui
Admin Created Jan 3, 2020 13:00:05

@user_3683044 hello,
The URI format in the URL is not correct.
The URI format should be as /<resource>[?filter]
it's recommended you to check the chapter 4.1
View more
  • x
  • convention:

Muhanned
Muhanned Created Jan 3, 2020 13:11:42 (0) (0)
thanks for your reply, please sir can you give me example ? so the url will be https://10.10.0.254:9000/resources ? is that true ?  
Muhanned
Muhanned Reply Muhanned  Created Jan 3, 2020 13:12:14 (0) (0)
please sir can you give me full url that I need to apply in order to get cpu information ?  
Muhanned
Muhanned Created Jan 3, 2020 14:00:05 (0) (0)
Please help me  
All Answers

Hi,


USG6000 Series & NGFW Module API can use HTTP GET method to obtain resource data on the API server. The URL field in the GET packet includes the path to the expected information and filter parameters. Filter parameters are optional. If no filter parameter is specified, all information is obtained. If the values of filter parameters contain ampersand mark, you shouuld use backslash character and ampersand mark(the format is \&) instead. Filter parameters vary with resources. For more information, see 4 Application of API.



General Parameters of GET Requests

The GET method supports three general parameters: vsys, pagesize, and pageindex, which are described as follows:

l   Vsys specifies the virtual system where the data to be obtained resides.

l   Pagesize specifies the maximum number of data records in a reply. The GET request of the USG6000 Series & NGFW Module API return data in pages. The maximum number of data records in a returned message is the maximum number of data records in a page. The maximum and default value is 100.

l   Pageindx specifies the starting page number, which defaults to 1. If the total number of matched data records is 350, pagesize is 100, and pageindex is 2, the API server return the records No. 101 through No. 200 to the client. If the set pageindex and pagesize values exceed the total number of records allowed on the API server, the API server returns only the records on the last page to the client.



GET Request Example

The GET method does not carry data, which means that the Content-Length field in the header must be 0. Otherwise, the API server returns the 400 Bad Request error message.

The format of the GET request is as follows:

GET /system/information/ HTTP/1.1\r\n 

 Content-Type: application/x-www-form-urlencoded\r\n 

 Host: 192.168.101.10\r\n 

 Connection: Keep-Alive\r\n 

 Content-Length: 0\r\n 

 Cache-Control: no-cache,no-store\r\n 

 Cookie: SESSIONID=AQAAAIeDSFfJlKYa503duQ==&API\r\n 

 Token: a0jSVFvDAVkFMODatcwwNQ==\r\n 

 SN: 1\r\n 

 \r\n

The reply to data requests resembles:

HTTP/1.1 200 OK\r\n 

 Date: WED, 4 Feb 2015 16:27:23\r\n 

 Cache-Control: no-cache,no-store\r\n 

 Connection: Keep-Alive\r\n 

 Content-Length: 218\r\n 

 Content-Type: text/plain; charset=utf8\r\n 

 Cookie: SESSIONID=AQAAAIeDSFfJlKYa503duQ==&API\r\n 

 Token: a0jSVFvDAVkFMODatcwwNQ==\r\n 

 SN: 1\r\n 

 API-Version: 1.0\r\n 

 \r\n 

 <systeminfo><system-version>VRP (R) software, Version 5.30</system-version><clock><date-and-time>2015-02-04 08:27</date-and-time><time-zone>UTC add 00:00:00</time-zone></clock><sysname>USG6300</sysname></systeminfo>


View more
  • x
  • convention:

Muhanned
Muhanned Created Jan 3, 2020 12:39:45 (0) (0)
thank you for your reply, could you please give me full example how to do GET or post a request , which port, how, how can I make authentication for API user, I read a lot of documents explain like what you wrote but I still can not send request, please help me  
my problem is with this one GET /system/information what supposed url to be , and what is supposed port
View more
  • x
  • convention:

@user_3683044 hello,
The URI format in the URL is not correct.
The URI format should be as /<resource>[?filter]
it's recommended you to check the chapter 4.1
View more
  • x
  • convention:

Muhanned
Muhanned Created Jan 3, 2020 13:11:42 (0) (0)
thanks for your reply, please sir can you give me example ? so the url will be https://10.10.0.254:9000/resources ? is that true ?  
Muhanned
Muhanned Reply Muhanned  Created Jan 3, 2020 13:12:14 (0) (0)
please sir can you give me full url that I need to apply in order to get cpu information ?  
Muhanned
Muhanned Created Jan 3, 2020 14:00:05 (0) (0)
Please help me  

@user_3683044  

I think the URL should be like https://10.10.0.254:9000/policy/security-policy    //get the security-policy 


View more
  • x
  • convention:

Muhanned
Muhanned Created Jan 4, 2020 08:59:45 (0) (0)
thankyou for your reply , but I get nothings by this url , even when I am trying to autheticate using this url I get nothings
https://10.10.0.254:9000/username=api&password=apipass I get no reply 404 error  
@user_3683044
to get the different resource, the URI would be different.
View more
  • x
  • convention:

Hello dear
I think you should specify the security policy folder and the used port in the URL :
https://10.10.0.254:9000/policy/security-policy
good luck
View more
  • x
  • convention:

Muhanned
Muhanned Created Jan 4, 2020 09:00:01 (0) (0)
thankyou for your reply , but I get nothings by this url , even when I am trying to autheticate using this url I get nothings
https://10.10.0.254:9000/username=api&password=apipass I get no reply 404 error  
@user_3683044 hello,
the URL https://10.10.0.254:9000/policy/security-policy is used to get the security-policy in the path /policy. You should change the URI to the path which stores the resource you want to get.
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.