Jump to content

Trying to upload a file via the web API


Go to solution Solved by Interferon,

Recommended Posts

Posted (edited)

I am trying to use the REST API to automatically upload a file to the Invision downloads system:

if (!InvisionPower::Initialize(communityurl, clientid))
{
    Notify("CURL failed to initialze.", "Error", true);
}

std::string token = InvisionPower::AuthenticateUser(name, password, "/downloads/files");
std::string options;
options += "category=97&description=MyDescription&title=FileName&author=1&";
options += "files=file=file.zip&contents=MDAwMDAw";
auto j3 = InvisionPower::APICall("/downloads/files/", token, options);
    
if (j3["response"].is_object())
{
    std::string response = j3["response"];
}

I have enabled the needed endpoint in our admin panel:

Could contain: Text

I keep getting an error that says NO_PERMISSION when I run the code.

Any idea what's wrong?

Edited by Interferon
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...