Skip to content

Suggested improvement to rest_command documentation #37655

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

Closed
scooby52 opened this issue Feb 24, 2025 · 2 comments
Closed

Suggested improvement to rest_command documentation #37655

scooby52 opened this issue Feb 24, 2025 · 2 comments
Assignees
Labels
integration: rest_command Stale The PR had no activity for quite some time, and is marked as Stale

Comments

@scooby52
Copy link

Feedback

Hi there, I've been struggling to get rest_command to work when using x-api-key in a POST operation. After many hours of searching and trying many different combinations, I finally found a solution, and would like to suggest an additional example for the documentation that might help others avoid the frustration I went through !
I found the only way to get x-api-key to work was to store it in the secrets file. Once I did this the API call worked. My code looks like this:

  powervault_set_override_status:
    url: "https://api.p3.powervault.co.uk/v3/unit/<unitID>/stateOverride"
    method: post
    headers:
      x-api-key: !secret powervault #name of the entry in the secrets.yaml file
      accept: "application/json"
      user-agent: 'Mozilla/5.0'
    content_type:  'application/json; charset=utf-8'
    payload: 
      '{"stateOverrides": [  {"start": "{{ start_time }}",
      "end": "{{ end_time }}",
      "state": "{{ new_state }}" } ] }'

It was also frustrating that I couldn't see what data was actually being sent to the API endpoint, even when I enabled debug logging it never showed the full request, specifically the headers. As I had to pass x-api-key in the header, I was unable to see if it was being formatted correctly. The API provider documented how it should appear, inlcuding examples using curl, but without being able to see what was being sent, I was guessing as to which part was wrong. I have seen posts from other people struggling with the same challenge. Apologies if this should be raised as a separate issue?

URL

https://www.home-assistant.io/integrations/rest_command/

Version

2025.2.5

Additional information

No response

@home-assistant
Copy link

Hey there @jpbede, mind taking a look at this feedback as it has been labeled with an integration (rest_command) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of rest_command can trigger bot actions by commenting:

  • @home-assistant close Closes the feedback.
  • @home-assistant rename Awesome new title Renames the feedback.
  • @home-assistant reopen Reopen the feedback.
  • @home-assistant unassign rest_command Removes the current integration label and assignees on the feedback, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information) to the feedback.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information) on the feedback.

Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved.
If this issue is still relevant, please let us know by leaving a comment 👍
This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale The PR had no activity for quite some time, and is marked as Stale label Apr 25, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration: rest_command Stale The PR had no activity for quite some time, and is marked as Stale
Projects
None yet
Development

No branches or pull requests

2 participants