Create User API Not passing in function
See original GitHub issueProblem
When using Create User API, error received, does not appear to parse body.
Version
Version 1.22.0
Environment
Docker on Ubuntu 18.10 Host
Command;
curl -X POST "https://grocy.fish.local/api/users/create" -H "GROCY-API-KEY: SecretKey" -H "accept: application/json" -H "Content-Type: application/json" -d "{"id":5,"username":"string12","first_name":"string12","last_name":"string12","password":"string2","row_created_timestamp":"2018-12-30T21:30:39.906Z"}"
Error:
\/www\/controllers\/UsersApiController.php(35): Grocy\\Services\\UsersService->CreateUser(NULL, NULL, NULL, NULL)"
If I change the function to;
public function CreateUser(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{
$requestBody = $request->getParsedBody();
try
{
$this->UsersService->CreateUser('username','first','last','pass');
return $this->ApiResponse(array('success' => true));
}
catch (\Exception $ex)
{
return $this->VoidApiActionResponse($response, false, 400, $ex->getMessage());
}
}
It creates the user matching the test variables, however I couldn’t get it to work trying to parse $request. I tried to match from the ChoreTrackExecution with
$request->getQueryParams()['username']
But it seems the $request
variable isn’t populating correctly.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Get the current user, within an ApiController action, without ...
My scenario involved an AngularJS frontend and a Web API 2 backend application, both running under IIS. ... No need to pass any...
Read more >Pass API Gateway REST API parameters to a Lambda ... - AWS
I need my Amazon API Gateway REST API to pass query string parameters to a backend AWS Lambda function and an HTTP endpoint....
Read more >Use Web API functions (Microsoft Dataverse) - Power Apps
In this article. Passing parameters to a function; Pass record reference to a function; Bound and unbound functions; Compose a query with ...
Read more >Functions as REST API | Zoho Developer Help
You can invoke a REST API function from a widget using the ZOHO.CRM.FUNCTIONS.execute() function. Using this function, you can pass user input values...
Read more >Setup User Registration In ASP.NET Core API - YouTube
Authentication is the process of determining a user's identity. Authorization is the process of determining whether a user has access to a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So the Swagger worked when I fixed the trailing comma that you pointed out.
I also believe I fixed my issue. Powershell was not passing the body of the request as JSON and so it wasn’t getting accepted. Once I adjusted my script to convert to JSON as so;
It worked as expected.
Thank you for the responses and the great app.
Great, and thanks!
Maybe you’re the first who uses the API with gen2fish/grocy-posh, at least the first project that I saw - so hope the API covers everything needed…
If you think this is something “everyone” could need, feel free to request it to be added under the github.com/grocy organization.
Happy new year! 🎆 🥂