This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

REST in Pawn 1.3 - HTTP client for JSON REST APIs (Updated 2021/08/22)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
BlackFart
Junior Member
Join Date: Feb 2021
Old 02-14-2021 , 15:34   Re: REST in Pawn 1.2 - HTTP client for JSON REST APIs (Updated 2021/02/07)
Reply With Quote #13

Hello,
This is the only extension I found for uploading files through http (demos recorded).
It doesn't seem like to work for me... (I found cURL, but it's not working for me either... )

Here is what I'm doing, calling CheckOldDemos() in OnMapStart()
Code:
HTTPClient httpClient;

public void CheckOldDemos()
{
    DirectoryListing  dl = OpenDirectory(newDemoPath);
    char newDemo[256];
    while(dl.GetNext(newDemo, sizeof(newDemo))) {
        if(SimpleRegexMatch(newDemo, ".*dem$") <= 0) {
            continue;
        }
        httpClient = new HTTPClient("localhost:8080/url");

        char demoPath[PLATFORM_MAX_PATH];
        BuildPath(Path_SM, demoPath, sizeof(demoPath), "data/image.jpg"); 

        httpClient.UploadFile("upload", demoPath, OnDemoUploaded); 
    }
}

void OnDemoUploaded(HTTPStatus status, any value)
{
    if (status != HTTPStatus_OK) {
        PrintToServer("Noooooooooooooo %d", status);
        return;
    }

    PrintToServer("Upload complete");
}
Nothing is printed from OnDemoUploaded(), the programm go through httpClient.UploadFile() without any error from what I can see, and I got nothing on my API

Thank for your help

EDIT: ok, after some tests, no example works... and I get no errors in the console I also tried with older version, so the issue isn't your last update 7 days ago... I really don't understand, even your example with a get doesn't work (it prints nothing)

Last edited by BlackFart; 02-14-2021 at 16:47.
BlackFart is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode