Code Monkey home page Code Monkey logo

amz-advertising-api's Introduction

Advertising API NodeJS client library.

Docs

Amazon Advertising Docs

Guide

Initiate the client

let AdvertisingClient = require('amz-advertising-api');

let client = new AdvertisingClient({
    clientId: "CLIENT_ID",
    clientSecret: "CLIENT_SECRET",
    accessToken: "ACCESS_TOKEN",
    refreshToken: "REFRESH_TOKEN",
    profileId: "PROFILE_ID",
    sandbox: false,
    region: 'eu'
});

await client.init();

Refresh access token

The refresh token gets automaticly refreshed every 2 minutes.

{
  "access_token": "Atza|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSR…",
  "expires_in": 3600
}

Set profile Id

client.options.profileId = "1234567890";

Once you've set the profile Id you are ready to start making API calls.

API Calls

List Profiles

List Profiles

let profiles = await client.listProfiles();
[
  {
    "profileId":1234567890,
    "countryCode":"US",
    "currencyCode":"USD",
    "dailyBudget":10.00,
    "timezone":"America/Los_Angeles",
    "accountInfo":{
      "marketplaceStringId":"ABC123",
      "sellerStringId":"DEF456"
    }
  }
]

Get Profile

Retrieves a single profile by Id.

await client.getProfile("1234567890");
{
  "profileId": 1234567890,
  "countryCode": "US",
  "currencyCode": "USD",
  "dailyBudget": 3.99,
  "timezone": "America/Los_Angeles",
  "accountInfo": {
    "marketplaceStringId": "ABC123",
    "sellerStringId": "DEF456"
  }
}

List Portfolios

listPortfolios(filter: {}, extended: false).

Accepts first argument as filter, and the second argument to list for extended details or not.

await client.listPortfolios();
[
  {
    "portfolioId": 1234567890,
    "name": "Portfolio Name",
    "budget": { },
    "inBudget": true,
    "state": "enabled"
  }
]

Get Portfolio

getPortfolio(portfolioId, extended: false).

Accepts first argument as the portfolioId, and the second argument for extended details or not.

await client.getPortfolio(portfolioId);
{
  "portfolioId": 1234567890,
  "name": "Portfolio Name",
  "budget": { },
  "inBudget": true,
  "state": "enabled",
  "creationDate": 202-0101,
  "lastUpdatedDate": 20210101
}

amz-advertising-api's People

Contributors

bry221996 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

pasha-za

amz-advertising-api's Issues

Querify

Hi

you are using "replace" in your querify function. Shouldn't that be replaceAll? I am having problems to use campaign filters with multiple campaign ids, that must be separated with a comma.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.