Skip to content

Commit 20f0e7b

Browse files
fix: edit messages
1 parent 2290a88 commit 20f0e7b

File tree

4 files changed

+34
-40
lines changed

4 files changed

+34
-40
lines changed

messages/graphql.md

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
11
# summary
22

3-
Execute GraphQL statements
3+
Execute a GraphQL statement.
44

55
# description
66

7-
Run any valid GraphQL statement via the /graphql [API](https://developer.salesforce.com/docs/platform/graphql/guide/graphql-about.html)
7+
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.
8+
9+
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.
810

911
# examples
1012

11-
- Runs the graphql query directly via the command line
13+
- Execute a GraphQL query on the Account object by specifying the query directly to the "--body" flag; the command uses your default org:
1214

1315
<%= config.bin %> <%= command.id %> --body "query accounts { uiapi { query { Account { edges { node { Id \n Name { value } } } } } } }"
1416

15-
- Runs a mutation to create an Account, with an `example.txt` file, containing
17+
- Read the GraphQL statement from a file called "example.txt" and execute it on an org with alias "my-org":
1618

17-
mutation AccountExample{
18-
uiapi {
19-
AccountCreate(input: {
20-
Account: {
21-
Name: "Trailblazer Express"
22-
}
23-
}) {
24-
Record {
25-
Id
26-
Name {
27-
value
28-
}
29-
}
30-
}
31-
}
32-
}
19+
<%= config.bin %> <%= command.id %> --body example.txt --target-org my-org
3320

34-
<%= config.bin %> <%= command.id %> --body example.txt
21+
- Pipe the GraphQL statement that you want to execute from standard input to the command:
3522

36-
will create a new account returning specified fields (Id, Name)
23+
$ echo graphql | sf api request graphql --body -
3724

38-
# flags.header.summary
25+
- Write the output of the command to a file called "output.txt" and include the HTTP response status and headers:
3926

40-
HTTP header in "key:value" format.
27+
<%= config.bin %> <%= command.id %> --body example.txt --stream-to-file output.txt --include
4128

4229
# flags.body.summary
4330

44-
File or content with GraphQL statement. Specify "-" to read from standard input.
31+
File or content with the GraphQL statement. Specify "-" to read from standard input.

messages/rest.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
11
# summary
22

3-
Make an authenticated HTTP request to Salesforce REST API and print the response.
3+
Make an authenticated HTTP request using the Salesforce REST API.
4+
5+
# description
6+
7+
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.
8+
9+
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.
410

511
# examples
612

713
- List information about limits in the org with alias "my-org":
814

915
<%= config.bin %> <%= command.id %> 'limits' --target-org my-org
1016

11-
- List all endpoints
17+
- List all endpoints in your default org; write the output to a file called "output.txt" and include the HTTP response status and headers:
1218

13-
<%= config.bin %> <%= command.id %> '/'
19+
<%= config.bin %> <%= command.id %> '/' --stream-to-file output.txt --include
1420

1521
- Get the response in XML format by specifying the "Accept" HTTP header:
1622

17-
<%= config.bin %> <%= command.id %> 'limits' --target-org my-org --header 'Accept: application/xml'
23+
<%= config.bin %> <%= command.id %> 'limits' --header 'Accept: application/xml'
1824

19-
- POST to create an Account object
25+
- Create an account record using the POST method; specify the request details directly in the "--body" flag:
2026

2127
<%= config.bin %> <%= command.id %> 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
2228

23-
- or with a file 'info.json' containing
24-
25-
{
26-
"Name": "Demo",
27-
"ShippingCity": "Boise"
28-
}
29+
- Create an account record using the information in a file called "info.json":
2930

30-
<%= config.bin %> <%= command.id %> 'sobjects/account' --body info.json --method POST
31+
<%= config.bin %> <%= command.id %> 'sobjects/account' --body info.json --method POST
3132

32-
- Update object
33+
- Update an account record using the PATCH method:
3334

3435
<%= config.bin %> <%= command.id %> 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
3536

@@ -43,4 +44,4 @@ HTTP header in "key:value" format.
4344

4445
# flags.body.summary
4546

46-
File to use as the body for the request. Specify "-" to read from standard input; specify "" for an empty body.
47+
File or content for the body of the HTTP request. Specify "-" to read from standard input or "" for an empty body.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@
5858
],
5959
"topics": {
6060
"api": {
61-
"description": "commands to send and interact with API calls"
61+
"description": "Commands to interact with API calls.",
62+
"subtopics": {
63+
"request": {
64+
"description": "Commands that make API requests."
65+
}
66+
}
6267
}
6368
},
6469
"flexibleTaxonomy": true

src/commands/api/request/rest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-api', 'rest');
1717

1818
export class Rest extends SfCommand<void> {
1919
public static readonly summary = messages.getMessage('summary');
20+
public static readonly description = messages.getMessage('description');
2021
public static readonly examples = messages.getMessages('examples');
2122
public static state = 'beta';
2223
public static enableJsonFlag = false;

0 commit comments

Comments
 (0)