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.
 

Crest Open Contract EndPoint

Author
David Davaham
Deep Blue Logistics
#1 - 2016-09-06 02:28:39 UTC
Hello All,

I am in the process of coding a site for my corporation. One of the tools on the site will allow the user to open a specific contract in game. The user validates with SSO and all and I have the right scopes set. My problem is an error message I get from CREST when posting the request


array(3) {
  ["message"]=>
  string(31) "No JSON object could be decoded"
  ["key"]=>
  string(7) "badJson"
  ["exceptionType"]=>
  string(15) "BadRequestError"
}



I have two methods i am making the request with. One method formats the request correctly and sends it off to another method that actually makes a cURL request to CREST.

At first I did realize that the ID in the array was a string. Even after casting into to an integer, I still didn't get anywhere.

Due to character limitations of the forums, I have pasted my code on PasteBin and linked it here.
Please review and let me know what you think.

echo of $jsonPost

{"contractID":108373017}



openContract - The Formatter

makeCall - The Caller


Developer of EVEmail

David Davaham
Deep Blue Logistics
#2 - 2016-09-06 02:35:05 UTC
No sooner did I make this post, that I started getting some where.

New Error message


array(3) {
  ["message"]=>
  string(32) "Authentication needed, bad token"
  ["key"]=>
  string(10) "authNeeded"
  ["exceptionType"]=>
  string(17) "UnauthorizedError"
}



I have now updated the openContract pastebin with the corrected code and added an Auth header to the call

Developer of EVEmail

Blacksmoke16
Imperial Academy
#3 - 2016-09-06 03:46:39 UTC  |  Edited by: Blacksmoke16
If you are getting your token from a refresh token, try clearing and getting a new refresh token. Then try again with a new generated token.

EDIT: Your giving the wrong bearer token. Should be giving the actual token from the sso login, not the base encoded clientID/secret key.

"Authorization: Bearer ". base64_encode($this->config->get('crest.client_id').':'.$this->config->get('crest.secret')),

Should be like:

"Authorization: Bearer ". USERS_TOKEN,
David Davaham
Deep Blue Logistics
#4 - 2016-09-06 05:53:35 UTC
Blacksmoke16 wrote:
If you are getting your token from a refresh token, try clearing and getting a new refresh token. Then try again with a new generated token.

EDIT: Your giving the wrong bearer token. Should be giving the actual token from the sso login, not the base encoded clientID/secret key.

"Authorization: Bearer ". base64_encode($this->config->get('crest.client_id').':'.$this->config->get('crest.secret')),

Should be like:

"Authorization: Bearer ". USERS_TOKEN,



Thank You very kindly sir. I was in fact using the wrong token. With you suggestion, the script is now working and opening the window in the client. You are awesome.

Thanks o7

Developer of EVEmail

Messenger Of Truth
Butlerian Crusade
#5 - 2016-09-09 15:17:09 UTC
I wish there was an endpoint like this that would let you open a particular BPO/BPC in the industry window

Trade Hub Price Checker: stop.hammerti.me.uk/pricecheck

Visit "Haulers Channel" in game for all matters courier-related.

Structure name/system API: stop.hammerti.me.uk/api