Example #1
0
        /// <summary>
        /// Provides keyword suggestions for specified list of ASINs. Suggested keywords are ordered by most effective to least effective.
        /// </summary>
        /// <param name="asins">List of ASINs for which keywords are suggested</param>
        /// <param name="maxNumSuggestions">Maximum number of returned suggested keywords. Default is 100, maximum is 1000</param>
        /// <returns></returns>
        public List <BulkGetAsinSuggestedKeywordsResponse> BulkGetAsinSuggestedKeywords(List <string> asins, int maxNumSuggestions = 100)
        {
            var url = $"{APIEndpoint.GetUrl(Marketplace)}/{ApiVersion}/asins/suggested/keywords";

            return(this.HttpRequest <List <BulkGetAsinSuggestedKeywordsResponse> >(
                       url,
                       JsonConvert.SerializeObject(new
            {
                asins = asins,
                maxNumSuggestions = maxNumSuggestions
            }), "POST"));
        }
Example #2
0
        /// <summary>
        /// Retrieves a list of keywords satisfying optional criteria.
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public List <KeywordInfo> ListBiddableKeywords(ListBiddableKeywordsParameter parameter = null)
        {
            var queryData = string.Empty;

            if (parameter != null)
            {
                queryData = GenQueryData(parameter);
            }

            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/keywords?{queryData}";

            return(this.HttpRequest <List <KeywordInfo> >(url));
        }
        /// <summary>
        /// Retrieves a list of ad groups satisfying optional criteria.
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public List <AdGroupInfo> ListAdGroups(ListAdGroupsParameter parameter = null)
        {
            var query = string.Empty;

            if (parameter != null)
            {
                query = GenListAdGroupsQueryData(parameter);
            }

            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/adGroups?{query}";

            return(this.HttpRequest <List <AdGroupInfo> >(url));
        }
Example #4
0
        /// <summary>
        /// Updates one or more campaign negative keywords. Keywords are identified using their  keywordIds .
        /// </summary>
        /// <param name="keywords">A list of up to 1000 updates containing keywordIds and the mutable
        /// fields to be modified.Mutable fields:  state</param>
        /// <returns></returns>
        public List <CampaignNegativeKeywordResponse> UpdateCampaignNegativeKeywords(List <CampaignNegativeKeywordInfo> keywords)
        {
            var data = JsonConvert.SerializeObject(
                keywords,
                Formatting.Indented,
                new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            });
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaignNegativeKeywords";

            return(this.HttpRequest <List <CampaignNegativeKeywordResponse> >(url, data, "PUT"));
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="recordType">The type of entity for which the report should be generated. This must
        /// be one of:  campaigns ,  adGroups ,  keywords , or productAds</param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public RequestReportResponse RequestReport(string recordType, RequestReportParameter parameter)
        {
            var data = JsonConvert.SerializeObject(
                parameter,
                Formatting.Indented,
                new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            });
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/{recordType}/report";

            return(this.HttpRequest <RequestReportResponse>(url, data, "POST"));
        }
