Skip to content

Commit

Permalink
Merge pull request #1905 from salesforcecli/release/2.60.8
Browse files Browse the repository at this point in the history
Release PR for 2.60.8 as nightly
  • Loading branch information
svc-cli-bot authored Sep 20, 2024
2 parents 893751b + 3e3d120 commit 43fe602
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 62 deletions.
130 changes: 74 additions & 56 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.60.7 linux-x64 node-v20.17.0
@salesforce/cli/2.60.8 linux-x64 node-v20.17.0
$ sf --help [COMMAND]
USAGE
$ sf COMMAND
Expand Down Expand Up @@ -849,7 +849,7 @@ _See code: [@salesforce/plugin-apex](https://github.com/salesforcecli/plugin-ape

## `sf api request graphql`

Execute GraphQL statements
Execute a GraphQL statement.

```
USAGE
Expand All @@ -862,48 +862,47 @@ FLAGS
-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 (required) File or content with GraphQL statement. Specify "-" to read from
standard input.
--body=file (required) File or content with the GraphQL statement. Specify "-" to read
from standard input.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Execute GraphQL statements
Run any valid GraphQL statement via the /graphql
[API](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html)
EXAMPLES
- Runs the graphql query directly via the command line
sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } } } } } } }"
- Runs a mutation to create an Account, with an `example.txt` file, containing
mutation AccountExample{
uiapi {
AccountCreate(input: {
Account: {
Name: "Trailblazer Express"
}
}) {
Record {
Id
Name {
value
}
}
}
}
}
$ sf api request graphql --body example.txt
will create a new account returning specified fields (Id, Name)
```

_See code: [@salesforce/plugin-api](https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/graphql.ts)_
Execute a GraphQL statement.
Specify the GraphQL statement with the "--body" flag, either directly at the command line or with a file that contains
the statement. You can query Salesforce records using a "query" statement or use mutations to modify Salesforce
records.
This command uses the GraphQL API to query or modify Salesforce objects. For details about the API, and examples of
queries and mutations, see https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html.
EXAMPLES
Execute a GraphQL query on the Account object by specifying the query directly to the "--body" flag; the command
uses your default org:
$ sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } \
} } } } } }"
Read the GraphQL statement from a file called "example.txt" and execute it on an org with alias "my-org":
$ sf api request graphql --body example.txt --target-org my-org
Pipe the GraphQL statement that you want to execute from standard input to the command:
$ echo graphql | sf api request graphql --body -
Write the output of the command to a file called "output.txt" and include the HTTP response status and headers:
$ 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)_

## `sf api request rest ENDPOINT`

Make an authenticated HTTP request to Salesforce REST API and print the response.
Make an authenticated HTTP request using the Salesforce REST API.

```
USAGE
Expand All @@ -922,32 +921,51 @@ FLAGS
-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 to use as the body for the request. Specify "-" to read from standard
input; specify "" for an empty body.
--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.
DESCRIPTION
Make an authenticated HTTP request using the Salesforce REST API.
When sending the HTTP request with the "--body" flag, you can specify the request directly at the command line or with
a file that contains the request.
For a full list of supported REST endpoints and resources, see
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_list.htm.
EXAMPLES
- List information about limits in the org with alias "my-org":
sf api request rest 'limits' --target-org my-org
- List all endpoints
sf api request rest '/'
- Get the response in XML format by specifying the "Accept" HTTP header:
sf api request rest 'limits' --target-org my-org --header 'Accept: application/xml'
- POST to create an Account object
sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
- or with a file 'info.json' containing
{
"Name": "Demo",
"ShippingCity": "Boise"
}
$ sf api request rest 'sobjects/account' --body info.json --method POST
- Update object
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.1/src/commands/api/request/rest.ts)_
List information about limits in the org with alias "my-org":
$ sf api request rest 'limits' --target-org my-org
List all endpoints in your default org; write the output to a file called "output.txt" and include the HTTP response
status and headers:
$ sf api request rest '/' --stream-to-file output.txt --include
Get the response in XML format by specifying the "Accept" HTTP header:
$ sf api request rest 'limits' --header 'Accept: application/xml'
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\" : \
\"Boise\"}" --method POST
Create an account record using the information in a file called "info.json":
$ sf api request rest 'sobjects/account' --body info.json --method POST
Update an account record using the PATCH method:
$ 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)_

## `sf autocomplete [SHELL]`

Expand Down
4 changes: 2 additions & 2 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.60.7",
"version": "2.60.8",
"author": "Salesforce",
"bin": {
"sf": "./bin/run.js",
Expand Down Expand Up @@ -154,7 +154,7 @@
"@salesforce/core": "^8.2.3",
"@salesforce/kit": "^3.1.6",
"@salesforce/plugin-apex": "3.4.10",
"@salesforce/plugin-api": "1.2.1",
"@salesforce/plugin-api": "1.2.2",
"@salesforce/plugin-auth": "3.6.59",
"@salesforce/plugin-data": "3.6.5",
"@salesforce/plugin-deploy-retrieve": "3.12.10",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2311,10 +2311,10 @@
"@salesforce/sf-plugins-core" "^11.3.7"
ansis "^3.3.1"

"@salesforce/[email protected].1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@salesforce/plugin-api/-/plugin-api-1.2.1.tgz#e0977c02fa3768d8078b0673eaabb58ecfdc906b"
integrity sha512-p9AMXmpnZfxqJ3zpwN3TZN1pmum3+Fldj21xpkCX8LQRxPgs4awSZks4H7qUJFwKKj7M5WoAgyXbr6SndnGorA==
"@salesforce/[email protected].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==
dependencies:
"@oclif/core" "^4"
"@salesforce/core" "^8.4.0"
Expand Down

0 comments on commit 43fe602

Please sign in to comment.