Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom-api multiple API queries #385

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

ralphocdol
Copy link
Contributor

@ralphocdol ralphocdol commented Mar 2, 2025

This is mainly to query multiple endpoints at once in the same custom-api, some services with API have the data you'd need, spread across multiple endpoints. Having only one kinda limits things so here we are.

You can also query different endpoints.

Sample config

- type: custom-api
  define: <redacted>
  api-queries:
    yesterday:             # <--- This will become the object name where the api response gets stored
      url: http:${WEBSERVER_URL}/api/get-sonarr-data
      parameters:
        hour-offset: 8
        day-offset: -1
      <<: *sonarr-headers
    today:
      url: http:${WEBSERVER_URL}/api/get-sonarr-data
      parameters:
        hour-offset: 8
      <<: *sonarr-headers
    freshrss:
      url: http:${FRESHRSS_API}
      <<: 
        - *freshrss-parameters
        - *freshrss-headers
  cache: 1s
  template: |
    <div> - {{ .JSON.String "yesterday.data.0.airDate" }}</div>
    <div> - {{ .JSON.String "today.data.0.airDate" }}</div>
    <div> - {{ .JSON.String "freshrss.items.0.title" }}</div>

Output:
Screenshot_20250303_010949

@ralphocdol ralphocdol marked this pull request as ready for review March 3, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant