AnsweredAssumed Answered

Unexpected 504 Gateway

Question asked by rodriguezr2 on Jul 13, 2017
Latest reply on Jul 20, 2017 by rodriguezr2

Hello Everyone,

 

I've been working on creating a PHP script that is able to pull grades from blackboard and for the most part it works for most courses but every now and then an HTTP request would return the following error message:

 

Unexpected HTTP status: 504 GATEWAY_TIMEOUT

 

When i run the same command as a curl request there is no problem or error message so i don't understand why it's happening.

 

How can i get this to work correctly on PHP

 

php:

 

$request = new HTTP_Request2($HOSTNAME . "/learn/api/public/v1/courses/" . $courseId . "/gradebook/columns/" . $columnId . "/attempts", HTTP_Request2::METHOD_GET);

$request->setHeader('Authorization', 'Bearer ' . $token["access_token"]);

try {

    $response = $request->send();

    if (200 == $response->getStatus()) {

      print "\n Got Grades...\n";

      $grades = json_decode($response->getBody(), true);

    } else {

      print 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .

          $response->getReasonPhrase();

      $BbRestException = json_decode($response->getBody(), true);

      var_dump($BbRestException);

    }

  } catch (HTTP_Request2_Exception $e) {

    print 'Error: ' . $e->getMessage();

  }

 

shell script

 

curl -k -X GET -H "Authorization: Bearer $token" $server/learn/api/public/v1/courses/$courseId/gradebook/columns/$columnId/attempts

Outcomes