Skip to content

Commit cc7bc9d

Browse files
chore: add exmaple, empty body message
1 parent bee7ae1 commit cc7bc9d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

messages/rest.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ Make an authenticated HTTP request to Salesforce REST API and print the response
66

77
- List information about limits in the org with alias "my-org":
88

9-
<%= config.bin %> <%= command.id %> 'services/data/v56.0/limits' --target-org my-org
9+
<%= config.bin %> <%= command.id %> 'limits' --target-org my-org
10+
11+
- List all endpoints
12+
13+
<%= config.bin %> <%= command.id %> '/'
1014

1115
- Get the response in XML format by specifying the "Accept" HTTP header:
1216

13-
<%= config.bin %> <%= command.id %> 'services/data/v56.0/limits' --target-org my-org --header 'Accept: application/xml'
17+
<%= config.bin %> <%= command.id %> 'limits' --target-org my-org --header 'Accept: application/xml'
1418

1519
- POST to create an Account object
1620

17-
<%= config.bin %> <%= command.id %> '/services/data/v46.0/sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
21+
<%= config.bin %> <%= command.id %> 'sobjects/account' --body "{\"Name\" : \"Account from REST API\",\"ShippingCity\" : \"Boise\"}" --method POST
1822

1923
- or with a file 'info.json' containing
2024

@@ -25,11 +29,11 @@ Make an authenticated HTTP request to Salesforce REST API and print the response
2529
}
2630
```
2731

28-
<%= config.bin %> <%= command.id %> '/services/data/v46.0/sobjects/account' --body info.json --method POST
32+
<%= config.bin %> <%= command.id %> 'sobjects/account' --body info.json --method POST
2933

3034
- Update object
3135

32-
<%= config.bin %> <%= command.id %> '/services/data/v46.0/sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
36+
<%= config.bin %> <%= command.id %> 'sobjects/account/<Account ID>' --body "{\"BillingCity\": \"San Francisco\"}" --method PATCH
3337

3438
# flags.include.summary
3539

src/commands/api/request/rest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class Rest extends SfCommand<void> {
135135
this.styledJSON(JSON.parse(res.body) as AnyJson);
136136
} catch (err) {
137137
// If response body isn't JSON, just print it to stdout.
138-
this.log(res.body);
138+
this.log(res.body === '' ? `Server responded with an empty body, status code ${res.statusCode}` : res.body);
139139
}
140140

141141
if (res.statusCode >= 400) {

0 commit comments

Comments
 (0)