These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Is it possible to CURL API-functions on the linux command line?

Author
g0nz028
25 Steal Industries
#1 - 2017-02-17 15:24:56 UTC  |  Edited by: g0nz028
I wanted to make a simple script to show some character information.

When I:

curl -v https://api.eveonline.com/account/APIKeyInfo.xml.aspx?keyID=XXXXXXX&vCode=XXXX


I get 403 forbidden. Is it even possible with curl?

* Hostname was NOT found in DNS cache
*   Trying 87.237.34.208...
* Connected to api.eveonline.com (87.237.34.208) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*      subject: C=IS; L=Reykjavik; O=CCP Hf; CN=*.eveonline.com
*      start date: 2016-01-13 14:17:18 GMT
*      expire date: 2019-01-13 14:47:18 GMT
*      subjectAltName: api.eveonline.com matched
*      issuer: C=US; O=Entrust, Inc.; OU=See www.entrust.net/legal-terms; OU=(c) 2012 Entrust, Inc. - for authorized use only; CN=Entrust Certification Authority - L1K
*      SSL certificate verify ok.
> GET /account/APIKeyInfo.xml.aspx?keyID=XXXXXXX HTTP/1.1
> User-Agent: curl/7.38.0
> Host: api.eveonline.com
> Accept: */*
>
< HTTP/1.1 403 Forbidden
< Content-Type: application/xml; charset=utf-8
< Access-Control-Allow-Origin: *
< Date: Fri, 17 Feb 2017 15:05:50 GMT
< Connection: close
< Content-Length: 224
<

[1]+  Fertig                  curl -v https://api.eveonline.com/account/APIKeyInfo.xml.aspx?keyID=XXXXXXX


(had to remove some html code to post here)

edit: the removed html code contained an error code 203 I forgot to mention:
error code="203">Authentication failure
salacious necrosis
Garoun Investment Bank
Gallente Federation
#2 - 2017-02-17 22:39:11 UTC
If you're on *NIX, suggest you put quotes around the URL. ? and & are likely causing unintended behavior if they're unquoted. You can definitely curl the API, example:


$ curl https://api.eveonline.com/server/ServerStatus.xml.aspx
?xml version='1.0' encoding='UTF-8'?
eveapi version="2"
  currentTime 2017-02-17 22:37:14 currentTime
  result
    serverOpen True serverOpen
    onlinePlayers 34080 onlinePlayers
  result
  cachedUntil 2017-02-17 22:37:23 cachedUntil
eveapi

Use EveKit ! - Tools for EVE Online 3rd party development

g0nz028
25 Steal Industries
#3 - 2017-02-17 23:00:44 UTC
The quotes made it work. Thank you.
Tonto Auri
Vhero' Multipurpose Corp
#4 - 2017-02-19 12:54:16 UTC
"&" is a command separator in bourne shell and derivatives.
You showed verbose request log, but it seems you didn't read it yourself, else you'd have noticed that the URL in the request was not the same as the URL you provided.

Two most common elements in the universe are hydrogen and stupidity. -- Harlan Ellison