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
Use your Cosmic account email and password to create an authentication token. **Authentication is only required for account-level access such as adding / removing Buckets from your account, getting user info, etc. The token is not required to query Bucket content**.
#### Connect to Bucket [[View Docs](https://docs.cosmicjs.com/rest-api/buckets.html#connect-to-bucket)]
49
+
#### Connect to Bucket [[View Docs](https://docs.cosmicjs.com/api-reference/getting-started/introduction#api-access-keys)]
50
50
Use the `Cosmic.bucket` method to connect to your Bucket. Get your Bucket slug located in <i>Your Bucket > Basic Settings > API Access</i> in your [Cosmic Dashboard](https:/www.cosmicjs.com/login).
51
51
```javascript
52
52
// Use the Cosmic.bucket method to connect to your Bucket.
@@ -57,7 +57,7 @@ const bucket = Cosmic.bucket({
57
57
write_key:'your-bucket-write-key'
58
58
})
59
59
```
60
-
#### Get Bucket [[View Docs](https://docs.cosmicjs.com/rest-api/buckets.html#get-bucket)]
60
+
#### Get Bucket [[View Docs](https://docs.cosmicjs.com/api-reference/buckets#get-bucket)]
Advanced queries give you powerful NoSQL database-like functionality for content fetching. Use the `query` parameter to send a valid JSON (stringified) query on the Get Objects Endpoint. View more examples in [the docs](https://docs.cosmicjs.com/rest-api/objects.html#advanced-queries-beta).
310
+
#### Queries and Logic [[View Docs](https://docs.cosmicjs.com/api-reference/queries)]
311
+
Queries and logic give you powerful NoSQL database-like functionality for content fetching. Use the `query` parameter to send a valid JSON (stringified) query on the Get Objects Endpoint. View more examples in [the docs](https://docs.cosmicjs.com/api-reference/queries).
312
312
```javascript
313
313
constbucket=Cosmic.bucket({
314
314
slug:'your-bucket-slug',
@@ -348,7 +348,7 @@ const data = await bucket.getMergeRequestObjects({
348
348
```
349
349
Use these Objects to then overright Objects from the target Bucket response based on unique `slug` and `locale` identifiers. An example of this logic can be found in the [Next Merge template](https://github.com/cosmicjs/next-merge/blob/master/lib/merge.js#L19).
350
350
351
-
### Get Single Object [[View Docs](https://docs.cosmicjs.com/rest-api/objects.html#get-object)]
351
+
### Get Single Object [[View Docs](https://docs.cosmicjs.com/api-reference/objects#get-object)]
You can edit an existing Object's Metafields by using the following method. This method allows you to edit specific Metafields identified by `key`, without affecting other Metafields.
#### Get Object Revisions [[View Docs](https://docs.cosmicjs.com/rest-api/objects.html#get-object-revisions)]
443
+
#### Get Object Revisions [[View Docs](https://docs.cosmicjs.com/api-reference/object-revisions)]
444
444
Returns all Object Revisions from the specified Object.
445
445
```javascript
446
446
constbucket=Cosmic.bucket({
@@ -459,7 +459,7 @@ bucket.getObjectRevisions({
459
459
})
460
460
```
461
461
462
-
#### TODO Add Object Revision [[View Docs](https://docs.cosmicjs.com/rest-api/objects.html#add-object-revision)]
462
+
#### TODO Add Object Revision [[View Docs](https://docs.cosmicjs.com/api-reference/object-revisions)]
463
463
Add Object Revision to an Object.
464
464
```javascript
465
465
constbucket=Cosmic.bucket({
@@ -479,7 +479,7 @@ bucket.addObjectRevision({
479
479
```
480
480
481
481
### Media
482
-
#### Add Media [[View Docs](https://docs.cosmicjs.com/rest-api/media.html#add-media)]
482
+
#### Add Media [[View Docs](https://docs.cosmicjs.com/api-reference/media#add-media)]
483
483
The only required post value is media which is the name of your media sent.
484
484
```javascript
485
485
constbucket=Cosmic.bucket({
@@ -500,7 +500,7 @@ bucket.addMedia({
500
500
console.log(err)
501
501
})
502
502
```
503
-
#### Get Media [[View Docs](https://docs.cosmicjs.com/rest-api/media.html#get-media)]
503
+
#### Get Media [[View Docs](https://docs.cosmicjs.com/api-reference/media#get-media-list)]
504
504
You can add the `folder` parameter to get Media from a certain folder. You can use the full [Imgix suite of image processing tools](https://imgix.com) on the URL provided by the `imgix_url` property value. Check out the Imgix documentation for more info.
505
505
```javascript
506
506
constbucket=Cosmic.bucket({
@@ -518,7 +518,7 @@ bucket.getMedia({
518
518
console.log(err)
519
519
})
520
520
```
521
-
#### Delete Media [[View Docs](https://docs.cosmicjs.com/rest-api/media.html#delete-media)]
521
+
#### Delete Media [[View Docs](https://docs.cosmicjs.com/api-reference/media#delete-media)]
Sends a POST request to the endpoint of your choice when the event occurs. The data payload in the same fomat as Object and Media. Read more about Webhooks including the payload sent to the endpoint on the <ahref='https:/docs./cosmicjs/docs/webhooks'target='_blank'>Webhooks documentation page</a>.
539
539
```javascript
540
540
bucket.addWebhook({
@@ -546,7 +546,7 @@ bucket.addWebhook({
546
546
console.log(err)
547
547
})
548
548
```
549
-
#### TODO Get Webhooks [[View Docs](https://docs.cosmicjs.com/rest-api/webhooks.html#get-webhooks)]
549
+
#### TODO Get Webhooks [[View Docs](https://docs.cosmicjs.com/api-reference/getting-started/introduction)]
550
550
Get webhooks in your Bucket. Authentication token is required in the header (see Authentication section). Must have admin level access.
551
551
```javascript
552
552
bucket.getWebhooks()
@@ -557,7 +557,7 @@ bucket.getWebhooks()
557
557
console.log(err)
558
558
})
559
559
```
560
-
#### TODO Delete Webhook [[View Docs](https://docs.cosmicjs.com/rest-api/webhooks.html#delete-a-webhook)]
560
+
#### TODO Delete Webhook [[View Docs](https://docs.cosmicjs.com/api-reference/getting-started/introduction)]
Adds an Extension to your Bucket. Post values include `zip` (which is the name of your file sent) or `zip_url` (which is the url of the zip file) or `url` (which is hosted url of extension). Note: You can only post one of these at a time. Read more about Extensions on the <ahref='https://docs.cosmicjs.com/extensions'target='_blank'>Extensions documentation page</a>.
573
573
```javascript
574
574
bucket.addExtension({
@@ -581,7 +581,7 @@ bucket.addExtension({
581
581
console.log(err)
582
582
})
583
583
```
584
-
#### Get Extensions [[View Docs](https://docs.cosmicjs.com/rest-api/extensions.html#get-extensions)]
584
+
#### Get Extensions [[View Docs](https://docs.cosmicjs.com/api-reference/getting-started/introduction)]
585
585
Get Extensions in your Bucket. Authentication token is required in the header (see Authentication section). Must have admin level access.
If a write key is enabled on the requested bucket, the parameter `write_key` will need to be present. For security, `query_params` values will be saved as JavaScript Web Tokens (JWT), but available in your Extension as a decoded value.
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,8 @@ npm install cosmicjs
40
40
41
41
## Basic Usage
42
42
43
-
#### Connect to Bucket [[View Docs](https://docs.cosmicjs.com/rest-api/buckets.html#connect-to-bucket)]
44
-
Use the `Cosmic.bucket` method to connect to your Bucket. Get your Bucket slug located in <i>Your Bucket > Basic Settings > API Access</i> in your [Cosmic Dashboard](https://www.cosmicjs.com/login).
43
+
#### Connect to Bucket [[View Docs](https://docs.cosmicjs.com/api-reference/getting-started/introduction#api-access-keys)]
44
+
Use the `Cosmic.bucket` method to connect to your Bucket. Get your Bucket slug located in <i>Your Bucket > Basic Settings > API Access</i> in your [Cosmic Dashboard](https://app.cosmicjs.com/login).
45
45
```javascript
46
46
// Use the Cosmic.bucket method to connect to your Bucket.
47
47
constCosmic=require('cosmicjs')()
@@ -52,8 +52,8 @@ const bucket = Cosmic.bucket({
52
52
})
53
53
```
54
54
55
-
### Get Objects by Type [[View Docs](https://docs.cosmicjs.com/rest-api/objects.html#get-objects)]
56
-
Get Objects from an Object Type. Uses `getObjects` method with additional `type` param. Additional options noted below. [See docs for more options](https://docs.cosmicjs.com/rest-api/objects.html#get-objects) including powerful [Advanced Queries](https://docs.cosmicjs.com/rest-api/objects.html#advanced-queries-beta).
55
+
### Get Objects by Type [[View Docs](https://docs.cosmicjs.com/api-reference/objects)]
56
+
Get Objects from an Object Type. Uses `getObjects` method with additional `type` param. Additional options noted below. [See docs for more options](https://docs.cosmicjs.com/api-reference/objects) including powerful [queries and logic](https://docs.cosmicjs.com/api-reference/queries).
0 commit comments