Skip to content

Commit a9385af

Browse files
committed
chore(release): 1.2.2 [skip ci]
1 parent cf13688 commit a9385af

File tree

3 files changed

+73
-49
lines changed

3 files changed

+73
-49
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.2.2](https://github.com/salesforcecli/plugin-api/compare/1.2.1...1.2.2) (2024-09-19)
2+
3+
### Bug Fixes
4+
5+
- edit messages ([20f0e7b](https://github.com/salesforcecli/plugin-api/commit/20f0e7b51924889d31cfcd435a875befe5e1c472))
6+
17
## [1.2.1](https://github.com/salesforcecli/plugin-api/compare/1.2.0...1.2.1) (2024-08-27)
28

39
### Bug Fixes

Diff for: README.md

+66-48
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ sf plugins
6464

6565
## `sf api request graphql`
6666

67-
Execute GraphQL statements
67+
Execute a GraphQL statement.
6868

6969
```
7070
USAGE
@@ -77,48 +77,47 @@ FLAGS
7777
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
7878
`target-org` configuration variable is already set.
7979
--api-version=<value> Override the api version used for api requests made by this command
80-
--body=file (required) File or content with GraphQL statement. Specify "-" to read from
81-
standard input.
80+
--body=file (required) File or content with the GraphQL statement. Specify "-" to read
81+
from standard input.
8282
8383
GLOBAL FLAGS
8484
--flags-dir=<value> Import flag values from a directory.
8585
--json Format output as json.
8686
8787
DESCRIPTION
88-
Execute GraphQL statements
88+
Execute a GraphQL statement.
8989
90-
Run any valid GraphQL statement via the /graphql
91-
[API](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html)
90+
Specify the GraphQL statement with the "--body" flag, either directly at the command line or with a file that contains
91+
the statement. You can query Salesforce records using a "query" statement or use mutations to modify Salesforce
92+
records.
93+
94+
This command uses the GraphQL API to query or modify Salesforce objects. For details about the API, and examples of
95+
queries and mutations, see https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html.
9296
9397
EXAMPLES
94-
- Runs the graphql query directly via the command line
95-
sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } } } } } } }"
96-
- Runs a mutation to create an Account, with an `example.txt` file, containing
97-
mutation AccountExample{
98-
uiapi {
99-
AccountCreate(input: {
100-
Account: {
101-
Name: "Trailblazer Express"
102-
}
103-
}) {
104-
Record {
105-
Id
106-
Name {
107-
value
108-
}
109-
}
110-
}
111-
}
112-
}
113-
$ sf api request graphql --body example.txt
114-
will create a new account returning specified fields (Id, Name)
98+
Execute a GraphQL query on the Account object by specifying the query directly to the "--body" flag; the command
99+
uses your default org:
100+
101+
$ sf api request graphql --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } \
102+
} } } } } }"
103+
104+
Read the GraphQL statement from a file called "example.txt" and execute it on an org with alias "my-org":
105+
106+
$ sf api request graphql --body example.txt --target-org my-org
107+
108+
Pipe the GraphQL statement that you want to execute from standard input to the command:
109+
$ echo graphql | sf api request graphql --body -
110+
111+
Write the output of the command to a file called "output.txt" and include the HTTP response status and headers:
112+
113+
$ sf api request graphql --body example.txt --stream-to-file output.txt --include
115114
```
116115

117-
_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/graphql.ts)_
116+
_See code: [src/commands/api/request/graphql.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.2/src/commands/api/request/graphql.ts)_
118117

119118
## `sf api request rest ENDPOINT`
120119

121-
Make an authenticated HTTP request to Salesforce REST API and print the response.
120+
Make an authenticated HTTP request using the Salesforce REST API.
122121

123122
```
124123
USAGE
@@ -137,32 +136,51 @@ FLAGS
137136
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the
138137
`target-org` configuration variable is already set.
139138
--api-version=<value> Override the api version used for api requests made by this command
140-
--body=file File to use as the body for the request. Specify "-" to read from standard
141-
input; specify "" for an empty body.
139+
--body=file File or content for the body of the HTTP request. Specify "-" to read from
140+
standard input or "" for an empty body.
142141
143142
GLOBAL FLAGS
144143
--flags-dir=<value> Import flag values from a directory.
145144
145+
DESCRIPTION
146+
Make an authenticated HTTP request using the Salesforce REST API.
147+
148+
When sending the HTTP request with the "--body" flag, you can specify the request directly at the command line or with
149+
a file that contains the request.
150+
151+
For a full list of supported REST endpoints and resources, see
152+
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_list.htm.
153+
146154
EXAMPLES
147-
- List information about limits in the org with alias "my-org":
148-
sf api request rest 'limits' --target-org my-org
149-
- List all endpoints
150-
sf api request rest '/'
151-
- Get the response in XML format by specifying the "Accept" HTTP header:
152-
sf api request rest 'limits' --target-org my-org --header 'Accept: application/xml'
153-
- POST to create an Account object
154-
sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
155-
- or with a file 'info.json' containing
156-
{
157-
"Name": "Demo",
158-
"ShippingCity": "Boise"
159-
}
160-
$ sf api request rest 'sobjects/account' --body info.json --method POST
161-
- Update object
162-
sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
155+
List information about limits in the org with alias "my-org":
156+
157+
$ sf api request rest 'limits' --target-org my-org
158+
159+
List all endpoints in your default org; write the output to a file called "output.txt" and include the HTTP response
160+
status and headers:
161+
162+
$ sf api request rest '/' --stream-to-file output.txt --include
163+
164+
Get the response in XML format by specifying the "Accept" HTTP header:
165+
166+
$ sf api request rest 'limits' --header 'Accept: application/xml'
167+
168+
Create an account record using the POST method; specify the request details directly in the "--body" flag:
169+
170+
$ sf api request rest 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \
171+
\"Boise\"}" --method POST
172+
173+
Create an account record using the information in a file called "info.json":
174+
175+
$ sf api request rest 'sobjects/account' --body info.json --method POST
176+
177+
Update an account record using the PATCH method:
178+
179+
$ sf api request rest 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method \
180+
PATCH
163181
```
164182

165-
_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.1/src/commands/api/request/rest.ts)_
183+
_See code: [src/commands/api/request/rest.ts](https://github.com/salesforcecli/plugin-api/blob/1.2.2/src/commands/api/request/rest.ts)_
166184

167185
<!-- commandsstop -->
168186

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/plugin-api",
33
"description": "A plugin to call API endpoints via CLI commands",
4-
"version": "1.2.1",
4+
"version": "1.2.2",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {

0 commit comments

Comments
 (0)