M.O.S. Studios Posted February 4 Share Posted February 4 (edited) Hey everyone, I’m trying to write an api call to the Trexity API. They have some documentation here. I’ve used apis before, and it’s never been an issue. However I have been trying to get a curl command to connect and I can not. I have an API token, tried using the ‘Bearer’ authentication and I either get a 500 error, or it sends back a response; but it’s just the html source of the page that is sending it. normally I’d attach source code, but I rage deleted it a few days ago. I was hoping someone could maybe take a look at the documentation and let me know if they notice anything unusual… only thing I see is it uses openAPI; and I don’t know what that is I will be making the code again. If I have the same issue, I’ll post the code here thanks everyone Edited February 4 by M.O.S. Studios Quote Link to comment Share on other sites More sharing options...
requinix Posted February 4 Share Posted February 4 Looks normal... 1 hour ago, M.O.S. Studios said: I have an API token, tried using the ‘Bearer’ authentication You do Bearer authentication by just including an Authorization header in the request. Like if it was any other header. 1 hour ago, M.O.S. Studios said: and I either get a 500 error, or it sends back a response; but it’s just the html source of the page that is sending it. Was the 500 coming from your own site or from theirs? Presumably yours. A 500 means an error, so if you get that then check the server logs to find out what the error is so you can fix it. If the "HTML source" is of a page on their site then that likely means you were sending an incorrect request and/or to the wrong URL. Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted February 4 Author Share Posted February 4 excellent! ill try it all again, and look at the files. The html source was of the page sending the request on my end! I had the response sent to the console.log() function so I can more closely examine it. I was getting source code for the html page I wrote to send it Quote Link to comment Share on other sites More sharing options...
requinix Posted February 4 Share Posted February 4 6 hours ago, M.O.S. Studios said: I had the response sent to the console.log() function so I can more closely examine it. I was getting source code for the html page I wrote to send it Then either you didn't have PHP set up at all, and what you were seeing was the unexecuted source, or (I assume) you have some kind of logic like "if (form submitted) { do thing } else { show page }" and you weren't triggering the "form submitted" logic (thus it was returning the regular page instead). Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted February 20 Author Share Posted February 20 I ended up starting over and it worked :/. Don’t know what I did differently Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.