AnsweredAssumed Answered

"unrecognized token" errors in REST?

Question asked by cw31362 on Aug 16, 2017
Latest reply on Aug 17, 2017 by mb23565

Okay, I'm stumped here. I'm making an AJAX call to REST via the JS library on which Blackboard is built -- Prototype. I can get the token without trouble, and the GET requests work fine, but I'm getting 400 errors whenever I try to do anything else. For instance, trying to create a course based on the API's swagger document:


new Ajax.Request('/learn/api/public/v1/courses', {
    method: 'post',
    parameters: {'externalId': 'API_test', 'dataSourceId': '_2_1','courseId': 'API_test','name': 'API_test'},
    requestHeaders: {'Authorization': 'Bearer -----------------','Accept': 'application/json','Content-type': 'application/json'}


The response I get is:


    1. extraInfo:"264f5f76f8af4bb48e16ddfba72b9f77"
    2. message:"Could not read document: Unrecognized token 'externalId': was expecting ('true', 'false' or 'null')↵ at [Source: @5d6ceb52; line: 1, column: 12]; nested exception is : Unrecognized token 'externalId': was expecting ('true', 'false' or 'null')↵ at [Source: @5d6ceb52; line: 1, column: 12]"
    3. status:400


Even if I convert the parameters object to a string first, I get the same error. For kicks, I tried it with jQuery and got the same thing.


What on earth am I doing wrong? I've listed the relevant request below as well.


Request Info

Request URL:

Request Method:POST

Status Code:400


Request Headers


Accept-Encoding:gzip, deflate, br


Authorization:Bearer XXXXXXXXXXXXXXXXX

Content-type:application/json; charset=UTF-8


Request Payload