p2-inc / phasetwo

Phase Two public repo for feature requests and issue tracking
0 stars 0 forks source link

Suggestion: Returning IDs of created objects within api #6

Closed paulwer closed 1 year ago

paulwer commented 1 year ago

For Example: when creating a new organization, we have to fetch organizations afterwards and look for the id, which was givven by the system. It would be better if the return type is not void and instead the id of the organization or the OrganizationRepresentation.

Please check also for other elements, if this is necessary there. Thank you.

xgp commented 1 year ago

Every method that creates an object in the API returns the ID in the Location header.

paulwer commented 1 year ago

@xgp the javascript-sdk at least will not return this in the result of the method. please add this as return-value.

Example: javascript-sdk (p2) => createOrganization :: returns Promise<void> Example: keycloak-admin-sdk => createUser :: returns Promise<{ id: string; }>

you may have to check if the other libraries already support this or if the have to be updated as well.

thank you

xgp commented 1 year ago

Every method has a *Raw version, which returns a Promise<runtime.ApiResponse<void>>, which you can use to get the response header values.

paulwer commented 1 year ago

@xgp i understand. It would be great eigher to have this available or documented.

for the "normal user" its quite unclear, why this is not returned.