|
New Member
|
02-12-2021
, 07:50
Re: [EXTENSION] System2 - Easy to use HTTP(S)/FTP Request API and useful system nativ
|
#3
|
Hello.
First of all nice project! I was hoping u could help me out with a problem i am facing.
I am having difficulties making a http request, with a api key in the header.
What i tried so far:
public int GetPlayerId() {
System2HTTPRequest httpRequest = new System2HTTPRequest(HttpResponseCallback, "url");
httpRequest.SetHeader("Content-Type", "application/json");
httpRequest.SetHeader("X-API-Key", "1234");
}
public void HttpResponseCallback(bool success, const char[] error, System2HTTPRequest request, System2HTTPResponse response, HTTPRequestMethod method) {
if (success) {
char[] content = new char[response.ContentLength + 1];
response.GetContent(content, response.ContentLength + 1);
PrintToServer("Content of the response: %s", content);
}
}
The response gives authentication failed. Could u maybe give an example how to do it?
|
|
|
|