Skip to content

Add cURL examples for Powershell & Command Prompt #17657

@thispsj

Description

@thispsj

Code of Conduct

What article on docs.github.com is affected?

Every REST API reference, the index of which is this.

What part(s) of the article would you like to see updated?

All the examples of REST API endpoint requests.

We should consider some scenarios for Command Prompt & Windows Powershell/Powershell(multi-platform). I've highlighted them below :

  • The line break symbols are different in Command Prompt & Powershell. While \ is for Unix shells, ^ and ` are the symbols for making line breaks in Command Prompt & Powershell respectively.
  • Also warn the Windows Powershell users that curl is an alias for Invoke-WebRequest cmdlet in Windows Powershell. So they should type curl.exe instead of curl. For more information refer initialsession: remove curl and wget aliases PowerShell/PowerShell#1901.
  • cURL comes bundled in Windows 10 build 1804 & later.
  • Also show Command Prompt users how to use double quotes in JSON Request body correctly. An example :
    • Bash
          curl -X PUT https://api.github.com/repos/thispsj/thispsj/topics -d '{"names":["about-me"]}' 
    • Command Prompt
          curl -X PUT https://api.github.com/repos/thispsj/thispsj/topics -d "{\"names\":[\"about-me\"]}" 
  • If possible add examples that use Invoke-WebRequest cmdlet of PowerShell.

Additional information

Idea

As seen in the above screenshot we could add a drop-down list at the marked area containing options : Unix, Command Prompt, Windows Powershell & Powershell. The user can then change the snippet using drop-down which fits best to their platform.

Can give some examples here on request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentThis issue or pull request belongs to the Docs Content teamrestContent related to rest - overview.waiting for reviewIssue/PR is waiting for a writer's review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions