Hi,
I am new to using APIs so I am testing using the XKCD comic API so I can learn the skills I will need to use with exchange rates and more relevant data in future. I am using the Modern Form Designer on Laserfiche Cloud.
I have got data returned from the API into a field on my form, but I have hard coded the value in the URI on the Web Request Rule, I don't know how to specify a value as a parameter that I can pass in from a Laserfiche form, or how to display only a part of the content that is returned (the title).
For example, in this case I would like to be able to:
- Enter the comic id into a single line field in a Laserfiche form
- And have the "title" of the comic to be displayed in a second field (I have the Web Request lookup Rule setup and working on this field, but it currently returns all the content in JSON format)
This is my current setup:
Web Service Connection:
base URL: https://xkcd.com/
Default HTTP Request Headers: GET (but I have not added any value)
Web Request:
URI: 3/info.0.json (this gets me the comic with the comicId of 3, I would like to parametrise this)
Method: GET
No HTTP request headers have been added
I get the following response:
{"month":"1","num":3,"link":"","year":"2006","news":"","safe_title":"Island (sketch)","transcript":"[[A sketch of an Island]]\n{{Alt:Hello, island}}","alt":"Hello, island","img":"https://imgs.xkcd.com/comics/island_color.jpg","title":"Island (sketch)","day":"1"}
My first single line field would contain the value "3" for the comicId
My second single line field would return only the title "Island (sketch)"
Thank you.