Requests to the External API (api/event or api/series) return error HTTP 500 if accept header is not included in the request

Steps to reproduce

The documentation should be updated so that it mentions that accept header is required for the request to return a valid response.

Or Change the code so that it responds with valid response and includes a warning about no version defined.

CURL:

  1. default digest test
    curl -f -w "
    n" --digest -u userass -H "X-Requested-Auth: Digest" -X GET "https://httpbin.org/digest-auth/auth/user/pass"

  1. Opencast connect
    OC_URL='https://[server]/api/series/[id]'
    OC_DIGEST_USER='opencast_system_account'
    OC_DIGEST_PASSWORD='CHANGE_ME'

curl -f -w "
n" --digest -u $OC_DIGEST_USER:$OC_DIGEST_PASSWORD -H "X-Requested-Auth: Digest" -X GET "$OC_URL"

PYTHON:
import requests
from requests.auth import HTTPDigestAuth

  1. default digest test
    s = requests.Session()
    s.auth = HTTPDigestAuth('user', 'pass')
    s.headers.update({'X-Requested-Auth': 'Digest'})

r = s.get('https://httpbin.org/digest-auth/auth/user/pass')
print r
print r.content

  1. Opencast connect
    s = requests.Session()
    s.auth = HTTPDigestAuth('opencast_system_account', 'CHANGE_ME')
    s.headers.update({'X-Requested-Auth': 'Digest'})

r = s.get('https://[server]/api/series/[id]')
print r
print r.content

PERL:
use LWP;
use WWW::Mechanize;
use HTTP::CookieJar::LWP ();

my $url = "https://[server]/api/series/[id]";

my $jar = HTTP::CookieJar::LWP->new; # BEST PRACTICE
my $mech = WWW::Mechanize->new( autocheck => 0, cookie_jar => $jar);
$mech->credentials($oc_user, $oc_pass);
$mech->add_header( 'X-REQUESTED-AUTH' => 'Digest' );
$mech->add_header( 'Accept' => 'text/plain, /, application/v1.1.0+json' );

$mech->get($url);

print $mech->content();

Status

Assignee

Unassigned

Reporter

Corné Oosthuizen

Severity

Incorrect Documentation

Tags (folksonomy)

None

Components

Affects versions

Priority

Minor
Configure