Example #6
0
        /// <summary>
        /// Retrieves a list of campaigns satisfying optional criteria.
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public IEnumerable <CampaignInfo> ListCampaigns(ListCampaignsParameter parameter = null)
        {
            var query = string.Empty;

            if (parameter != null)
            {
                query = this.GenListCampaignsQueryParameter(parameter);
            }

            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaigns?{query}";

            return(this.HttpRequest <IEnumerable <CampaignInfo> >(url));
        }
        /// <summary>
        /// Updates one or more ad groups. Ad groups are identified using their adGroupId.
        /// </summary>
        /// <param name="adGroups">A list of up to 100 updates containing  adGroupIds and the mutable fields to be
        /// modified.Mutable fields are:  name ,  defaultBid , and state</param>
        /// <returns></returns>
        public List <AdGroupResponse> UpdateAdGroups(List <AdGroupInfo> adGroups)
        {
            var url  = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/adGroups";
            var data = JsonConvert.SerializeObject(
                adGroups,
                Formatting.Indented,
                new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            return(this.HttpRequest <List <AdGroupResponse> >(url, data, "PUT"));
        }
Example #8
0
        /// <summary>
        /// Retrieves a list of negative keywords with extended fields satisfying optional criteria.
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public List <NegativeKeywordExInfo> ListNegativeKeywordsEx(ListNegativeKeywordsParameter parameter)
        {
            var queryData = string.Empty;

            if (parameter != null)
            {
                queryData = GenQueryData(parameter);
            }

            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/negativeKeywords/extended?{queryData}";

            return(this.HttpRequest <List <NegativeKeywordExInfo> >(url));
        }
Example #9
0
        /// <summary>
        /// Retrieve extended suggested keyword data for the specified  adGroupId .
        /// </summary>
        /// <param name="adGroupId">The ID of the requested ad group</param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public List <GetAdGroupSuggestedKeywordsExResponse> GetAdGroupSuggestedKeywordsEx(
            string adGroupId,
            getAdGroupSuggestedKeywordsExParameter parameter = null)
        {
            var query = string.Empty;

            if (parameter != null)
            {
                query = GenQueryData(parameter);
            }

            var url = $"{APIEndpoint.GetUrl(Marketplace)}/{ApiVersion}/adGroups/{adGroupId}/suggested/keywords/extended?{query}";

            return(this.HttpRequest <List <GetAdGroupSuggestedKeywordsExResponse> >(url));
        }
Example #10
0
        /// <summary>
        /// Retrieve suggested keyword data for the specified  adGroupId
        /// </summary>
        /// <param name="adGroupId">The ID of the requested ad group</param>
        /// <param name="maxNumSuggestions">Maximum number of returned suggested keywords. Default is 100,
        /// maximum is 1000</param>
        /// <param name="adStateFilter">Ad state filter (values are comma separated), to filter out the Ads to get
        /// suggested keywords for their ASINs.Valid values are enabled, paused,
        /// and archived. Default values are enabled and paused</param>
        /// <returns></returns>
        public AdGroupSuggestedKeywordsResponse GetAdGroupSuggestedKeywords(
            string adGroupId,
            string maxNumSuggestions = null,
            string adStateFilter     = null)
        {
            var query = new List <string>();

            if (!string.IsNullOrWhiteSpace(maxNumSuggestions))
            {
                query.Add($"maxNumSuggestions={maxNumSuggestions}");
            }
            if (!string.IsNullOrWhiteSpace(adStateFilter))
            {
                query.Add($"adStateFilter={adStateFilter}");
            }

            var url = $"{APIEndpoint.GetUrl(Marketplace)}/{ApiVersion}/adGroups/{adGroupId}/suggested/keywords?{string.Join("&", query)}";

            return(this.HttpRequest <AdGroupSuggestedKeywordsResponse>(url));
        }
Example #11
0
        /// <summary>
        /// Request a snapshot report for all entities of a single type
        /// </summary>
        /// <param name="recordType">The type of entity for which the snapshot should be generated. This
        /// must be one of:  campaigns ,  adGroups ,  keywords ,  negativeKeywords , campaignNegativeKeywords ,
        /// or productAds</param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public SnapshotResponse RequestSnapshot(string recordType, RequestSnaphotParameter parameter)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/{recordType}/snapshot";

            return(this.HttpRequest <SnapshotResponse>(url, JsonConvert.SerializeObject(parameter), "POST"));
        }
Example #12
0
        /// <summary>
        /// Provides suggested keywords for specified ASIN. Suggested keywords are ordered by most effective to least effective.
        /// </summary>
        /// <param name="asinValue">ASIN</param>
        /// <param name="maxNumSuggestions">Maximum number of returned suggested keywords. Default is 100, maximum is 1000</param>
        /// <returns></returns>
        public BulkGetAsinSuggestedKeywordsResponse GetAsinSuggestedKeywords(string asinValue, int maxNumSuggestions = 100)
        {
            var url = $"{APIEndpoint.GetUrl(Marketplace)}/{ApiVersion}/asins/{asinValue}/suggested/keywords?maxNumSuggestions={maxNumSuggestions}";

            return(this.HttpRequest <BulkGetAsinSuggestedKeywordsResponse>(url));
        }
