Complete Media Upload

Description

Use this endpoint to accept video upload notification.

Call this endpoint once the media is uploaded to the location provided by the /api/v1/media/upload API endpoint. This API creates a media resource for the video asset. The media resource is represented by a media identifier. The media identifier can be used to associate the media with the adGroup for Sponsored Videos.

Once the media is uploaded, the API internally kicks off a background process for validating the technical specifications of the media file. As a result, the media may not be immediately available for use in a Sponsored Video campaign. See GET/api/v1/media endpoint to get details on when the media is available to be used in a campaign.

URL: PUT /api/v1/media/complete

Request Fields

ParameterDescriptionTypeRequiredPossible Values
advertiserIdThe ID of the advertiserintegerYUnique numeric identifier
mediaNameThe title of the video creative Maximum file name size is 45 characters and no special characters allowedstringYRelevant string value representing the name of the video asset
mediaUploadRequestIdId generated after receiving a request for uploading a video asset.integerYUnique numeric identifier

Headers

Header NameDescriptionRequiredValues
AuthorizationThe token will provide you the access to the API. It is same for all advertisers you access through the API  YPlease utilize the generated auth_token shared with you at the time of partner onboarding from the Getting Started Guide 
WM_CONSUMER.IDWe will provide you the consumer ID to access the API. It is same for all advertisers you access through the API.   YPlease use the generated ConsumerId shared with you at the time of partner onboarding. Refer to the Getting Started Guide for further explanation on this
WM_SEC.AUTH_SIGNATUREAuth signature as an API keyYUse the signature generator code from Getting Started Guide to generate this value
WM_SEC.KEY_VERSIONWe will provide you with the KEY VERSION to access the API. It is same for all advertisers you access through the APIY1
WM_CONSUMER.intimestampTimestamp for which the auth signature is generated. Use Unix epoch format for the timestampYUse the signature generator code (Getting Started Guide) to generate this value

Sample Request

curl -X PUT \
'https://developer.api.stg.walmart.com/api-proxy/service/WPA/Api/v1/api/v1/media/complete' \
--header 'Authorization: Bearer <auth_token>' \ --header 'accept: application/json" \
--header 'WM_SEC.AUTH_SIGNATURE: ***********' \
--header 'WM_SEC.KEY_VERSION: 1' \ 
--header 'WM_CONSUMER.ID: adfwe-v23-faasd2r-afs-asdfqeff' \
--header 'WM_CONSUMER.intimestamp: 1565309779' \
--header 'Content-Type: application/json' \
--data '{ "advertiserId": 500002, "mediaName": "sample-video", "mediaUploadRequestId": 600001 }'

Response

ElementDescriptionType
codeShows status of the ad group update operation Values: success, failure  string
detailsDetails of the failure in case of video file/caption file validation error  string
mediaIdThe unique Id of the media file generated from the notify media upload complete call  integer
errorsError description in case of failure. It consists of: message (data type string), type(data type string), code(data type string) Please find video validation error codes and description in following table “Video Validation errors” array

Video Validation errors

