Giter VIP home page Giter VIP logo

Comments (4)

samueleresca avatar samueleresca commented on August 12, 2024

Hi @dmitrybv , I'm trying with the following command from Windows 10 Pro:

curl -X POST https://localhost:5001/api/order/ -H "Content-Type: application/json" -d "{\"itemsIds\": [\"1\",\"4\"]}" -i -k

Could you please confirm that is working as expected?

from hands-on-restful-web-services-with-asp.net-core-3.

dmitrybv avatar dmitrybv commented on August 12, 2024

Hello samueleresca.

Probably all the same not as expected.
Here is the result.

Microsoft Windows [Version 10.0.19041.572]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Users\BDV>curl -X POST https://localhost:5001/api/order/ -H "Content-Type: application/json" -d "{\"itemsIds\": [\"1\",\"4\"]}" -i -k
HTTP/1.1 400 Bad Request
Date: Wed, 28 Oct 2020 04:46:48 GMT
Content-Type: application/problem+json; charset=utf-8
Server: Kestrel
Transfer-Encoding: chunked

{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"|d3e96dd3-448dafb9287ab1f1.","errors":{"Currency":["The Currency field is required."]}}
C:\Users\BDV>
C:\Users\BDV>
C:\Users\BDV>curl -X POST https://localhost:5001/api/order/ -H 'Content-Type: application/json' -d '{"itemsIds": ["1","4"]}' -i -k
HTTP/1.1 415 Unsupported Media Type
Date: Wed, 28 Oct 2020 04:48:28 GMT
Content-Type: application/problem+json; charset=utf-8
Server: Kestrel
Transfer-Encoding: chunked

{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13","title":"Unsupported Media Type","status":415,"traceId":"|d3e96dd6-448dafb9287ab1f1."}curl: (6) Could not resolve host: application
curl: (3) [globbing] bad range in column 2

C:\Users\BDV>

from hands-on-restful-web-services-with-asp.net-core-3.

samueleresca avatar samueleresca commented on August 12, 2024

Hi,
That command is referring to the Post Action method at p.80:

        [HttpPost]
        public IActionResult Post(OrderRequest request)
        {
            var order = new Order()
            {
                Id = Guid.NewGuid(),
                ItemsIds = request.ItemsIds
            };  

            _orderRepository.Add(order);
            
            return Ok();
        }

from hands-on-restful-web-services-with-asp.net-core-3.

deepesh-packt avatar deepesh-packt commented on August 12, 2024

Please reopen if the issue still persists.
Thanks!

from hands-on-restful-web-services-with-asp.net-core-3.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.