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

POST endpint that creates a resource and returns it in the body - for CreatedAtAction action name should contain GET action not POST Action #34361

Closed
flamaniac opened this issue Dec 13, 2024 · 3 comments
Assignees
Labels
aspnet-core/svc needs-more-info reQUEST Triggers an issue to be imported into Quest Source - Docs.ms Docs Customer feedback via GitHub Issue support-request web-api/subsvc

Comments

@flamaniac
Copy link

flamaniac commented Dec 13, 2024

Description

In the examples here:
https://learn.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-9.0#asynchronous-action-1

the first parameter of CreatedAtAction points to the same method (POST) but in description, it states that the location header will be pointing to the get method.

It is confusing.
Shouldn't this be GET like here: https://stackoverflow.com/a/64315534

Page URL

https://learn.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-9.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/web-api/action-return-types.md

Document ID

b51bc104-a6e2-b21f-8362-45cee22e8c22

Article author

@tdykstra

Related Issues

@flamaniac flamaniac changed the title POST endpint that creates a resource and returns it in the body - for CreatedAtAction action body should contain GET action or POST Action POST endpint that creates a resource and returns it in the body - for CreatedAtAction action body should contain GET action not POST Action Dec 13, 2024
@flamaniac flamaniac changed the title POST endpint that creates a resource and returns it in the body - for CreatedAtAction action body should contain GET action not POST Action POST endpint that creates a resource and returns it in the body - for CreatedAtAction action name should contain GET action not POST Action Dec 13, 2024
@tdykstra
Copy link
Contributor

Where do you see something that indicates

the first parameter of CreatedAtAction points to the same method (POST)

@flamaniac
Copy link
Author

flamaniac commented Dec 13, 2024

In the example under the link in descriprion .

return CreatedAtAction(nameof(CreateAsync_ActionResultOfT), new { id = product.Id }, product);

Should be "nameof(GetProductAsync)"

Similar to: #34081

@tdykstra
Copy link
Contributor

You are correct, thanks for reporting this. I'm fixing it in #34390 and dotnet/AspNetCore.Docs.Samples#268

@tdykstra tdykstra self-assigned this Dec 18, 2024
@tdykstra tdykstra added the reQUEST Triggers an issue to be imported into Quest label Dec 18, 2024
@dotnetrepoman dotnetrepoman bot added mapQuest clean move and removed mapQuest clean move labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspnet-core/svc needs-more-info reQUEST Triggers an issue to be imported into Quest Source - Docs.ms Docs Customer feedback via GitHub Issue support-request web-api/subsvc
Projects
Development

No branches or pull requests

2 participants