All URIs are relative to https://api.pinterest.com/v5
Method | HTTP request | Description |
---|---|---|
ad_account_countries_get | GET /resources/ad_account_countries | Get ad accounts countries |
delivery_metrics_get | GET /resources/delivery_metrics | Get available metrics' definitions |
interest_targeting_options_get | GET /resources/targeting/interests/{interest_id} | Get interest details |
metrics_ready_state_get | GET /resources/metrics_ready_state | Get metrics ready state |
targeting_options_get | GET /resources/targeting/{targeting_type} | Get targeting options |
AdAccountsCountryResponse ad_account_countries_get()
Get ad accounts countries
Get Ad Accounts countries
- OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import resources_api
from openapi_generated.pinterest_client.model.error import Error
from openapi_generated.pinterest_client.model.ad_accounts_country_response import AdAccountsCountryResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.pinterest.com/v5
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: pinterest_oauth2
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with openapi_generated.pinterest_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = resources_api.ResourcesApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# Get ad accounts countries
api_response = api_instance.ad_account_countries_get()
pprint(api_response)
except openapi_generated.pinterest_client.ApiException as e:
print("Exception when calling ResourcesApi->ad_account_countries_get: %s\n" % e)
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeliveryMetricsResponse delivery_metrics_get()
Get available metrics' definitions
Get the definitions for ads and organic metrics available across both synchronous and asynchronous report endpoints. The display_name
attribute will match how the metric is named in our native tools like Ads Manager. See Organic Analytics and Ads Analytics for more information.
- OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import resources_api
from openapi_generated.pinterest_client.model.delivery_metrics_response import DeliveryMetricsResponse
from openapi_generated.pinterest_client.model.error import Error
from pprint import pprint
# Defining the host is optional and defaults to https://api.pinterest.com/v5
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: pinterest_oauth2
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with openapi_generated.pinterest_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = resources_api.ResourcesApi(api_client)
report_type = "SYNC" # str | Report type. (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get available metrics' definitions
api_response = api_instance.delivery_metrics_get(report_type=report_type)
pprint(api_response)
except openapi_generated.pinterest_client.ApiException as e:
print("Exception when calling ResourcesApi->delivery_metrics_get: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
report_type | str | Report type. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SingleInterestTargetingOptionResponse interest_targeting_options_get(interest_id)
Get interest details
Get details of a specific interest given interest ID.
Click here for a spreadsheet listing interests and their IDs.
- OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import resources_api
from openapi_generated.pinterest_client.model.single_interest_targeting_option_response import SingleInterestTargetingOptionResponse
from openapi_generated.pinterest_client.model.error import Error
from pprint import pprint
# Defining the host is optional and defaults to https://api.pinterest.com/v5
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: pinterest_oauth2
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with openapi_generated.pinterest_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = resources_api.ResourcesApi(api_client)
interest_id = "4" # str | Unique identifier of an interest.
# example passing only required values which don't have defaults set
try:
# Get interest details
api_response = api_instance.interest_targeting_options_get(interest_id)
pprint(api_response)
except openapi_generated.pinterest_client.ApiException as e:
print("Exception when calling ResourcesApi->interest_targeting_options_get: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
interest_id | str | Unique identifier of an interest. |
SingleInterestTargetingOptionResponse
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
BookClosedResponse metrics_ready_state_get(date)
Get metrics ready state
Learn whether conversion or non-conversion metrics are finalized and ready to query.
- OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import resources_api
from openapi_generated.pinterest_client.model.error import Error
from openapi_generated.pinterest_client.model.book_closed_response import BookClosedResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.pinterest.com/v5
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: pinterest_oauth2
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with openapi_generated.pinterest_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = resources_api.ResourcesApi(api_client)
date = "2022-07-13" # str | Analytics reports request date (UTC). Format: YYYY-MM-DD
# example passing only required values which don't have defaults set
try:
# Get metrics ready state
api_response = api_instance.metrics_ready_state_get(date)
pprint(api_response)
except openapi_generated.pinterest_client.ApiException as e:
print("Exception when calling ResourcesApi->metrics_ready_state_get: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
date | str | Analytics reports request date (UTC). Format: YYYY-MM-DD |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TargetingOptionResponse targeting_options_get(targeting_type)
Get targeting options
You can use targeting values in ads placement to define your intended audience.
Targeting metrics are organized around targeting specifications.
For more information on ads targeting, see Audience targeting.
Sample return:
[{"36313": "Australia: Moreton Bay - North", "124735": "Canada: North Battleford", "36109": "Australia: Murray", "36108": "Australia: Mid North Coast", "36101": "Australia: Capital Region", "811": "U.S.: Reno", "36103": "Australia: Central West", "36102": "Australia: Central Coast", "36105": "Australia: Far West and Orana", "36104": "Australia: Coffs Harbour - Grafton", "36107": "Australia: Illawarra", "36106": "Australia: Hunter Valley Exc Newcastle", "554017": "New Zealand: Wanganui", "554016": "New Zealand: Marlborough", "554015": "New Zealand: Gisborne", "554014": "New Zealand: Tararua", "554013": "New Zealand: Invercargill", "GR": "Greece", "554011": "New Zealand: Whangarei", "554010": "New Zealand: Far North", "717": "U.S.: Quincy-Hannibal-Keokuk", "716": "U.S.: Baton Rouge",...}]
- OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import resources_api
from openapi_generated.pinterest_client.model.error import Error
from openapi_generated.pinterest_client.model.targeting_option_response import TargetingOptionResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.pinterest.com/v5
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: pinterest_oauth2
configuration = openapi_generated.pinterest_client.Configuration(
host = "https://api.pinterest.com/v5"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with openapi_generated.pinterest_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = resources_api.ResourcesApi(api_client)
targeting_type = "APPTYPE" # str | Public targeting type.
client_id = "1094834" # str | Client ID. (optional)
oauth_signature = "8209f" # str | Oauth signature (optional)
timestamp = "1618338184277" # str | Timestamp (optional)
# example passing only required values which don't have defaults set
try:
# Get targeting options
api_response = api_instance.targeting_options_get(targeting_type)
pprint(api_response)
except openapi_generated.pinterest_client.ApiException as e:
print("Exception when calling ResourcesApi->targeting_options_get: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get targeting options
api_response = api_instance.targeting_options_get(targeting_type, client_id=client_id, oauth_signature=oauth_signature, timestamp=timestamp)
pprint(api_response)
except openapi_generated.pinterest_client.ApiException as e:
print("Exception when calling ResourcesApi->targeting_options_get: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
targeting_type | str | Public targeting type. | |
client_id | str | Client ID. | [optional] |
oauth_signature | str | Oauth signature | [optional] |
timestamp | str | Timestamp | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
0 | Unexpected error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]