@cumulus/cmr-client v18.2.1
@cumulus/cmr-client
A Node.js client to read from, write to, and delete from NASA's Common Metadata Repository (CMR) API.
API
Classes
CMR
A class to simplify requests to the CMR
Kind: global class
- CMR
- new CMR(params)
- .getToken() ⇒ Promise.<string>
- .getHeaders(params) ⇒ Object
- .ingestCollection(xml) ⇒ Promise.<Object>
- .ingestGranule(xml) ⇒ Promise.<Object>
- .ingestUMMGranule(ummgMetadata) ⇒ Promise.<Object>
- .deleteCollection(datasetID) ⇒ Promise.<Object>
- .deleteGranule(granuleUR) ⇒ Promise.<Object>
- .searchCollections(params, [format]) ⇒ Promise.<Object>
- .searchGranules(params, [format]) ⇒ Promise.<Object>
new CMR(params)
The constructor for the CMR class
Param | Type | Description |
---|---|---|
params | Object | |
params.provider | string | the CMR provider id |
params.clientId | string | the CMR clientId |
params.username | string | CMR username |
params.password | string | CMR password |
Example
const { CMR } = require('@cumulus/cmr-client');
const cmrClient = new CMR({
provider: 'my-provider',
clientId: 'my-clientId',
username: 'my-username',
password: 'my-password'
});
cmrClient.getToken() ⇒ Promise.<string>
The method for getting the token
Kind: instance method of CMR
Returns: Promise.<string> - the token
cmrClient.getHeaders(params) ⇒ Object
Return object containing CMR request headers
Kind: instance method of CMR
Returns: Object - CMR headers object
Param | Type | Description |
---|---|---|
params | Object | |
params.token | string | CMR request token |
params.ummgVersion | string | UMMG metadata version string or null if echo10 metadata |
cmrClient.ingestCollection(xml) ⇒ Promise.<Object>
Adds a collection record to the CMR
Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response
Param | Type | Description |
---|---|---|
xml | string | the collection XML document |
cmrClient.ingestGranule(xml) ⇒ Promise.<Object>
Adds a granule record to the CMR
Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response
Param | Type | Description |
---|---|---|
xml | string | the granule XML document |
cmrClient.ingestUMMGranule(ummgMetadata) ⇒ Promise.<Object>
Adds/Updates UMMG json metadata in the CMR
Kind: instance method of CMR
Returns: Promise.<Object> - to the CMR response object.
Param | Type | Description |
---|---|---|
ummgMetadata | Object | UMMG metadata object |
cmrClient.deleteCollection(datasetID) ⇒ Promise.<Object>
Deletes a collection record from the CMR
Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response
Param | Type | Description |
---|---|---|
datasetID | string | the collection unique id |
cmrClient.deleteGranule(granuleUR) ⇒ Promise.<Object>
Deletes a granule record from the CMR
Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response
Param | Type | Description |
---|---|---|
granuleUR | string | the granule unique id |
cmrClient.searchCollections(params, format) ⇒ Promise.<Object>
Search in collections
Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response
Param | Type | Default | Description |
---|---|---|---|
params | string | the search parameters | |
format | string | "json" | format of the response |
cmrClient.searchGranules(params, format) ⇒ Promise.<Object>
Search in granules
Kind: instance method of CMR
Returns: Promise.<Object> - the CMR response
Param | Type | Default | Description |
---|---|---|---|
params | string | the search parameters | |
format | string | "'json'" | format of the response |
CMRSearchConceptQueue
A class to efficiently list all of the concepts (collections/granules) from CMR search, without loading them all into memory at once. Handles paging.
Kind: global class
- CMRSearchConceptQueue
- new CMRSearchConceptQueue(params)
- .peek() ⇒ Promise.<Object>
- .shift() ⇒ Promise.<Object>
new CMRSearchConceptQueue(params)
The constructor for the CMRSearchConceptQueue class
Param | Type | Default | Description |
---|---|---|---|
params | Object | ||
params.provider | string | the CMR provider id | |
params.clientId | string | the CMR clientId | |
params.type | string | the type of search 'granule' or 'collection' | |
params.searchParams | string | "{}" | the search parameters |
params.format | string | the result format |
Example
const { CMRSearchConceptQueue } = require('@cumulus/cmr-client');
const cmrSearchConceptQueue = new CMRSearchConceptQueue({
provider: 'my-provider',
clientId: 'my-clientId',
type: 'granule',
searchParams: {},
format: 'json'
});
cmrSearchConceptQueue.peek() ⇒ Promise.<Object>
View the next item in the queue
This does not remove the object from the queue. When there are no more items in the queue, returns 'null'.
Kind: instance method of CMRSearchConceptQueue
Returns: Promise.<Object> - an item from the CMR search
cmrSearchConceptQueue.shift() ⇒ Promise.<Object>
Remove the next item from the queue
When there are no more items in the queue, returns null
.
Kind: instance method of CMRSearchConceptQueue
Returns: Promise.<Object> - an item from the CMR search
CMR Docs
CMR REST API endpoint documentation is here:
- https://cmr.earthdata.nasa.gov/search/site/search_api_docs.html
- https://cmr.earthdata.nasa.gov/ingest/site/ingest_api_docs.html
What is Cumulus?
Cumulus is a cloud-based data ingest, archive, distribution and management prototype for NASA's future Earth science data streams.
Test
Test with npm run test
.
Contributing
See Cumulus README
Generated automatically using npm run build-docs
24 hours ago
2 days ago
11 days ago
3 months ago
4 months ago
5 months ago
9 months ago
9 months ago
6 months ago
7 months ago
9 months ago
9 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago