Hämta data från SR API

220 views
Skip to first unread message

ShaN Official

unread,
Oct 28, 2019, 8:03:41 AM10/28/19
to Sveriges Radio API forum
Hej ! 

Vi jobbar i React Native och använder mig av fetch för att försöka hämta data från SR.

Detta är responsen jag får eftersom jag inte har satt upp CORS på klientsidan.

Response {

  "_bodyBlob": Blob {

    "_data": Object {

      "blobId": "9ECD75E2-2551-4895-83C4-F48294FF1B0B",

      "name": "4126279.xml",

      "offset": 0,

      "size": 686,

      "type": "text/xml",

    },

  },

  "_bodyInit": Blob {

    "_data": Object {

      "blobId": "9ECD75E2-2551-4895-83C4-F48294FF1B0B",

      "name": "4126279.xml",

      "offset": 0,

      "size": 686,

      "type": "text/xml",

    },

  },

  "headers": Headers {

    "map": Object {

      "accept-ranges": "bytes",

      "access-control-allow-origin": "*",

      "age": "0",

      "cache-control": "public, max-age=600",

      "connection": "keep-alive",

      "content-encoding": "gzip",

      "content-type": "text/xml; charset=utf-8",

      "date": "Mon, 28 Oct 2019 11:28:11 GMT",

      "expires": "Mon, 28 Oct 2019 11:38:12 GMT",

      "last-modified": "Mon, 28 Oct 2019 11:28:12 GMT",

      "transfer-encoding": "Identity",

      "vary": "x-forwarded-port, Accept-Encoding",

    },

  },

  "ok": true,

  "status": 200,

  "statusText": undefined,

  "type": "default",

  "url": "http://api.sr.se/api/v2/podfiles/4126279",

}


Jag antar att detta har och göra med att jag inte satt upp CORS på client sidan vilket måste göras på servern. Men jag vill endast testa och se om jag kan få fram titel, bild och url till nyheter. Går det att göra ? 

Reply all
Reply to author
Forward
0 new messages