vtex-node-sdk
A VTEX Node.js SDK.
Installation:
npm install --save vtex-node-sdk
Logger
VTEX Log4js wrapper
var Logger = Logger var loggerConfig = type: 'console' category: 'myCategory' verbose: true var logger =
Logger will receive different log levels based on some configs: verbose
option
will set the log level to INFO
. debugMode
will set the log level to DEBUG
.
Any logging will be disabled if the NODE_ENV
is set to test
License Manager Client
LicenseManagerClient([lmEnvironment])
Client for the License Manager service.
If no lmEnvironment
paramenter is passed, the stable service will be used.
var LicenseManagerClient = LicenseManagerClientvar lmClient =
getAccountDetails
GET /api/license-manager/pvt/accounts/hosts/:host
getAccountDetails(host, vtexIdclientAutCookie)
Returns a promise fulfilling an array with the response
and the body
object of the request.
var vtexIdclientAutCookie = "authtokenvalue==" lmClient
getTopbarInfo
GET /api/license-manager/site/pvt/newtopbar?an=:account
getTopbarInfo(account, vtexIdclientAutCookie)
Returns a promise fulfilling an array with the response
and the body
object of the request
var vtexIdclientAutCookie = "authtokenvalue==" lmClient
IAM Client
IAMClient()
Client for the IAM service.
var IAMClient = IAMvar iam =
getVtexAuthToken
POST /sts/tokens/assumerole/vtexid
Payload example:
getVtexAuthToken(account, vtexIdclientAutCookie)
Returns a promise that fullfils an array with the response
and a token
string
var vtexIdClientAutCookie = "1234vtexidtoken==" iam
VTEX API Token
S3 GET vtex-id/tokens/vtex-id/tokens/vtexappkey-appvtex.json
Returns app key from S3. Needs valid AWS credentials.