Example #13
0
        /// <summary>
        /// Retrieves a campaign negative keyword and its extended fields by ID.
        /// </summary>
        /// <param name="keywordId">The ID of the requested keyword</param>
        /// <returns></returns>
        public CampaignNegativeKeywordExInfo GetCampaignNegativeKeywordEx(string keywordId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaignNegativeKeywords/extended/{keywordId}";

            return(this.HttpRequest <CampaignNegativeKeywordExInfo>(url));
        }
        /// <summary>
        /// Retrieve keyword bid recommendation data for one or more keywords.
        /// </summary>
        /// <param name="datas"></param>
        /// <returns></returns>
        public List <BidRecommendationsResponse> GetKeywordBidRecommendations(List <KeywordBidRecommendationsData> datas)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/keywords/bidRecommendations";

            return(this.HttpRequest <List <BidRecommendationsResponse> >(url, JsonConvert.SerializeObject(datas), "POST"));
        }
        /// <summary>
        /// Retrieve bid recommendation data for the specified ad group Id.
        /// </summary>
        /// <param name="adGroupId">The ID of the requested ad group</param>
        /// <returns></returns>
        public AdGroupBidRecommendationsResponse GetAdGroupBidRecommendations(string adGroupId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/adGroups/{adGroupId}/bidRecommendations";

            return(this.HttpRequest <AdGroupBidRecommendationsResponse>(url));
        }
        /// <summary>
        /// Sets the ad group status to archived.
        /// </summary>
        /// <param name="adGroupId">The ID of the ad group to be archived.</param>
        /// <returns></returns>
        public AdGroupResponse ArchiveAdGroup(string adGroupId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/ adGroups/{adGroupId}";

            return(this.HttpRequest <AdGroupResponse>(url, method: "DELETE"));
        }
        /// <summary>
        /// Creates one or more ad groups. Successfully created ad groups will be assigned unique adGroupIds.
        /// </summary>
        /// <param name="adGroups">A list of up to 100 ad groups to be created. Required fields for ad group creation
        /// are:  campaignId ,  name ,  state , and defaultBid</param>
        /// <returns></returns>
        public List <AdGroupResponse> CreateAdGroups(List <AdGroupInfo> adGroups)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/adGroups";

            return(this.HttpRequest <List <AdGroupResponse> >(url, JsonConvert.SerializeObject(adGroups), "POST"));
        }
        /// <summary>
        /// Retrieves an ad group and its extended fields by ID.
        /// </summary>
        /// <param name="adGroupId"></param>
        /// <returns></returns>
        public AdGroupExInfo GetAdGroupEx(string adGroupId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/adGroups/extended/{adGroupId}";

            return(this.HttpRequest <AdGroupExInfo>(url));
        }
Example #19
0
        /// <summary>
        /// Retrieves a negative keyword by ID.
        /// </summary>
        /// <param name="keywordId">The ID of the requested keyword</param>
        /// <returns></returns>
        public NegativeKeywordInfo GetNegativeKeyword(string keywordId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/negativeKeywords/{keywordId}";

            return(this.HttpRequest <NegativeKeywordInfo>(url));
        }
Example #20
0
        /// <summary>
        /// Retrieve a previously requested report
        /// </summary>
        /// <param name="reportId">The ID of the requested report</param>
        /// <returns></returns>
        public RequestReportResponse GetReport(string reportId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/reports/{reportId}";

            return(this.HttpRequest <RequestReportResponse>(url));
        }
        /// <summary>
        /// Retrieve bid recommendation data for the specified keyword ID.
        /// </summary>
        /// <param name="keywordId">The ID of the requested keyword</param>
        /// <returns></returns>
        public KeywordBidRecommendationsResponse GetKeywordBidRecommendations(string keywordId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/keywords/{keywordId}/bidRecommendations";

            return(this.HttpRequest <KeywordBidRecommendationsResponse>(url));
        }
