pinterest_sdk

PinterestSdkClient - the Ruby gem for the Pinterest REST API

Pinterest's REST API

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 5.3.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://developers.pinterest.com/

Installation

Build a gem

To build the Ruby code into a gem:

gem build pinterest_sdk.gemspec

Then either install the gem locally:

gem install ./pinterest_sdk-1.0.0.gem

(for development, run gem install --dev ./pinterest_sdk-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'pinterest_sdk', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'pinterest_sdk', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'pinterest_sdk'

# Setup authorization
PinterestSdkClient.configure do |config|
  # Configure OAuth2 access token for authorization: pinterest_oauth2
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = PinterestSdkClient::AdAccountsApi.new
 = 'ad_account_id_example' # String | Unique identifier of an ad account.
start_date = Date.parse('2013-10-20') # Date | Metric report start date (UTC). Format: YYYY-MM-DD
end_date = Date.parse('2013-10-20') # Date | Metric report end date (UTC). Format: YYYY-MM-DD
columns = ['AD_ACCOUNT_ID'] # Array<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
granularity = PinterestSdkClient::Granularity::TOTAL # Granularity | Granularity
opts = {
  click_window_days: 1, # Integer | 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.
  engagement_window_days: 1, # Integer | 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.
  view_window_days: 1, # Integer | 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.
  conversion_report_time: '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.
}

begin
  #Get ad account analytics
  result = api_instance.(, start_date, end_date, columns, granularity, opts)
  p result
rescue PinterestSdkClient::ApiError => e
  puts "Exception when calling AdAccountsApi->ad_account_analytics: #{e}"
end

Documentation for API Endpoints

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

Class Method HTTP request Description
PinterestSdkClient::AdAccountsApi ad_account_analytics GET /ad_accounts/ad_account_id/analytics Get ad account analytics
PinterestSdkClient::AdAccountsApi ad_accounts_list GET /ad_accounts List ad accounts
PinterestSdkClient::AdAccountsApi ad_groups_analytics GET /ad_accounts/ad_account_id/ad_groups/analytics Get ad group analytics
PinterestSdkClient::AdAccountsApi ad_groups_list GET /ad_accounts/ad_account_id/ad_groups List ad groups
PinterestSdkClient::AdAccountsApi ads_analytics GET /ad_accounts/ad_account_id/ads/analytics Get ad analytics
PinterestSdkClient::AdAccountsApi ads_list GET /ad_accounts/ad_account_id/ads List ads
PinterestSdkClient::AdAccountsApi analytics_create_report POST /ad_accounts/ad_account_id/reports Create async request for an account analytics report
PinterestSdkClient::AdAccountsApi analytics_get_report GET /ad_accounts/ad_account_id/reports Get the account analytics report created by the async call
PinterestSdkClient::AdAccountsApi campaigns_analytics GET /ad_accounts/ad_account_id/campaigns/analytics Get campaign analytics
PinterestSdkClient::AdAccountsApi campaigns_list GET /ad_accounts/ad_account_id/campaigns List campaigns
PinterestSdkClient::AdAccountsApi product_groups_analytics GET /ad_accounts/ad_account_id/product_groups/analytics Get product group analytics
PinterestSdkClient::BoardsApi board_sections_create POST /boards/board_id/sections Create board section
PinterestSdkClient::BoardsApi board_sections_delete DELETE /boards/board_id/sections/section_id Delete board section
PinterestSdkClient::BoardsApi board_sections_list GET /boards/board_id/sections List board sections
PinterestSdkClient::BoardsApi board_sections_list_pins GET /boards/board_id/sections/section_id/pins List Pins on board section
PinterestSdkClient::BoardsApi board_sections_update PATCH /boards/board_id/sections/section_id Update board section
PinterestSdkClient::BoardsApi boards_create POST /boards Create board
PinterestSdkClient::BoardsApi boards_delete DELETE /boards/board_id Delete board
PinterestSdkClient::BoardsApi boards_get GET /boards/board_id Get board
PinterestSdkClient::BoardsApi boards_list GET /boards List boards
PinterestSdkClient::BoardsApi boards_list_pins GET /boards/board_id/pins List Pins on board
PinterestSdkClient::BoardsApi boards_update PATCH /boards/board_id Update board
PinterestSdkClient::CatalogsApi catalogs_product_groups_create POST /catalogs/product_groups Create product group
PinterestSdkClient::CatalogsApi catalogs_product_groups_delete DELETE /catalogs/product_groups/product_group_id Delete product group
PinterestSdkClient::CatalogsApi catalogs_product_groups_list GET /catalogs/product_groups Get product groups list
PinterestSdkClient::CatalogsApi catalogs_product_groups_update PATCH /catalogs/product_groups/product_group_id Update product group
PinterestSdkClient::CatalogsApi feed_processing_results_list GET /catalogs/feeds/feed_id/processing_results List processing results for a given feed
PinterestSdkClient::CatalogsApi feeds_create POST /catalogs/feeds Create feed
PinterestSdkClient::CatalogsApi feeds_delete DELETE /catalogs/feeds/feed_id Delete feed
PinterestSdkClient::CatalogsApi feeds_get GET /catalogs/feeds/feed_id Get feed
PinterestSdkClient::CatalogsApi feeds_list GET /catalogs/feeds List feeds
PinterestSdkClient::CatalogsApi feeds_update PATCH /catalogs/feeds/feed_id Update feed
PinterestSdkClient::CatalogsApi items_batch_get GET /catalogs/items/batch/batch_id Get catalogs items batch
PinterestSdkClient::CatalogsApi items_batch_post POST /catalogs/items/batch Perform an operation on an item batch
PinterestSdkClient::CatalogsApi items_get GET /catalogs/items Get catalogs items
PinterestSdkClient::MediaApi media_create POST /media Register media upload
PinterestSdkClient::MediaApi media_get GET /media/media_id Get media upload details
PinterestSdkClient::MediaApi media_list GET /media List media uploads
PinterestSdkClient::OauthApi oauth_token POST /oauth/token Generate OAuth access token
PinterestSdkClient::PinsApi pins_analytics GET /pins/pin_id/analytics Get Pin analytics
PinterestSdkClient::PinsApi pins_create POST /pins Create Pin
PinterestSdkClient::PinsApi pins_delete DELETE /pins/pin_id Delete Pin
PinterestSdkClient::PinsApi pins_get GET /pins/pin_id Get Pin
PinterestSdkClient::UserAccountApi user_account_analytics GET /user_account/analytics Get user account analytics
PinterestSdkClient::UserAccountApi user_account_get 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