pinterest-sdk
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/pinterest-sdk package

1.1.0 • Public • Published

pinterest-sdk

PinterestSdk - JavaScript client for pinterest-sdk Pinterest's REST API This SDK is automatically generated by the OpenAPI Generator project:

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install pinterest-sdk --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your pinterest-sdk from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/cliffano/pinterest-sdk then install it via:

    npm install cliffano/pinterest-sdk --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var PinterestSdk = require('pinterest-sdk');

var defaultClient = PinterestSdk.ApiClient.instance;
// Configure OAuth2 access token for authorization: pinterest_oauth2
var pinterest_oauth2 = defaultClient.authentications['pinterest_oauth2'];
pinterest_oauth2.accessToken = "YOUR ACCESS TOKEN"

var api = new PinterestSdk.AdAccountsApi()
var adAccountId = "adAccountId_example"; // {String} Unique identifier of an ad account.
var startDate = new Date("2013-10-20"); // {Date} Metric report start date (UTC). Format: YYYY-MM-DD
var endDate = new Date("2013-10-20"); // {Date} Metric report end date (UTC). Format: YYYY-MM-DD
var columns = ["SPEND_IN_DOLLAR"]; // {[String]} Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile's currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it's microdollars. Otherwise, it's in microunits of the advertiser's currency.<br/>For example, if the advertiser's currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).<br/>If a column has no value, it may not be returned
var granularity = DAY; // {Granularity} Granularity
var opts = {
  'clickWindowDays': 1, // {Number} Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days.
  'engagementWindowDays': 30, // {Number} Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days.
  'viewWindowDays': 1, // {Number} Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `1` day.
  'conversionReportTime': TIME_OF_AD_ACTION // {String} The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.adAccountAnalytics(adAccountId, startDate, endDate, columns, granularity, opts, callback);

Documentation for API Endpoints

All URIs are relative to https://api.pinterest.com/v5

Class Method HTTP request Description
PinterestSdk.AdAccountsApi adAccountAnalytics GET /ad_accounts/{ad_account_id}/analytics Get ad account analytics
PinterestSdk.AdAccountsApi adAccountsList GET /ad_accounts List ad accounts
PinterestSdk.AdAccountsApi adGroupsAnalytics GET /ad_accounts/{ad_account_id}/ad_groups/analytics Get ad group analytics
PinterestSdk.AdAccountsApi adGroupsList GET /ad_accounts/{ad_account_id}/ad_groups List ad groups
PinterestSdk.AdAccountsApi adsAnalytics GET /ad_accounts/{ad_account_id}/ads/analytics Get ad analytics
PinterestSdk.AdAccountsApi adsList GET /ad_accounts/{ad_account_id}/ads List ads
PinterestSdk.AdAccountsApi analyticsCreateReport POST /ad_accounts/{ad_account_id}/reports Create async request for an account analytics report
PinterestSdk.AdAccountsApi analyticsGetReport GET /ad_accounts/{ad_account_id}/reports Get the account analytics report created by the async call
PinterestSdk.AdAccountsApi campaignsAnalytics GET /ad_accounts/{ad_account_id}/campaigns/analytics Get campaign analytics
PinterestSdk.AdAccountsApi campaignsList GET /ad_accounts/{ad_account_id}/campaigns List campaigns
PinterestSdk.AdAccountsApi productGroupsAnalytics GET /ad_accounts/{ad_account_id}/product_groups/analytics Get product group analytics
PinterestSdk.BoardsApi boardSectionsCreate POST /boards/{board_id}/sections Create board section
PinterestSdk.BoardsApi boardSectionsDelete DELETE /boards/{board_id}/sections/{section_id} Delete board section
PinterestSdk.BoardsApi boardSectionsList GET /boards/{board_id}/sections List board sections
PinterestSdk.BoardsApi boardSectionsListPins GET /boards/{board_id}/sections/{section_id}/pins List Pins on board section
PinterestSdk.BoardsApi boardSectionsUpdate PATCH /boards/{board_id}/sections/{section_id} Update board section
PinterestSdk.BoardsApi boardsCreate POST /boards Create board
PinterestSdk.BoardsApi boardsDelete DELETE /boards/{board_id} Delete board
PinterestSdk.BoardsApi boardsGet GET /boards/{board_id} Get board
PinterestSdk.BoardsApi boardsList GET /boards List boards
PinterestSdk.BoardsApi boardsListPins GET /boards/{board_id}/pins List Pins on board
PinterestSdk.BoardsApi boardsUpdate PATCH /boards/{board_id} Update board
PinterestSdk.CatalogsApi catalogsProductGroupsCreate POST /catalogs/product_groups Create product group
PinterestSdk.CatalogsApi catalogsProductGroupsDelete DELETE /catalogs/product_groups/{product_group_id} Delete product group
PinterestSdk.CatalogsApi catalogsProductGroupsList GET /catalogs/product_groups Get product groups list
PinterestSdk.CatalogsApi catalogsProductGroupsUpdate PATCH /catalogs/product_groups/{product_group_id} Update product group
PinterestSdk.CatalogsApi feedProcessingResultsList GET /catalogs/feeds/{feed_id}/processing_results List processing results for a given feed
PinterestSdk.CatalogsApi feedsCreate POST /catalogs/feeds Create feed
PinterestSdk.CatalogsApi feedsDelete DELETE /catalogs/feeds/{feed_id} Delete feed
PinterestSdk.CatalogsApi feedsGet GET /catalogs/feeds/{feed_id} Get feed
PinterestSdk.CatalogsApi feedsList GET /catalogs/feeds List feeds
PinterestSdk.CatalogsApi feedsUpdate PATCH /catalogs/feeds/{feed_id} Update feed
PinterestSdk.CatalogsApi itemsBatchGet GET /catalogs/items/batch/{batch_id} Get catalogs items batch
PinterestSdk.CatalogsApi itemsBatchPost POST /catalogs/items/batch Perform an operation on an item batch
PinterestSdk.CatalogsApi itemsGet GET /catalogs/items Get catalogs items
PinterestSdk.MediaApi mediaCreate POST /media Register media upload
PinterestSdk.MediaApi mediaGet GET /media/{media_id} Get media upload details
PinterestSdk.MediaApi mediaList GET /media List media uploads
PinterestSdk.OauthApi oauthToken POST /oauth/token Generate OAuth access token
PinterestSdk.PinsApi pinsAnalytics GET /pins/{pin_id}/analytics Get Pin analytics
PinterestSdk.PinsApi pinsCreate POST /pins Create Pin
PinterestSdk.PinsApi pinsDelete DELETE /pins/{pin_id} Delete Pin
PinterestSdk.PinsApi pinsGet GET /pins/{pin_id} Get Pin
PinterestSdk.UserAccountApi userAccountAnalytics GET /user_account/analytics Get user account analytics
PinterestSdk.UserAccountApi userAccountGet GET /user_account Get user account

Documentation for Models

Documentation for Authorization

basic

  • Type: HTTP basic authentication

pinterest_oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://www.pinterest.com/oauth/
  • Scopes:
    • ads:read: See all of your advertising data, including ads, ad groups, campaigns etc.
    • ads:write: Create, update, or delete ads, ad groups, campaigns etc.
    • boards:read: See your public boards, including group boards you join
    • boards:read_secret: See your secret boards
    • boards:write: Create, update, or delete your public boards
    • boards:write_secret: Create, update, or delete your secret boards
    • catalogs:read: See all of your catalogs data
    • catalogs:write: Create, update, or delete your catalogs data
    • pins:read: See your public Pins
    • pins:read_secret: See your secret Pins
    • pins:write: Create, update, or delete your public Pins
    • pins:write_secret: Create, update, or delete your secret Pins
    • user_accounts:read: See your user accounts

Readme

Keywords

none

Package Sidebar

Install

npm i pinterest-sdk

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

1 MB

Total Files

158

Last publish

Collaborators

  • oapicf