"Recent Builds For A Single Project" returns EDN instead of JSON?

I’m trying to receive project build summaries using an AWS Lambda. This is (part) of the code

return new Promise(function(resolve, reject) {
    const options = {
      host: "circleci.com",
      port: 443,
      path: "/api/v1.1/project/github/:org/:repo?circle-token=:token&limit=1&shallow=true",
    };

    var req = https.get(options, function(res) {
      let body = ''; 
      res.on('data', chunk => {
        body += chunk;
      });
      res.on('end', () => {
        console.log(body); 
        resolve(body) 
      });
    });

    req.write("");
    req.end();
  });

Instead of JSON, I am getting what seems to be an EDN (extensible data notation) back?

2019-06-04T00:13:44.963Z	afde0ae2-b2f3-48cd-b5bd-9bc0d95a647b	INFO	({:committer_name nil, :why "github", ... , :usage-queued-at #joda/inst "2019-06-03T21:10:17.636Z"})

#joda/inst seems telling that there is a java/clojure process running.

The funny thing is that

curl -X GET "https://circleci.com/api/v1.1/project/github/:org/:repo?circle-token=:token&limit=1&shallow=true"

returns JSON as expected.

Am I (mis-)using AWS or JavaScript? Is there any conversion happening? Or is CircleCI really returning EDN data?

1 Like

Hi Oliver. I think you do get EDN data back in some cases if you don’t set the content type to application/json.