Chapter 10 API Error

The endpoint is not working
https://eonet.sci.gsfc.nasa.gov/docs/v2.1

Even though I change endpoint to
https://eonet.gsfc.nasa.gov/api/v3

I still have problem in this part

return URLSession.shared.rx.response(request: request)
        .map { (result: (response: HTTPURLResponse, data: Data)) -> T in
          let decoder = self.jsonDecoder(contentIdentifier: contentIdentifier)
          let envelope = try decoder.decode(EOEnvelope<T>.self, from: result.data)
          return envelope.content
      }

NASA seems to have changed the structure of the response JSON, probably that’s the reason they changed the version of the API endpoint. If you look into the new JSON let us know if you find what changes are necessary to code.

Maybe the original author for this chapter has more insight @fpillet

This topic was automatically closed after 166 days. New replies are no longer allowed.