(require-extension http-client medea uri-common) ;; Will get put in the user-agent header if non-#f... (client-software '(("scheme-swapi" #f #f))) ;; Get all planets (define (planets) (with-input-from-request "http://swapi.co/api/planets/" #f read-json)) ;; Succeeds in getting data on tatooine (define (tatooine) (with-input-from-request "http://swapi.co/api/planets/1" #f read-json)) ;; (planet "1") -> Error: (string->list) bad argument type - not a string: x (define (planet x) (let* ((planeturi (update-uri (uri-reference "http://swapi.co/api/") path: '("planets" x))) (req (make-request method: 'Get uri: planeturi))) (with-input-from-request req #f read-json)))