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

Error 400 when using grocy.add_generic service outside of card #292

Closed
kernel610 opened this issue Nov 2, 2023 · 1 comment
Closed

Error 400 when using grocy.add_generic service outside of card #292

kernel610 opened this issue Nov 2, 2023 · 1 comment

Comments

@kernel610
Copy link

I've been using Grocy for about a month with assigned reoccurring chores and marking them complete using your Grocy card filtered by each family member assigned. Everything has been working great.

I'm trying to take the next step of automatically creating chores based on other automations using the grocy.add_generic service. I continue to receive the Error 400 message when calling the service from Developer Tools and Node Red. I see a few other issues logged that mention it is related to the user_id and who created the API in Grocy. It seems the solution is to define the user_ids or map users; however it looks like that is all specific to the card. How is the user defined in the standard integration for service calls not using the card?

I am user 2 in Grocy and I believe the default user for the integration is admin (1). I also tested by creating a new API key with the admin user (user_id = 1) and setup the HA integration again using the new API key. The connection works but still fails with Error 400 in the service call.

@kernel610
Copy link
Author

I finally got this working and admit the issue was on my part. It appears the Error 400 is a generic error for most failures on the API. In my situation, I was missing required fields in the data portion of the request. My recommendation to anyone else struggling with this is to go to the API browser and try your API calls from there to make sure you have the right fields first. The API browser provides better error messages which helped me troubleshoot my problem. Once the API call is successful and data is validated, you should be able to transform this into the service call.

Also, look into the grocy.update_generic service as well. I ended up using this service instead of add_generic because I wanted to create the chore template in Grocy and then reschedule the next occurrence.

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

No branches or pull requests

1 participant