Skip to content

Curl Not Working #35144

Open
Open
@mthanson8333

Description

@mthanson8333

Description

Using Windows 11, and Visual Studio 2022

Trying to run the curl command: curl -v -X GET 'https://localhost:5001/api/todoitems/' | jq, I get the following error:

VERBOSE: GET with 0-byte payload
VERBOSE: received -1-byte response of content type application/json; charset=utf-8
jq: parse error: Invalid numeric literal at line 3, column 11

When I retrieve the body using the following commands:

$response = Invoke-WebRequest -Uri “https://localhost:5001/api/todoitems” -Method Get
$body = $response.Content
Write-Output $body

the response is:

{"id":"6bb8a868-dba1-4f1a-93b7-24ebce87e243","name":"Learn app development","notes":"Take Microsoft Learn Courses","done":true},{"id":"b94afb54-a1cb-4313-8af3-b7511551b33b","name":"Develop apps","notes":"Use Visual Studio and Visual Studio Code","done":false},{"id":"ecfa6f80-3671-4911-aabe-63cc442c1ecf","name":"Publish apps","notes":"All app stores","done":false}]

The '[' is missing at the beginning.

I gave up on curl or Invoke-WebRequest since the syntax has changed. For example -X is replaced with -Method.

I discovered Endpoints Explorer in Visual Studio. Much easier.

[Enter feedback here]

Page URL

https://learn.microsoft.com/en-us/aspnet/core/mobile/native-mobile-backend?view=aspnetcore-9.0&tabs=windows

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mobile/native-mobile-backend.md

Document ID

d06996cc-14aa-96e2-fd62-9d5bbc059107

Platform Id

1aef513d-2c54-5bd1-156c-3ae44147130d

Article author

@Rick-Anderson

Metadata

  • ID: bdbdf1ed-c52a-3be8-1f41-aecbdab0883b
  • PlatformId: 1aef513d-2c54-5bd1-156c-3ae44147130d
  • Service: aspnet-core
  • Sub-service: mobile

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions