- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Enhanced Security Measures in Place: To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.
07-10-2020 06:47 AM
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"
}
07-28-2020 09:18 AM
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"
07-11-2020 06:20 AM
Just a question, where is your .txt file lcoated?
07-15-2020 10:55 AM
Are you using Linux OS? Sorry for the follow-up question. I am just studying Prisma Access
07-15-2020 02:23 PM - edited 07-15-2020 02:26 PM
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"}'
07-17-2020 06:49 AM
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
07-17-2020 08:47 AM
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"}'
07-23-2020 07:50 AM
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:
{{
07-28-2020 09:18 AM
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"
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!