Can't get data from API

perryd
Contributor

Hi All,

Can anyone help with an API issue?

So i run curl -verbose -sku USERNAME:PASSWORD -H "accept: text/xml" https://my.jamfcloud.com:443/##/JSSResource/users -o ~/Desktop/test2.txt

but the text file is empty. Even without the text file I get no results from any of the API.

I get the following output.

Enter host password for user 'perry.driscoll':
Trying XX.XX.XX.XX...
TCP_NODELAY set
Connected to my.jamfcloud.com (XX.XX.XX.XX) port 443 (#0)
ALPN, offering h2
ALPN, offering http/1.1
Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
successfully set certificate verify locations:
CAfile: /etc/ssl/cert.pem CApath: none
TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [228 bytes data]
TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [89 bytes data]
TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4825 bytes data]
TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
ALPN, server did not agree to a protocol
Server certificate:
subject: CN=.jamfcloud.com
start date: Oct 16 00:00:00 2018 GMT
expire date: Nov 16 12:00:00 2019 GMT
issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
SSL certificate verify ok.
Server auth using Basic with user 'USERNAME'
> GET / HTTP/1.1
> Host: my.jamfcloud.com
> Authorization: Basic cGVycnkuZHJpc2NvbGw6RHlycmVwMTk4NCE=
> User-Agent: curl/7.54.0
> Referer: rbose
> accept: text/xml
> < HTTP/1.1 302 < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0
< Date: Fri, 27 Sep 2019 14:36:53 GMT
< Location: https://my.jamfcloud.com/saml/login
< Server: Jamf Cloud Node
< Set-Cookie: JSESSIONID=010ABE76C27559B9A5572B96E59C60E8; Path=/; Secure; HttpOnly
< Set-Cookie: APBALANCEID=aws.euc1-std-trail1-tc-3; path=/;HttpOnly;Secure;
< X-FRAME-OPTIONS: SAMEORIGIN
< Content-Length: 0
< Connection: keep-alive
< * Connection #0 to host asoseval.jamfcloud.com left intact

Has anyone else run into these issues?

3 REPLIES 3

mm2270
Legendary Contributor III

What is the ## doing in your URL path? I don't think that's needed. Was it supposed to be a placeholder for something else? Because with those # signs in the path, it's not the correct URL for getting the /users resource. That might be the trouble, unless that was added in by mistake when you posted.

Tribruin
Valued Contributor II

It looks like you are copying the sample command from the Jamf 300 class. You need to remove the /## from your URL. Also, if you are using JamfCloud, you do not need the :443. Try this command:

curl -verbose -sku USERNAME:PASSWORD -H "accept: text/xml" https://my.jamfcloud.com/JSSResource/users -o ~/Desktop/test2.txt

perryd
Contributor

Thanks for your replies that was the exact issue! I was refreshing myself from the 300 course and left in the ## by mistake