Skip to content

Commit

Permalink
Merge pull request #1927 from salesforcecli/release/2.62.1
Browse files Browse the repository at this point in the history
Release PR for 2.62.1 as nightly
  • Loading branch information
svc-cli-bot authored Oct 4, 2024
2 parents a416cf2 + 48c733b commit 0fc1baf
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 24 deletions.
68 changes: 55 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ npm install -g @salesforce/cli
$ sf COMMAND
running command...
$ sf (--version|-v)
@salesforce/cli/2.62.0 linux-x64 node-v20.17.0
@salesforce/cli/2.62.1 linux-x64 node-v20.17.0
$ sf --help [COMMAND]
USAGE
$ sf COMMAND
Expand Down Expand Up @@ -54,7 +54,7 @@ See [architecture page](ARCHITECTURE.md) for diagrams of the Salesforce CLI.
- [`sf apex run test`](#sf-apex-run-test)
- [`sf apex tail log`](#sf-apex-tail-log)
- [`sf api request graphql`](#sf-api-request-graphql)
- [`sf api request rest ENDPOINT`](#sf-api-request-rest-endpoint)
- [`sf api request rest [URL]`](#sf-api-request-rest-url)
- [`sf autocomplete [SHELL]`](#sf-autocomplete-shell)
- [`sf commands`](#sf-commands)
- [`sf config get`](#sf-config-get)
Expand Down Expand Up @@ -903,31 +903,33 @@ EXAMPLES
$ sf api request graphql --body example.txt --stream-to-file output.txt --include
```

_See code: [@salesforce/plugin-api](https://github.com/salesforcecli/plugin-api/blob/1.2.2/src/commands/api/request/graphql.ts)_
_See code: [@salesforce/plugin-api](https://github.com/salesforcecli/plugin-api/blob/1.3.0/src/commands/api/request/graphql.ts)_

## `sf api request rest ENDPOINT`
## `sf api request rest [URL]`

Make an authenticated HTTP request using the Salesforce REST API.

```
USAGE
$ sf api request rest ENDPOINT -o <value> [--flags-dir <value>] [--api-version <value>] [-i | -S Example:
report.xlsx] [-X GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [--body file]
$ sf api request rest [URL] -o <value> [--flags-dir <value>] [--api-version <value>] [-i | -S Example: report.xlsx]
[-X GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE] [-H key:value...] [-f file] [-b file]
ARGUMENTS
ENDPOINT Salesforce API endpoint
URL Salesforce API endpoint
FLAGS
-H, --header=key:value... HTTP header in "key:value" format.
-S, --stream-to-file=Example: report.xlsx Stream responses to a file.
-X, --method=<option> [default: GET] HTTP method for the request.
-X, --method=<option> HTTP method for the request.
<options: GET|POST|PUT|PATCH|HEAD|DELETE|OPTIONS|TRACE>
-b, --body=file File or content for the body of the HTTP request. Specify "-" to read from
standard input or "" for an empty body.
-f, --file=file JSON file that contains values for the request header, body, method, and
URL.
-i, --include Include the HTTP response status and headers in the output.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
`target-org` configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
--body=file File or content for the body of the HTTP request. Specify "-" to read from
standard input or "" for an empty body.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
Expand Down Expand Up @@ -957,7 +959,7 @@ EXAMPLES
Create an account record using the POST method; specify the request details directly in the "--body" flag:
$ sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \
$ sf api request rest sobjects/account --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \
\"Boise\"}" --method POST
Create an account record using the information in a file called "info.json":
Expand All @@ -968,9 +970,49 @@ EXAMPLES
$ sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method \
PATCH
```
_See code: [@salesforce/plugin-api](https://github.com/salesforcecli/plugin-api/blob/1.2.2/src/commands/api/request/rest.ts)_
Store the values for the request header, body, and so on, in a file, which you then specify with the --file flag;
see the description of --file for more information:
$ sf api request rest --file myFile.json
FLAG DESCRIPTIONS
-f, --file=file JSON file that contains values for the request header, body, method, and URL.
Use this flag instead of specifying the request details with individual flags, such as --body or --method. This
schema defines how to create the JSON file:
{
url: { raw: string } | string;
method: 'GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE';
description?: string;
header: string | Array<Record<string, string>>;
body: { mode: 'raw' | 'formdata'; raw: string; formdata: FormData };
}
Salesforce CLI defined this schema to be mimic Postman schemas; both share similar properties. The CLI's schema also
supports Postman Collections to reuse and share requests. As a result, you can build an API call using Postman,
export and save it to a file, and then use the file as a value to this flag. For information about Postman, see
https://learning.postman.com/.
Here's a simple example of a JSON file that contains values for the request URL, method, and body:
{
"url": "sobjects/Account/<Account ID>",
"method": "PATCH",
"body" : {
"mode": "raw",
"raw": {
"BillingCity": "Boise"
}
}
}
See more examples in the plugin-api test directory, including JSON files that use "formdata" to define collections:
https://github.com/salesforcecli/plugin-api/tree/main/test/test-files/data-project.
```

_See code: [@salesforce/plugin-api](https://github.com/salesforcecli/plugin-api/blob/1.3.0/src/commands/api/request/rest.ts)_

## `sf autocomplete [SHELL]`

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@salesforce/cli",
"description": "The Salesforce CLI",
"version": "2.62.0",
"version": "2.62.1",
"author": "Salesforce",
"bin": {
"sf": "./bin/run.js",
Expand Down Expand Up @@ -140,7 +140,7 @@
},
"dependencies": {
"@inquirer/select": "^2.3.5",
"@oclif/core": "4.0.26",
"@oclif/core": "4.0.27",
"@oclif/plugin-autocomplete": "3.2.5",
"@oclif/plugin-commands": "4.0.16",
"@oclif/plugin-help": "6.2.13",
Expand All @@ -154,7 +154,7 @@
"@salesforce/core": "^8.2.3",
"@salesforce/kit": "^3.1.6",
"@salesforce/plugin-apex": "3.5.0",
"@salesforce/plugin-api": "1.2.2",
"@salesforce/plugin-api": "1.3.0",
"@salesforce/plugin-auth": "3.6.65",
"@salesforce/plugin-data": "3.6.8",
"@salesforce/plugin-deploy-retrieve": "3.12.16",
Expand Down
17 changes: 9 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1874,10 +1874,10 @@
proc-log "^4.0.0"
which "^4.0.0"

"@oclif/[email protected].26", "@oclif/core@^4", "@oclif/core@^4.0.16", "@oclif/core@^4.0.18", "@oclif/core@^4.0.19", "@oclif/core@^4.0.20", "@oclif/core@^4.0.23", "@oclif/core@^4.0.6":
version "4.0.26"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.0.26.tgz#3c2414d0dcff26f64a2ec2d3ecec3ce4bd407fbb"
integrity sha512-Gtgj7l+XYYk4wqJ7fTd+fsuKusuQESrSbeue+pC1UGJWt9tyrn3TNZu/lGJSSvEQVcxZY+y09hTET+1e1bmULA==
"@oclif/[email protected].27", "@oclif/core@^4", "@oclif/core@^4.0.16", "@oclif/core@^4.0.18", "@oclif/core@^4.0.19", "@oclif/core@^4.0.20", "@oclif/core@^4.0.23", "@oclif/core@^4.0.6":
version "4.0.27"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.0.27.tgz#686079df278e681e3097cea301d5558fdb490e88"
integrity sha512-9j92jHr6k2tjQ6/mIwNi46Gqw+qbPFQ02mxT5T8/nxO2fgsPL3qL0kb9SR1il5AVfqpgLIG3uLUcw87rgaioUg==
dependencies:
ansi-escapes "^4.3.2"
ansis "^3.3.2"
Expand Down Expand Up @@ -2312,17 +2312,18 @@
"@salesforce/sf-plugins-core" "^11.3.7"
ansis "^3.3.1"

"@salesforce/plugin-api@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@salesforce/plugin-api/-/plugin-api-1.2.2.tgz#39e1aca1cf8f9e240cfc597b7b8ed5044a192058"
integrity sha512-DYcvSvK1J/C0oin9CZltk/UT4d9dOtRBztMxHVUJDR2VC5iJhlx+cjOs76V2/D+7g7Maon0lARYtY0JX+3FZnA==
"@salesforce/plugin-api@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@salesforce/plugin-api/-/plugin-api-1.3.0.tgz#491f526afd3f2330eabfe4ea65dfb71de0d5626c"
integrity sha512-DtCgRjlTUbxQAuCSo4g4xhbOotQcWY3dCOz3es7ihTtpevGj09vczs5acE7u8If25+XCnIdstOO1IyNoJIAzXg==
dependencies:
"@oclif/core" "^4"
"@salesforce/core" "^8.4.0"
"@salesforce/kit" "^3.2.1"
"@salesforce/sf-plugins-core" "^11.3.2"
"@salesforce/ts-types" "^2.0.12"
ansis "^3.3.2"
form-data "^4.0.0"
got "^13.0.0"
proxy-agent "^6.4.0"

Expand Down

0 comments on commit 0fc1baf

Please sign in to comment.