You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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:
JSON file that contains values for the request header, body, method, and URL.
48
+
49
+
# flags.file.description
50
+
51
+
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:
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/.
62
+
63
+
Here's a simple example of a JSON file that contains values for the request URL, method, and body:
64
+
65
+
{
66
+
"url": "sobjects/Account/<AccountID>",
67
+
"method": "PATCH",
68
+
"body" : {
69
+
"mode": "raw",
70
+
"raw": {
71
+
"BillingCity": "Boise"
72
+
}
73
+
}
74
+
}
75
+
76
+
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.
: // otherwise it's a stdin, and we use it directly
77
-
flags.body;
116
+
// default the method to GET here to allow flags to override, but not hinder reading from files, rather than setting the default in the flag definition
'{"data":{"uiapi":{"query":{"Account":{"edges":[{"node":{"Id":"0017g00001nEdPjAAK","Name":{"value":"Sample Account for Entitlements"}}}]}}}},"errors":[]}'
0 commit comments