locked
Webapi (HttpPost) via Powershell or sql server script RRS feed

  • Question

  • User-154169686 posted

    Hi

    I would like to call web API endpoints (HttpPOST) which will create records in the database. (i.e create products)

    I will read data from excel file such as productName.

    I am not sure what is the right approach 1) Powershell script 2) database script or any better approach.

     public IHttpActionResult PostProduct(int productId)
            {
                /////
            }

    May I know what is the best way to call it. An example will be excellent

    Thursday, August 15, 2019 7:27 AM

All replies

  • User753101303 posted

    Hi,

    Not 100% clear but if you want to send http request from a C# app you could just use https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client rather than going through PowerShell or a SQL database.

    Edit: or you want to upload an Excel file and use that to insert data into a db ? You would use EF or ADO.NET then ? Your exact intent is unclear, I'm not sure if you mean you want to create or call a web api and how it is related to using Excel as a data source.

    For now it seems you want to upload an Excel file to update a database ?

    Thursday, August 15, 2019 11:11 AM