@@ -4,7 +4,7 @@ title: CLI for Subscriptions API Tutorial
4
4
5
5
## Introduction
6
6
7
- The ` planet subscriptions ` command enables interaction with the
7
+ The ` planet subscriptions ` command enables interaction with the
8
8
[ Subscriptions API] ( https://developers.planet.com/apis/subscriptions/ )
9
9
that make it possible to set up a recurring search criteria. Using ` planet subscriptions ` , you can automatically process
10
10
and deliver new imagery to a cloud bucket. It also has a powerful 'backfill' capability
@@ -15,7 +15,7 @@ through the main commands available in the CLI.
15
15
16
16
### Create a Subscription
17
17
18
- Since there is no UI to easily create subscriptions we’ll start with making a new one.
18
+ Since there is no UI to easily create subscriptions we’ll start with making a new one.
19
19
20
20
``` json
21
21
{
@@ -104,11 +104,11 @@ Since there is no UI to easily create subscriptions we’ll start with making a
104
104
}
105
105
```
106
106
107
- This is a full subscriptions JSON request, with the credentials redacted, so you’ll have
108
- to replace your own for it to work. Below we’ll show the convenience methods that will
109
- help create a custom one more easily. If you'd like to get things working for now then
110
- just replace the 'delivery' section with your cloud credentials, see the
111
- [ core subscriptions delivery docs] ( https://developers.planet.com/docs/subscriptions/delivery/ )
107
+ This is a full subscriptions JSON request, with the credentials redacted, so you’ll have
108
+ to replace your own for it to work. Below we’ll show the convenience methods that will
109
+ help create a custom one more easily. If you'd like to get things working for now then
110
+ just replace the 'delivery' section with your cloud credentials, see the
111
+ [ core subscriptions delivery docs] ( https://developers.planet.com/docs/subscriptions/delivery/ )
112
112
for more information.
113
113
114
114
To create a new subscription with the CLI, use the ` create ` command and the json file you just created:
@@ -122,7 +122,7 @@ planet subscriptions create my-subscription.json
122
122
123
123
#### Create a Subscription with Hosting and Collection ID
124
124
125
- In addition to the basic subscription creation process, you can now specify hosting options and a collection ID directly in the create command.
125
+ In addition to the basic subscription creation process, you can now specify hosting options and a collection ID directly in the create command.
126
126
127
127
``` sh
128
128
planet subscriptions create my-subscription.json --hosting sentinel_hub --collection_id ba8f7274-aacc-425e-8a38-e21517bfbeff
@@ -139,8 +139,8 @@ Now that you’ve got a subscription working you can make use of the other comma
139
139
planet subscriptions list
140
140
```
141
141
142
- outputs the JSON for your first 100 subscriptions. If you'd like more you can set the ` --limit `
143
- parameter higher, or you can set it to 0 and there will be no limit.
142
+ outputs the JSON for your first 100 subscriptions. If you'd like more you can set the ` --limit `
143
+ parameter higher, or you can set it to 0 and there will be no limit.
144
144
145
145
You can get nicer formatting with ` --pretty ` or pipe it into ` jq ` , just like the other Planet
146
146
CLI’s.
@@ -173,7 +173,7 @@ planet subscriptions results SUBSCRIPTION_ID
173
173
174
174
` SUBSCRIPTION_ID ` above is a placeholder for a unique subscription identifier, which will be a UUID like ` cb817760-1f07-4ee7-bba6-bcac5346343f ` .
175
175
176
- By default this displays the first 100 results. As with other commands, you can use the ` --limit ` param to
176
+ By default this displays the first 100 results. As with other commands, you can use the ` --limit ` param to
177
177
set a higher limit, or set it to 0 to see all results (this can be quite large with subscriptions results).
178
178
179
179
You can also filter by status:
@@ -183,7 +183,7 @@ planet subscriptions results SUBSCRIPTION_ID --status processing
183
183
```
184
184
185
185
The available statuses are ` created ` , ` queued ` , ` processing ` , ` failed ` , and ` success ` . Note it’s quite useful
186
- to use ` jq ` to help filter out results as well.
186
+ to use ` jq ` to help filter out results as well.
187
187
188
188
#### Results as comma-separated values (CSV)
189
189
@@ -193,8 +193,6 @@ Planetary Variable subscribers can benefit from retrieving results as a CSV. The
193
193
planet subscriptions results SUBSCRIPTION_ID --csv
194
194
```
195
195
196
- * New in version 2.1*
197
-
198
196
### Update Subscription
199
197
200
198
You can update a subscription that is running, for example to change the 'tools' it’s using or to alter
@@ -206,7 +204,16 @@ planet subscriptions update cb817760-1f07-4ee7-bba6-bcac5346343f \
206
204
my-updated-subscriptions.json
207
205
```
208
206
209
- ### Cancel a subscription
207
+ ### Update Subscription Via Patch
208
+
209
+ To update a running subscription with * only* the attributes to be updated, use the ` patch ` method.
210
+
211
+ ``` sh
212
+ planet subscriptions patch cb817760-1f07-4ee7-bba6-bcac5346343f \
213
+ patched-attributes.json
214
+ ```
215
+
216
+ ### Cancel Subscription
210
217
211
218
Cancelling a subscription is simple with the CLI:
212
219
@@ -220,12 +227,12 @@ continue to list and get it.
220
227
## Subscription Request Conveniences
221
228
222
229
There are a couple of commands that can assist in creating the subscription JSON, used for creation and updates.
223
- A subscription request is a pretty complicated command, consisting of a search, a cloud delivery, as well as
224
- tools to process the data plus notifications on the status.
230
+ A subscription request is a pretty complicated command, consisting of a search, a cloud delivery, as well as
231
+ tools to process the data plus notifications on the status.
225
232
226
233
### Catalog Request
227
234
228
- The first place to start is the ` request-catalog ` command, which generates all the JSON for the
235
+ The first place to start is the ` request-catalog ` command, which generates all the JSON for the
229
236
[ catalog source] ( https://developers.planet.com/docs/subscriptions/source/#catalog-source-type ) block. The core
230
237
of this is quite similar to a Data API search request, though with more required fields. The minimal
231
238
required commands would be a request like:
@@ -238,7 +245,7 @@ planet subscriptions request-catalog \
238
245
--start-time 2023-03-17T04:08:00.0Z
239
246
```
240
247
241
- You request which item types you want to deliver, and the asset types for it. Note that the ` asset-types ` are a bit
248
+ You request which item types you want to deliver, and the asset types for it. Note that the ` asset-types ` are a bit
242
249
different than the ` --bundle ` command in Orders, a bundle is a set of asset-types. You can see the list of asset types
243
250
for [ PSScene] ( https://developers.planet.com/docs/data/psscene/#available-asset-types ) , [ SkySatCollect] ( https://developers.planet.com/docs/data/skysatcollect/ ) ,
244
251
and [ SkySatScene] ( https://developers.planet.com/docs/data/skysatscene/#available-asset-types ) . The other item-types
@@ -299,7 +306,7 @@ planet subscriptions request-catalog \
299
306
```
300
307
301
308
For more information on the ` rrule ` parameter see the [ recurrence rules] ( https://developers.planet.com/docs/subscriptions/source/#rrules-recurrence-rules )
302
- documentation.
309
+ documentation.
303
310
304
311
#### Filter
305
312
@@ -354,7 +361,7 @@ planet subscriptions request-catalog \
354
361
#### Saving the output
355
362
356
363
You’ll likely want to save the output of your ` request-catalog ` call to disk, so that you can more easily use it in constructing the complete subscription
357
- request.
364
+ request.
358
365
359
366
``` sh
360
367
planet data filter --range clear_percent gt 90 > filter.json
@@ -387,10 +394,10 @@ planet subscriptions request-pv \
387
394
388
395
### Subscription Tools
389
396
390
- Now we’ll dive into some of the tools options for subscriptions. These are quite similar to the tools for
391
- orders, but unfortunately the syntax is subtly different, and there are less tools supported. Just like
397
+ Now we’ll dive into some of the tools options for subscriptions. These are quite similar to the tools for
398
+ orders, but unfortunately the syntax is subtly different, and there are less tools supported. Just like
392
399
for Orders, future of the versions of the CLI will likely add ` tools ` convenience methods, you can follow issue
393
- [ #601 ] ( https://github.com/planetlabs/planet-client-python/issues/601 ) .
400
+ [ #601 ] ( https://github.com/planetlabs/planet-client-python/issues/601 ) .
394
401
395
402
#### Clipping
396
403
@@ -455,12 +462,12 @@ Example: `more-tools.json`
455
462
456
463
### Delivery
457
464
458
- One other essential block is the ` delivery ` JSON. Like with tools there is no convenience
465
+ One other essential block is the ` delivery ` JSON. Like with tools there is no convenience
459
466
method, as of yet. You must write out the JSON for this section.
460
467
You can find the full documentation for the delivery options in
461
468
the [ Subscriptions Delivery documentation] ( https://developers.planet.com/docs/subscriptions/delivery/ ) .
462
469
463
- An example of a delivery.json file that you would save as a file to pass into the
470
+ An example of a delivery.json file that you would save as a file to pass into the
464
471
` subscriptions request ` command is:
465
472
466
473
``` json
0 commit comments