Skip to content

Commit

Permalink
docs: 📝 Updates README
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeem-cs committed Aug 23, 2023
1 parent 8caa08d commit f89d6dc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Install it via npm:
npm i @contentstack/management
```
To import the SDK, use the following command:
```
```javascript
import contentstack from ‘@contentstack/management’

contentstackClient = contentstack.client()
Expand All @@ -29,12 +29,12 @@ contentstackClient = contentstack.client()
To use this SDK, you need to authenticate your users by using the Authtoken, credentials, or Management Token (stack-level token).
### Authtoken
An [Authtoken](https://www.contentstack.com/docs/developers/create-tokens/types-of-tokens/#authentication-tokens-authtokens-) is a read-write token used to make authorized CMA requests, and it is a **user-specific** token.
```
```javascript
contentstackClient = contentstack.client({ authtoken: 'AUTHTOKEN' })
```
### Login
To Login to Contentstack by using credentials, you can use the following lines of code:
```
```javascript
contentstackClient.login({ email: 'EMAIL', password: 'PASSWORD'})
.then((response) => {
console.log(response.notice)
Expand All @@ -44,7 +44,7 @@ contentstackClient.login({ email: 'EMAIL', password: 'PASSWORD'})

### Management Token
[Management Tokens](https://www.contentstack.com/docs/developers/create-tokens/about-management-tokens/) are **stack-level** tokens, with no users attached to them.
```
```javascript
contentstackClient.stack({ api_key: 'API_KEY', management_token: 'MANAGEMENT_TOKEN' }).contentType('CONTENT_TYPE_UID')
.fetch()
.then((contenttype) => {
Expand All @@ -54,14 +54,14 @@ contentstackClient.stack({ api_key: 'API_KEY', management_token: 'MANAGEMENT_TOK
### Contentstack Management JavaScript SDK: 5-minute Quickstart
#### Initializing Your SDK:
To use the JavaScript CMA SDK, you need to first initialize it. To do this, use the following code:
```
```javascript
import contentstack from ‘@contentstack/management’

var contentstackClient = contentstack.client({ authtoken: 'AUTHTOKEN' })
```
#### Fetch Stack Detail
Use the following lines of code to fetch your stack detail using this SDK:
```
```javascript
contentstackClient.stack({ api_key: 'API_KEY' })
.fetch()
.then((stack) => {
Expand All @@ -71,7 +71,7 @@ contentstackClient.stack({ api_key: 'API_KEY' })

#### Create Entry
To create an entry in a specific content type of a stack, use the following lines of code:
```
```javascript
var entry = {
title: 'Sample Entry',
url: '/sampleEntry'
Expand All @@ -85,7 +85,7 @@ contentstackClient.stack({ api_key: 'API_KEY' }).contentType('CONTENT_TYPE_UID')

#### Create Asset
The following lines of code can be used to upload assets to your stack:
```
```javascript
var asset = {
upload: 'path/to/file',
title: 'Asset Title'
Expand All @@ -104,7 +104,7 @@ contentstackClient.stack({ api_key: 'API_KEY' }).asset().create({ asset })
- [Content Management API Docs](https://www.contentstack.com/docs/developers/apis/content-management-api)

### The MIT License (MIT)
Copyright © 2012-2022 [Contentstack](https://www.contentstack.com/). All Rights Reserved
Copyright © 2012-2023 [Contentstack](https://www.contentstack.com/). All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down

0 comments on commit f89d6dc

Please sign in to comment.