[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to make GET request and convert JSON to HTML
From: |
Nala Ginrut |
Subject: |
Re: How to make GET request and convert JSON to HTML |
Date: |
Fri, 16 Feb 2024 15:24:08 +0800 |
User-agent: |
mu4e 1.10.8; emacs 29.1 |
Hi Miller!
Sorry for late reply!
Just back from Luna's new year vacation, happy new year!
You may use the API :mime for returing XML/JSON/CSV response:
---------------------cut------------------------------------
(get "test/json"
#:mime 'json
(lambda (rc)
(:mime rc (scm->json-string '((name . "tom") (age . 20))))))
---------------------end-------------------------------------
You have to use #:mime to specify the mode, and Artanis will handle
response headers properly automatically.
Here's the document:
https://www.gnu.org/software/artanis/manual/manual.html#org4c79f58
Best regards.
Christian Miller <christian.miller@dadoes.de> writes:
> Hello,
>
> how can I make a HTTP GET request and convert the returned JSON
> response to a HTML table to render the response on a website?
> Basically, GNU Artanis calls an API endpoint like
> https://dummyjson.com/products and gets JSON as response. This should
> be converted to a HTML table to render all products from the API on
> the page.
>
> I am new to Guile Scheme and don't really understand how to do it. I
> used to use Node.js. This could also be added to the documentation.
--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058
signature.asc
Description: PGP signature