Error CodeError DescriptionAdditional Information
E_BAD_VIDEOFailed to decode video.No additional message
E_EMPTY_VIDEOVideo file is empty.
E_VIDEO_STREAM_COUNTThere must be exactly one video stream. “The provided video had ” + videoStreams.size() + ” video streams.”
E_WIDTH_NOT_POSITIVEVideo width should be greater than zero.
E_HEIGHT_NOT_POSITIVEVideo height should be greater than zero. 
E_VIDEO_DURATION_NOT_POSITIVEVideo duration should be greater than zero.
E_BITRATE_KBPS_NOT_POSITIVEVideo bitrate kbps should be greater than zero.
E_FRAME_RATE_FPS_NOT_POSITIVEVideo frame rate fps should be greater than zero.
E_TIMESTAMP_FORMAT_INVALID
E_TIMESTAMP_DURATION_INVALIDInvalid Video Timestamp Duration
E_VIDEO_URLThe service was unable to retrieve the video from the URL provided.String.format(“Received error %d from %s.”, code, url)
E_CALLBACK_URLString.format(“‘%s’ is not a valid HTTP URL”, callbackUrl)
E_CALLBACK_NOT_ALLOWEDString.format(“The callback URL ‘%s’ cannot be used as the request is not intended for”+ ” transcoding.”,callbackUrl)
E_BAD_SOURCESource is invalid.String.format(“‘%s’ is not a valid HTTP URL or a GCS URI”, source)
E_ASPECT_RATIOVideo does not match aspect ratio requirement.String.format(“%d:%d”, numerator, denominator)
E_MAX_DURATION_SECONDSVideo is longer than max duration requirement.String.format(“Value %s is greater than upper bound %s.”, value, limit)
E_MIN_DURATION_SECONDSVideo is shorter than minimum duration requirement.String.format(“Value %s is less than lower bound %s.”, value, limit)
E_MAX_HEIGHT_PIXELSVideo is taller than max height pixels.String.format(“Value %s is greater than upper bound %s.”, value, limit)
E_MIN_HEIGHT_PIXELSVideo is shorter than minimum pixel height requirement.String.format(“Value %s is less than lower bound %s.”, value, limit)
E_MAX_WIDTH_PIXELSVideo is wider than maximum pixel width requirement.String.format(“Value %s is greater than upper bound %s.”, value, limit)
E_MIN_WIDTH_PIXELSVideo is narrower than minimum pixel width requirement.String.format(“Value %s is less than lower bound %s.”, value, limit)
E_MAX_FILE_SIZE_MBVideo file size is greater than max file size requirement.String.format(“Value %s is greater than upper bound %s.”, value, limit)
E_MIN_FILE_SIZE_MBVideo file size is less than minimum file size requirement.String.format(“Value %s is less than lower bound %s.”, value, limit)
E_MIN_AUDIO_BITRATE_KBPSAudio bit rate is less than minimum audio bitrate kbps requirement.String.format(“Value %s is less than lower bound %s.”, value, limit)
E_MIN_VIDEO_BITRATE_KBPSVideo bitrate is less than minimum video bitrate kbps requirement. String.format(“Value %s is less than lower bound %s.”, value, limit)
E_MIN_FRAME_RATE_PER_SECONDVideo frame rate is less than minimum frame rate per second requirement.String.format(“Value %s is less than lower bound %s.”, value, limit)
E_SUPPORTED_CONTAINERSUnsupported container.“None of the container formats “+ String.join(“, “, containerNames)+ ” were in the list of supported container formats: “+ String.join(“, “, SUPPORTED_CONTAINERS))
E_SUPPORTED_VIDEO_CODECSUnsupported video codec.“Unsupported video codec “+ videoStream.codec_name+ “. The supported video codecs are: “+ String.join(“, “, SUPPORTED_VIDEO_CODECS))
E_SUPPORTED_AUDIO_CODECSUnsupported audio codec.“Unsupported audio codec “+ codecName+ “. The supported audio codecs are PCM codecs and: “+ String.join(“, “, SUPPORTED_AUDIO_CODECS))
E_BAD_CAPTIONClosed caption data is invalid.Empty Closed caption found.
FFProbe identified it as bad closed caption data.
E_VTT_CAPTIONVTT closed caption data is invalid.Couldn’t find blank line between header and content or content is empty.
E_VTT_CAPTION_HEADERVTT closed caption header data is invalid.VTT Closed caption must starts with WEBVTT.
E_VTT_CAPTION_HEADER_METADATAMetadata in VTT closed caption header is invalid.String.format(“Unrecognized header metadata ‘%s’.”, curMetaLine)
E_CAPTION_CUEClosed caption cue data is invalid.String.format(“No timestamps found in Closed Caption cue ‘%s’.”, ccContent)
E_CAPTION_CUE_ARROWArrow between two timestamps in closed caption cue data is invalid.String.format(“Invalid arrow ‘%s’ in ‘%s'”, realArrow, line)
E_CAPTION_FORMAT_NOT_SUPPORTEDClosed caption format not supported.String.format(“Only SRT and VTT are supported. Current format ‘%s’.”, fileFormat)
E_CAPTION_URLThe service was unable to retrieve the caption file from the URL provided.String.format(“Received error %d from %s.”, code, url)
E_MAX_CAPTION_FILE_SIZE_MBClosed caption file size greater than max cc file size requirement. String.format(“Value %s is greater than upper bound %s.”, value, limit)

Sample Response 1

[ { "code": "success", "details": "", "mediaId": 600001, "errors": [ { "message": "message1", "type": "VALIDATION", "code": "E_ASPECT_RATIO" }, { "message": "message2", "type": "VALIDATION", "code": "E_MIN_PIXEL" } ] }
]

Sample Response 2

[ { "code": "success", "details": "", "mediaId": 12620, "errors": null }
]