Need a proper example of Lists in Custom API #3731
Replies: 3 comments 4 replies
-
Thanks for posting a discussion about homepage here on GitHub. Homepage now uses a fancy new AI tool thanks to our friends at Glime, so the answer below is the AI bot's attempt to answer your question. If you feel it's sufficient you can mark the answer and close this post, otherwise feel free to leave it open of course! Thanks for using Homepage! ❤️ To display a list of data from an API response in Homepage, you need to ensure that the widget you are using is configured to handle the data structure returned by the API. Based on the response you've provided, it seems like you want to loop over an array of objects and display certain properties like Here's a general example of how you might configure a widget to display a list of items from an API response: widget:
type: custom_service # Replace with the actual type of service widget you are using
url: http://your.api/endpoint # The endpoint that returns the JSON response
fields: ["data"] # Specify the top-level field in the JSON response that contains the array
mapping:
title: "title" # Map the 'title' property in the response to the 'title' field in the widget
url: "url" # Map the 'url' property in the response to the 'url' field in the widget
description: "description" # Map the 'description' property in the response to the 'description' field in the widget Please note that the actual configuration may vary depending on the specific widget you are using and the structure of the API response. If Homepage does not currently support looping over list elements in the way you require, this would be a feature request that you could submit to the Homepage development team through their GitHub issues page. Since you mentioned that the documentation is thin on this topic, it might be helpful to look at the source code of the widgets (as mentioned in the documentation) to understand how they process and display data. If you are not able to achieve the desired result with the existing widgets, you may need to create a custom widget or modify an existing one to handle your specific use case. If you provide the exact type of widget you are trying to configure, I can give you a more precise example. Otherwise, if Homepage does not currently support this feature, I recommend reaching out to the developers by creating an issue on the Homepage GitHub repository to request this functionality or to ask for further assistance. This comment was generated by Glime. |
Beta Was this translation helpful? Give feedback.
-
Figured it out. Hope this helps @dev-inside if you're still needing an answer My JSON
and my yaml
|
Beta Was this translation helpful? Give feedback.
-
Hi, here is the data from NetData:
here is my unfinished yaml:
|
Beta Was this translation helpful? Give feedback.
-
Description
Hey,
first of all, I am a big fan of Homepage, it is pretty great! Now to my issue (or maybe misunderstanding).
I would love to show the list of the data field from the following response:
Whatever I do, I doesn't show any result in Homepage. I tried display list, I tried to add data as a field etc. The response is a simple GET response with Queries, no Headers, no tokens - it works even in the browser.
Does HP not loop over list elements? If so, then please add that feature.
Can someone provide me with an example how to display a list similar to my example? Thank you!
homepage version
0.9.3
Installation method
Docker
Configuration
No response
Container Logs
No response
Browser Logs
No response
Troubleshooting
Tried it according to the documentation, which is unfortunately thin on this topic.
Beta Was this translation helpful? Give feedback.
All reactions