Which http request should I use for a component?

Hello,

For binding a client-side component, for example, a react image editor or a grid,
Which HTTP request should I use? Post, Get, Put, Delete?

thanks,
Saeed

I don’t understand the question. What do you mean by “binding a client-side component”?

Each HTTP verb (Methods) is used for different things, you used each one as/when appropriate.

Hi are you able to share a code snippet to communicate what you’re asking?

Not sure I understand the question.

An editor component is very likely to use both GET and POST: GET to retrieve the current state of whatever you’re editing, and POST to update it. The use case for DELETE should be obvious.

PATCH and PUT are also used to update existing resources, with the implication that PUT replaces it whereas PATCH just updates it. AFAIK the cache behaviors of those are the same as POST, so it’s really a wash which you use.

I mean back end code and how to behave to server.
Here comes some ASP.net Core Controller for post:

 [Route("WeatherForecast/Post")]
        [HttpPost]
        public IActionResult Post([FromForm] FileModel file)
        {
            try
            {
                string path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", file.FileName);

                using (Stream stream = new FileStream(path, FileMode.Create))
                {

                    file.FormFile.CopyTo(stream);

                }

                return StatusCode(StatusCodes.Status201Created);

            }

            catch (Exception)
            {
                return StatusCode(StatusCodes.Status500InternalServerError);
            }
        }


Do you think an image Editor needs the GET and Post at the same time?