Jump to content

REST API Error response


CSI

Recommended Posts

Hello,

I'm trying to use the REST API, but get the "3S290/3: INVALID_APP" error* when I try to do any request to any endpoint. Last week, however, I was able to upload a file without an issue and do a GET request to the core/hello example. Within that timeframe the only thing that I know changed is an upgrade to 4.1.14.3 from a slightly earlier version (just installed IPS about 2 months ago). Unless it was by accident, the test script I used did not change, and I cannot find anything wrong with it. 

The error's specific description is: "The endpoint the request was sent to does not exist (the first level contains an invalid character, only alphanumerics are acceptable)."

I'm not sure what "the first level" is referring to but I assume it's what comes after /testdownload or /api .

Here's the script that I've been using:

<?php
$communityUrl = 'https://example.com/testdownload/';

$apiKey = 'xxxxxxxxxxxxxxxxxx';

$postdata = array();
$postdata["author"] = 1;
$postdata["category"] = 1;
$postdata["title"] = "success.txt";
$postdata["description"] = "File to test that my script is working";
$postdata["files"] = array();
$postdata["files"]["fake.txt"] = file_get_contents(__DIR__.'/fake.txt');
$postdata = urldecode(http_build_query($postdata));

$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPAUTH       => CURLAUTH_BASIC,
CURLOPT_USERPWD        => "{$apiKey}",
CURLOPT_URL            => $communityUrl . 'api/downloads/files',
CURLOPT_POST           => true,
CURLOPT_POSTFIELDS => $postdata
    ) );
    $response = curl_exec( $curl );

    echo $response;

 

The only other potential piece of information is that base API url: example.com/testdownload/api returns a JSON 2S290/6 "NO_API_KEY" response, as expected, while any other endpoints like testdownload/api/core/hello or testdownload/api/downloads/files resolve to a 500 server error that appears to be from IPS. This might be the expected behavior though.

*3S290/3 : INVALID_APP : The endpoint the request was sent to does not exist (the first level contains an invalid character, only alphanumerics are acceptable).

Thank you, in advance, for any assistance

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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