Skip to content

Latest commit

 

History

History
258 lines (185 loc) · 9.77 KB

File metadata and controls

258 lines (185 loc) · 9.77 KB

openapi_generated.pinterest_client.MediaApi

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

Method HTTP request Description
media_create POST /media Register media upload
media_get GET /media/{media_id} Get media upload details
media_list GET /media List media uploads

media_create

MediaUpload media_create(media_upload_request)

Register media upload

Register your intent to upload media The response includes all of the information needed to upload the media to Pinterest. To upload the media, make an HTTP POST request (using curl, for example) to upload_url using the Content-Type header value. Send the media file's contents as the request's file parameter and also include all of the parameters from upload_parameters. Learn more about video Pin creation.

Example

  • OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import media_api
from openapi_generated.pinterest_client.model.error import Error
from openapi_generated.pinterest_client.model.media_upload import MediaUpload
from openapi_generated.pinterest_client.model.media_upload_request import MediaUploadRequest
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 = media_api.MediaApi(api_client)
    media_upload_request = MediaUploadRequest(
        media_type="media_type_example",
    ) # MediaUploadRequest | Create a media upload request

    # example passing only required values which don't have defaults set
    try:
        # Register media upload
        api_response = api_instance.media_create(media_upload_request)
        pprint(api_response)
    except openapi_generated.pinterest_client.ApiException as e:
        print("Exception when calling MediaApi->media_create: %s\n" % e)

Parameters

Name Type Description Notes
media_upload_request MediaUploadRequest Create a media upload request

Return type

MediaUpload

Authorization

pinterest_oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 response -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

media_get

MediaUploadDetails media_get(media_id)

Get media upload details

Get details for a registered media upload, including its current status. Learn more about video Pin creation.

Example

  • OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import media_api
from openapi_generated.pinterest_client.model.error import Error
from openapi_generated.pinterest_client.model.media_upload_details import MediaUploadDetails
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 = media_api.MediaApi(api_client)
    media_id = "4" # str | Media identifier

    # example passing only required values which don't have defaults set
    try:
        # Get media upload details
        api_response = api_instance.media_get(media_id)
        pprint(api_response)
    except openapi_generated.pinterest_client.ApiException as e:
        print("Exception when calling MediaApi->media_get: %s\n" % e)

Parameters

Name Type Description Notes
media_id str Media identifier

Return type

MediaUploadDetails

Authorization

pinterest_oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 response -
404 Media upload not found -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

media_list

bool, date, datetime, dict, float, int, list, str, none_type media_list()

List media uploads

List media uploads filtered by given parameters. Learn more about video Pin creation.

Example

  • OAuth Authentication (pinterest_oauth2):
import time
import openapi_generated.pinterest_client
from openapi_generated.pinterest_client.api import media_api
from openapi_generated.pinterest_client.model.error import Error
from openapi_generated.pinterest_client.model.paginated import Paginated
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 = media_api.MediaApi(api_client)
    bookmark = "bookmark_example" # str | Cursor used to fetch the next page of items (optional)
    page_size = 25 # int | Maximum number of items to include in a single page of the response. See documentation on <a href='/docs/getting-started/pagination/'>Pagination</a> for more information. (optional) if omitted the server will use the default value of 25

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # List media uploads
        api_response = api_instance.media_list(bookmark=bookmark, page_size=page_size)
        pprint(api_response)
    except openapi_generated.pinterest_client.ApiException as e:
        print("Exception when calling MediaApi->media_list: %s\n" % e)

Parameters

Name Type Description Notes
bookmark str Cursor used to fetch the next page of items [optional]
page_size int Maximum number of items to include in a single page of the response. See documentation on <a href='/docs/getting-started/pagination/'>Pagination</a> for more information. [optional] if omitted the server will use the default value of 25

Return type

bool, date, datetime, dict, float, int, list, str, none_type

Authorization

pinterest_oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 response -
0 Unexpected error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]