Enhanced Security Measures in Place:   To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.

Prisma Access Retrieve IP Addresses API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Prisma Access Retrieve IP Addresses API

Hi,

I am trying to run the API script in python to retrieve the gateway addresses, but I am unable to get it to work. Any help would be appreciated. The command I used was:

curl -X POST --data @prismaapi.txt -k -H header-api-key:(key redacted) "https://api.gpcloudservice.com/getPrismaAccessIP/v2"

 

I  get the error, File "<stdin>", line 1 and then SyntaxError: invalid syntax at the POST word. My text file contains:

{
"serviceType": "gp_gateway",
"addrType": "all",
"location": "all"
}

 

1 accepted solution

Accepted Solutions

I used the following curl script in a Linux environment to get it to work.

 

curl -X POST -d '{ "serviceType": "all", "addrType": "all", "location": "all" }' -k -H "header-api-key:Insertkeyhere" "https://api.gpcloudservice.com/getPrismaAccessIP/v2"

View solution in original post

8 REPLIES 8

L2 Linker

Just a question, where is your .txt file lcoated?

On my desktop.

Are you using Linux OS? Sorry for the follow-up question. I am just studying Prisma Access

L3 Networker

When testing APIs I always prefer using inline data over working with files.  Give this a try:

 

curl -k -X POST 'https://api.gpcloudservice.com/getPrismaAccessIP/v2' \
--header 'header-api-key: {{ my_key }}' \
--data-raw '{"serviceType": "gp_gateway","addrType": "all","location": "all"}'

 

I tried that command and received the following output.

curl -k -X POST 'https://api.gpcloudservice.com/getPrismaAccessIP/v2' \ --header 'header-api-key: {{key redacted}}' \ --data-raw '{"serviceType": "gp_gateway","addrType": "all","location": "all"}'
curl: (1) Protocol "'https" not supported or disabled in libcurl
curl: (6) Could not resolve host: \
curl: (3) [globbing] nested brace in column 2
curl: (6) Could not resolve host: \
curl: (6) Could not resolve host: gp_gateway,addrType
curl: (6) Could not resolve host: all,location
curl: (3) [globbing] unmatched close brace/bracket in column 4

I think there are possibly two issues at hand.

 

1.  You may need to update your curl package.  This is what I'm running and it has no problem with https.

 

$ curl --version
curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets

 

2.  The backslash characters in the example were used to split a long command like this over newlines.  If you want to run it all on a single line you'll need to omit the backslashes.

 

$ curl -k -X POST 'https://api.gpcloudservice.com/getPrismaAccessIP/v2' --header 'header-api-key: {{ key redacted }}' --data-raw '{"serviceType": "gp_gateway","addrType": "all","location": "all"}'

 

I downloaded a curl package and ran the command again, but it did not work. I receive the following messages now:

curl: (6) Could not resolve host: 'https
curl: (3) nested brace in URL position 2:
{{

I used the following curl script in a Linux environment to get it to work.

 

curl -X POST -d '{ "serviceType": "all", "addrType": "all", "location": "all" }' -k -H "header-api-key:Insertkeyhere" "https://api.gpcloudservice.com/getPrismaAccessIP/v2"

  • 1 accepted solution
  • 8623 Views
  • 8 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!