Example #22
0
        /// <summary>
        /// Retrieves a keyword and its extended fields by ID
        /// </summary>
        /// <param name="keywordId">The ID of the requested keyword</param>
        /// <returns></returns>
        public KeywordExInfo GetBiddableKeywordEx(string keywordId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/keywords/extended/{keywordId}";

            return(this.HttpRequest <KeywordExInfo>(url));
        }
Example #23
0
        /// <summary>
        /// Retrieves a campaign and its extended fields by ID.
        /// </summary>
        /// <param name="campaignId"></param>
        /// <returns></returns>
        public CampaignExInfo GetCampaignEx(string campaignId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaigns/extended/{campaignId}";

            return(this.HttpRequest <CampaignExInfo>(url));
        }
Example #24
0
        /// <summary>
        /// Sets the keyword status to archived.
        /// </summary>
        /// <param name="keywordId">The ID of the keyword to be archived.</param>
        /// <returns></returns>
        public KeywordResponse ArchiveBiddableKeyword(string keywordId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/keywords/{keywordId}";

            return(this.HttpRequest <KeywordResponse>(url, method: "DELETE"));
        }
Example #25
0
        /// <summary>
        /// Sets the campaign status to archived.
        /// </summary>
        /// <param name="campaignId"></param>
        public CampaignResponse ArchiveCampaign(string campaignId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaigns/{campaignId}";

            return(this.HttpRequest <CampaignResponse>(url, method: "DELETE"));
        }
Example #26
0
        public IEnumerable <ProfileInfo> GetProfiles()
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/profiles";

            return(this.HttpRequest <IEnumerable <ProfileInfo> >(url));
        }
Example #27
0
        /// <summary>
        /// Creates one or more campaign negative keywords.
        /// Successfully created keywords will be assigned unique  keywordIds
        /// </summary>
        /// <param name="keywords">A list of up to 1000 campaign negative keywords to be created.
        /// Required fields for keyword creation are:  campaignId ,  keywordText ,
        /// matchType , and state</param>
        /// <returns></returns>
        public List <CampaignNegativeKeywordResponse> CreateCampaignNegativeKeywords(List <CampaignNegativeKeywordInfo> keywords)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaignNegativeKeywords";

            return(this.HttpRequest <List <CampaignNegativeKeywordResponse> >(url, JsonConvert.SerializeObject(keywords), "POST"));
        }
Example #28
0
        public ProfileInfo GetProfile(string profileId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/profiles/{profileId}";

            return(this.HttpRequest <ProfileInfo>(url));
        }
Example #29
0
        /// <summary>
        /// Sets the campaign negative keyword status to deleted.
        /// </summary>
        /// <remarks>
        /// While ad group level keywords (both biddable and negative) support paused and archived status, campaign negative
        /// keywords only support enabled or deleted status.Deleted status indicates permanent removal of the campaign negative
        /// keyword.Retrieving a deleted entity by ID will result in a 404 error.
        /// </remarks>
        /// <param name="keywordId">The ID of the keyword to be deleted</param>
        /// <returns></returns>
        public CampaignNegativeKeywordResponse RemoveCampaignNegativeKeyword(string keywordId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/campaignNegativeKeywords/{keywordId}";

            return(this.HttpRequest <CampaignNegativeKeywordResponse>(url, method: "DELETE"));
        }
Example #30
0
        /// <summary>
        /// Sets the product ad status to archived.
        /// </summary>
        /// <param name="adId">The ID of the product ad to be archived.</param>
        /// <returns></returns>
        public AdResponse ArchiveProductAd(string adId)
        {
            var url = $"{APIEndpoint.GetUrl(this.Marketplace)}/{this.ApiVersion}/productAds/{adId}";

            return(this.HttpRequest <AdResponse>(url, method: "DELETE"));
        }