REST API MGID for advertisers

Contents

The main provisions of REST API

REST API allows you to integrate external applications with Mgid online  
advertising system.
API provides the ability to retrieve, add, and modify the data. Practically each  object in Mgid (whether it's a client, an advertising company, a teaser, etc.) can  be controlled by API. Mgid REST API Request is an HTTP request, which, with  the help of the ways in URL the object to perform the action is specified, and  with the help of parameters the necessary data is passed. Mgid API is a "RESTful  Web API". The API uses the following REST commands:
● GET
● PUT
● PATCH
● POST
● DELETE

The query parameters are case sensitive.

These commands correspond to certain actions within the Mgid system. Get an item or a collection of items (for example, a list of advertising campaigns):    

Command Action Description
POST Create Creates a new element (eg, a teaser)
GET Get (read)    Retrieve an element or a collection of elements
PUT Update Recreate an existing element or a collection of elements
PATCH Change Change certain properties of an element
DELETE Delete Delete an item or collection of items (eg, move a teaser to recycle bin)
Important! POST and PUT are not interchangeable. Each of the commands fulfills its specific function.

Mgid API URL:
Mgid REST API for clients is available at:

http://api.mgid.com/v1

In general, the query looks like this:
http://api.mgid.com/v1/module/controller/action?token=_client's_token_&parameter_1=value_of_parameter_1&parameter_2=value_of_parameter_2&parameter_3=value_of_parameter_3

Identification

For identification the Mgid REST API uses a unique token consisting of 32  characters which is passed in client's request. To obtain a valid token client  
should use a special API function.

Every request sent to the Mgid REST API must contain the API token

Mgid REST API answer

In response to a request to the REST API server always returns the HTTP response with a status code , depending on the result of the query. 

Answer code Description
200 OK The query has been successfully
processed

The format of the returned data


The returned data can be formatted as JSON, or XML.  The default format is JSON. The request header is used to specify the format in which the data is  
returned. The client sends an Accept header, which indicates desired response format:  
Accept: application / xml  
or  
Accept: application / json


Description of the response format is sent in the response header Content Type. The data returned is the answer is a JSON string (http://json.org/json ru.html), which generally looks as follows:  

{
"element_1"   "value_of_element_1"    
"element_2" "value_of_element_2"  
"element_3":    {
      "property_1_of_element_3"      "value_of_property_1_of_element_3"       
"property_2_of_element_3":       [
         "value_1_of_property_2_of_element_3"          
"value_2_of_property_2_of_element_3"
      ]       
   }    

  . . . .  
}

 

If an error has occurred during the execution of the query   the description corresponding to the error is returned, such as:

{ "errors": [ "[_error_description_]" ] }

The data in the responses is returned taking into account the time zone of the client.

Working with clients

Getting the current client's token

Method URL
POST api.mgid.com/v1/auth/token

Transferred parameters:

Parameter Value
email E-mail of the client, specified at registration in Mgid system
password Password of the client, received during registration in Mgid system

Returns an answer:

{
 "token":"_current_token_",
 "refreshToken":"_token_for_refresh_"
 "idAuth":"_ID_of_client_account_"
}

_current_token_  is used to identify the client;  
_token_for_refresh_ will be used in future versions to update an overdue current token.

Getting information about the current financial status of the client

Method GET
URL api.mgid.com/v1/clients/_identifier_of_client's_account_?token=_client_token_


Returned answer:

{
   "id":_ client's_account_id _,
   "timezone":_ client's_timezone_,
   "wallet":{
      "balance":_state_of_MG_wallet_,
      "credit":_overdraft_amount_,
      "income":_total_replenish_sum_,
      "currency":_client_currency_
   }
}

All refunds are made in cents (0.01$) balance can have both positive and negative value. Available funds are defined as: balance + credit. Funds spent on advertising: income  balance.

Working with client's advertising campaigns

Getting a collection of client's advertising campaigns

Method GET
URL api.mgid.com/v1/goodhits/clients/_client's_accont_ID_ / campaigns[_ad_campaign_ID_]

If _ad_campaign_ID_ was not passed, then the method returns a collection of client's advertising campaigns. If the ID has been passed correctly, it returns information only about specific ad campaign.

Transferred parameters (required parameters are marked in red):

Parameter Value
token _client's_token_
Fields
  • array of client's properties, information on which you
    need to get.( example: fields=['name','ipsFilter','domainsFilter']).  
    If the parameter is not passed, then all properties are returned. The list may include the following properties:
  • id - ad campaign id
  • language - ad campaign language id
  • name - ad campaign id  
  • status - ad campaign status
  • ipsFilter- IP filter settings  
  • domainsFilter - domain filter settings  
  • widgetsFilterUid - widget filter settings
  • targets - ad campaign operating systems targeting
  • languageTargeting - language filter settings. Ad campaign language id
limit turns on the pagination, limiting the number of campaigns displayed on the page.
start uses for navigation for pagination pages. The default is 0.

Languages list:

ID NAME LANGUAGE_CODE
1 English en
2 Spanish es
3 French fr
4 German de
5 Vietnamese vi
6 Dutch nl
7 Italian it
8 Portuguese pt
9 Indonesian id
10 Greek el
11 Thai th
12 Hindi hi
13 Khmer km
14 Swedish sv
15 Hungarian hu
16 Malay ms
17 Romanian ro
18 Norwegian no
19 Croatian hr
20 Polish pl
21 Finnish fi
22 Danish da
23 Filipino fil
24 Czech cs
25 Korean ko
26 Bosnian bs
27 Slovak sk
28 Japanese ja
29 Bulgarian bg
30 Slovene sl
31 Macedonian mk
32 Turkish tr
33 Estonian et
34 Armenian hy
35 Serbian sr
36 Lithuanian lt
37 Azerbaijani az
38 Latvian lv
39 Russian ru
40 Urdu ur
41 Arabic ar
42 Hebrew he
43 Chinese zh
44 Georgian ka
45 Nepali ne
46 Albanian sq
47 Bengali bn
48 Sinhalese si
49 Uzbek uz
50 Ukrainian uk
51 Tamil ta
52 Telugu te
53 Persian fa
54 Somali so
55 Tajik tg
56 Kyrgyz ky
57 Lao lo
58 Gujarati gu
59 Marathi mr
60 Malayalam ml
61 Kannada kn
62 Burmese my
63 Kazakh kk
64 Turkmen tk
65 Afrikaans af
66 Punjabi pa
67 Belarusian be
68 Swahili sw
69 Mongolian mn

Answer returned:

{
   "_advertising_campaign_id_":{
      "id":_advertising_campaign_id_,
      "language":_campaign_language_,
      "name":"_advertising_campaign_name_",
      "status":{
         "id":_state_identifier_,
         "name":"_ad_campaign_status_name_",
         "reason":"_campaign_state"
      },
      "domainsFilter":{
         "filterType":"_domain_filter_type_",
         "domainsNames":[
            "_domain_1_",
            "_domain_2_",
            . . . . . . .
         ]
      },
      "ipsFilter":{
         "filterType":"_IP_filter_type_",
         "ips":[
            "IP_adress_1",
            "IP_adress_2",
            . . . . . .
         ]
      },
      "widgetsFilterUid":{
         "filterType":"_widget_filter_type_",
         "widgets":{
            " _widget_id_1":"[_widget_subid_1]",
            " _widget_id_2":"[_widget_subid_2]",
            " _widget_id_3":"[ _widget_subid_3]",

         }
      },
      "statistics":{
         "clicks":_counted_clicks_amount_for_today_,
         "wages":_funds_spent_for_today_
      }
   },
   ...........
}

Possible errors in this section:

[ERROR_TOO_MANY_CAMPAIGNS_USE_PARAMS_LIMIT_AND_START] - if the user has more than 500 campaigns and the optional limit parameter is not specified
[ERROR_MAX_LIMIT_PER_PAGE_500] - if the additional parameter limit is specified and it is more than 500

Status property indicates current campaign state and status.

Description of status value returned:

id

Description

1

Campaign is blocked due to end date

2

Campaign has reached total budget limit

3

Campaign has reached total clicks limit

4

Campaign is blocked by manager of client

5

Campaign is blocked due to negative balance

6

Campaign is unlimited and active

7

Campaign hasn't reached its daily limit

8

Yesterday campaign has reached its daily clicks or budget limit and is active

9

Campaign has reached its daily budget limit

10

Campaign has reached its daily clicks limit

11

Campaign is paused due to time schedule settings

12

Campaign stopped because the client delayed
13 Campaign stopped by manager
14 Campaign deleted
15 Campaign stopped because the client rejected
17 Campaign stopped due to conversion limit
19 Campaign stopped due to violation of the creativity rules

IpsFilter property displays the IP filter settings of an advertising campaign (teasers of this campaign should not be shown to visitors with this IP). _IP_filter_type_ can take the following values:
off - the filter is disabled
except - "except" filter  
ips - a list of IP address ranges for filtering as an array.  _spent_by_the_client_for_today_ in $

Getting advertising campaign statistics by site

Method GET
URL api.mgid.com/v1/goodhits/campaigns/_ad_campaign_ID_/quality-analysis/_uid_?token=_client's_token_

Transfered parameters (required parameters marked in red):

Parameters Values
token _client's_token_
campaignId _ad_campaign_ID_
dateInterval Period for which you need to get statistics. If interval is not specified, returns statistics for 90 days. Valid values are:

  • interval - need to specify startDate/endDate in format yyyy-mm-dd
  • all - all time
  • thisWeek - current week
  • lastWeek - last week
  • thisMonth - current month
  • lastMonth - last month
  • lastSeven - last 7 days
  • today - today
  • yesterday - yesterday
  • last30Days - last 30 days
uid _uid_. If specified, displays information only for this site.

Answer returned:

{  
 "_campaignId_":{
  "_dateInterval_":{  
     "_widgetUid_":{  
        "clicks":"_clicks_",
        "spent":"_spent_",
        "cpc":"_cpc_client_currency_",
        "qualityFactor": "_quality_factor_",
        "buy":"_conversions_at_the_buying_stage_",
        "buyCost":"_price_of_conversions_at_the_buying_stage_",
        "decision":"_conversions_at_the_decision_stage_",
        "decisionCost":"_price_of_conversions_at_the_decision_stage_",
        "interest":"_conversions_at_the_interest_stage_",
        "interestCost":"_price_of_conversions_at_the_interest_stage_",
        "sources": {
            "17": {
                   "clicks":"_clicks_",
                   "spent":"_spent_",
                   "cpc":"_cpc_client_currency_",
                   "qualityFactor": "_quality_factor_",
                   "buy":"_conversions_at_the_buying_stage_",
                   "buyCost":"_price_of_conversions_at_the_buying_stage_",
                   "decision":"_conversions_at_the_decision_stage_",
                   "decisionCost":"_price_of_conversions_at_the_decision_stage_",
                   "interest":"_conversions_at_the_interest_stage_",
                   "interestCost":"_price_of_conversions_at_the_interest_stage_",
            },
            "0": {
                  "clicks":"_clicks_",
                  "spent":"_spent_",
                  "cpc":"_cpc_client_currency_",
                  "qualityFactor": "_quality_factor_",
                  "buy":"_conversions_at_the_buying_stage_",
                  "buyCost":"_price_of_conversions_at_the_buying_stage_",
                  "decision":"_conversions_at_the_decision_stage_",
                  "decisionCost":"_price_of_conversions_at_the_decision_stage_",
                  "interest":"_conversions_at_the_interest_stage_",
                  "interestCost":"_price_of_conversions_at_the_interest_stage_",
            }
        }
     }
  }
}

If there are some errors:

{"errors":["[_error_]"]}
[WIDGETS_WITH_THESE_IDS_DO_NOT_EXIST] - widgets with given uid do not exist, if there are valid uid in the list - they will be written to the database

{
"id":_campaignId_, 
"errors":"[WIDGETS_WITH_THESE_IDS_DO_NOT_EXIST]",
"data":["1000000","111111"]
}

Advertising campaigns detailed daily statistics

Method GET
URL api.mgid.com/v1/goodhits/campaigns/_adcampaign_id_/statistics?token=_client's_token_


Transferred parameters (required parameters are marked in red):

Parameters Value
type Statistics type. Values:  byClicksDetailed
date Format date: YYYY-MM-DD


Returned values:
If the request is correctly, it returns an array of data in the next format:

{
   "id":_ad_campaign_ID_,
   "statistics":{
      "summary":{
         "numberOfClicks":_total_number_of_clicks_,
         "numberOfAcceptedClicks":_ enrollment_clicks _,
         "fundsEarned":_spent_clicks _,
         "numberOfRejectedClicks":_not_couted_clicks_,
         "numberOfShows":_total_number_of_shows_
      },
      "acceptedClicks":[
         {
            "time":"_click_time_",
            "ip":"_ip_address_",
            "referer":"_referrer_",
            "teaserId":"_id_teaser_",
            "informerId":"_site_id__",
            "country":"_two_letter_country_code",
            "region":"_region_",
            "price":"_click_price_"                  // _click_price_/1000 = USD
         },
         ….
      ]
   }
}

Advertising campaigns daily statistics

Метод GET
URL api.mgid.com/v1/goodhits/clients/{clientId}/campaigns-stat?token={accessToken}

Transferred parameters:

Parameter Value
token client's token
dateInterval

Period for which you need to get statistics. If interval is not specified, returns statistics for 90 days. Valid values are:

  • interval - need to specify startDate/endDate in format yyyy-mm-dd
  • all - all time
  • thisWeek - current week
  • lastWeek - last week
  • thisMonth - current month
  • lastMonth - last month
  • lastSeven - last 7 days
  • today - today
  • yesterday - yesterday
  • last30Days - last 30 days

Answer:

"_campaign_id_":{
   "campaign_id":_campaign_id_,
   "imps":_imps_,
   "clicks":_clicks_,
   "spent":_spent_,
   "avcpc":_average_cpc_
}

If the customer has conversion settings - additional data transferred:

  • buy - quantity of buying conversions
  • buyCost - cost of buying
  • decision - quantity of decision conversions
  • decisionCost - cost of decision
  • interest - quantity of interest conversions
  • interestCost - cost of interest
  • convertionCost - conversions profit
  • revenue - revenue
  • epc - earn per click
  • profit - revenue - spent

If there are some errors:

{"errors":["[_error_]"]}
[THERE_NO_DATA_IN_CHOSEN_PERIOD] - if there is no data in chosen period

[INVALID_VALUE_FOR_INTERVAL] - invalid value for interval

Creating a new ad campaign (with all settings)

Method POST
URL api.mgid.com/v1/goodhits/clients/_client_ID_/campaigns?token=_client's_token_

Transferred parameters (red - required; blue - required, if parent parameter transferred):

Section 1

Parameters Value
name Campaign name. Must be unique for the client. 128 symbols max.
enabledGeoTargetingFlag Flag on/off GeoTargeting
geoTargets List of countries and cities (regions) for targeting. Example:

{'method':'set','cities':['2'],'countries':['ru']}

startDate Campaign start date YYYY-MM-DD
language ad campaign language_code
languageTargets Filter by language_code of an ad campaign in include mode
campaignType product/content/push. If campaign_type didn't transfer campaign_type = product

Possible errors for this section:

[ADVERTISE_NAME_EXISTS]
[CAMPAIGN_NAME_TOO_LONG]
[ERROR_PARAMETER_ENABLED_GEO_TARGETING_FLAG_CAN_NOT_BE_EMPTY]
[ERROR_PARAMETER_GEO_TARGETS_CAN_NOT_BE_EMPTY]
[ERROR_INVALID_PARAMETER]
[ERROR_WRONG_DATE_FORMAT]
[ERROR_NOT_VALID_CAMPAIGN_TYPE]
[ERROR_PARAMETER_LANGUAGE_TARGETS_VALUE_INVALID]
[ERROR_PARAMETER_LANGUAGE_TARGETS_EMPTY]

 

Section 2
If at least one of the utm_source, utm_campaign, utm_medium transferred, then all three are required

Parameters Value
utm_source 0, 9, A Z, a z, _ + & = (up to 200 symbols)
utm_campaign 0, 9, A Z, a z, _ + & = (up to 200 symbols)
utm_medium 0, 9, A Z, a z, _ + & = (up to 200 symbols)
utm_custom Macroses: {widget_id}/{teaser_id}/{campaign_id}/{category_id} etc

Possible errors for this section:

[UTM_TAGGING_FIELDS_MUST_NOT_BE_EMPTY]
[UTM_CUSTOM_TOO_LONG_STR]
[WRONG_UTM_CUSTOM_FORMAT]
[UTM_MEDIUM_TOO_LONG_STR]
[UTM_SOURCE_TOO_LONG_STR]
[UTM_CAMPAIGN_TOO_LONG_STR]

 

Section 3
If limitType parameter transferred, then limit type must be specified (day or total)

Parameters Value
limitType

clicks_limits - limit on clicks, budget_limits - limit on budget

dailyLimit

Setting the limit per day.

For clicks_limits  must be an integer value. Min  50. If a value is empty - campaign has no limits.

For budget_limits  The value of 2 characters after the decimal point (up to hundredths).

overallLimit

Setting the limit on the campaign in general.

For clicks_limits – must be an integer value and more than a dailyLimit, if specified. If value is empty - campaign has no limits.

For budget_limits value with 2 characters after the decimal point (up to hundredths). Must be more than a dailyLimit, if specified. If value is empty - campaign has no limits.

splitDailyLimitEvenly Option of evenly daily traffic distribution. 0 - on, 1 - off

Possible errors for this section:

[NOT_ENOUGH_PARAMETERS]
[ERROR_NOT_VALID_TYPE]
[ERROR_GREATER_THAN_LIMIT_PER_DAY]
[MINIMAL_DAILY_BUDGET_LIMIT_ERROR]
[WRONG_USE_FLOATING_LIMIT]
[ERROR_SPLIT_DAILY_LIMIT_EVENLY_IS_AVAILABLE_IF_ONLY_DAILY_LIMIT_SET]
[ERROR_MINIMAL_DAILY_CLICKS_LIMIT_IS_ %]
[ERROR_MINIMAL_DAILY_BUDGET_LIMIT_IS_ %]
[ERROR_OVERALL_CLICKS_LIMIT_LESS_THAN_DAILY_LIMIT]
[ERROR_OVERALL_BUDGET_LIMIT_LESS_THAN_DAILY_LIMIT]

 

Section 4

Parameters Value
browserTargets _browser1_, _browser2_, _browser3_
osTargets _os1_,_os2_,_os3_

Possible errors for this section:

"[ERROR_NO_ENOUGH_PARAMETERS]"

Answer returned:

{
     "id":_campaign_id_,
}

Creating a new ad campaign

Method POST
URL api.mgid.com/v1/goodhits/clients/_client_ID_/campaigns?token=_client's_token_

Transferred parameters (required parameters are marked in red):

Parameters Values
name Campaign name. Must be unique for the client
enabledGeoTargetingFlag Flag on/off GeoTargeting
geoTargets
List of countries and cities (regions) for
(parameter is required if targeting:
enabledGeoTargetingFlag =1)
{'method':'set','cities':['2'],'countries':['ru']}
language ad campaign language_code
languageTargets Filter by language_code of an ad campaign in include mode
startDate campaign start date YYYY-MM-DD
campaignType product/content/push. If parameter didn't send campaign_type = product

Answer returned:

{
  "id":_campaign_ID_,
}

If there already exists an ad campaign with the name specified in the request, then new campaign will not be created and system return error:

{
"errors":
[ "[ADVERTISE_NAME_EXISTS]" ]
}

UTM markup settings for ad campaign

Method PUT
URL api.mgid.com/v1/goodhits/campaigns/_campaign_ID_/utmtracking/?token=_client's_token

Transferred parameters:

Parameters Value
utm_source Standard setting Google Analytics to track traffic source
utm_campaign Standard setting Google Analytics to track purchases traffic campaign
utm_medium Standard setting Google Analytics to track traffic channel
utm_custom Custom markup. Ability to specify custom settings, which
will be added to the links campaign teaser

Values for Google Analytics (utm_source, utm_campaign, utm_medium) must be given a single query. If you are using one of the this parameters, other are required. Error if one of values is empty: [UTM_TAGGING_FIELDS_MUST_NOT_BE_EMPTY]  
When you specify the default settings Google Analytics also automatically added utm_content and utm_term . In tag utm_content  automatically substituded ID ads.  utm_term=_site_ID_

Utm_custom , should not exceed 200 characters, or system return error:  [UTM_CUSTOM_TOO_LONG_STR]  

Valid characters are: 0 9, A Z, a z,   _ + & = . And macros: {widget_id},  {teaser_id}, {campaign_id}, {category_id}.  

Or system return error:  [WRONG_UTM_CUSTOM_FORMAT]
If you pass an empty field markup is disabled. If the settings are saved successfully, system return campaign ID:

{
  "id":_campaign_ID_
}

Setting limits on advertising campaign

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_client_ID_/campaigns/_campaign_ID_?token=_clients_token_


Transferred parameters send in the body of the request (required parameters marked in red):

Parameters Value
limitType clicks_limits - clicks limit

budget_limits - budget limit

dailyLimit Setting the limit per day.

For clicks_limits  must be an integer value. Min  50. If a value is empty - campaign have no limits.

For budget_limits  The value of 2 characters after the decimal point (up to hundredths).

overallLimit Setting the limit on the pampaign in general.

For clicks_limits – must be an integer value and more than a dailyLimit, if specified. If value is empty - campaign have no limits.

For budget_limits value with 2 characters after the decimal point (up to hundredths). Must be more than a dailyLimit, if specified. If value is empty - campaign have no limits.

splitDailyLimitEvenly

Option of evenly daily traffic distribution. 0 - on, 1 - off

  • The daily limit can not be less than $10
  • The total limit can not be less than the daily limit
  • Step limit - 1 cent

A system returns  _campaign_ID_ if  all done:

{
  "id":_campaign_ID_
}


Block / unblock advertising campaign

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_client_ID_/campaigns/_campaign_ ID_?token=_clients_token_


Transferred parameters send in the body of the request:

Parameters Value
whetherToBlockByClient 0 – unlock ad campaign
1 — lock ad campaign
blockByClientReason

(if whetherToBlockByClient=1, then required parameter  )  

_blocking reason_

Getting creation date of ad campaign

Method GET
URL api.mgid.com/v1/goodhits/clients/_client's_accont_ID_/campaigns/_ad_campaign_ID_?token=_clients_token_&fields=['whenAdd']

Transferred parameters:

Parameter Value
fields whenAdd

Answer returned:

{
 "id":_ad_campaign_ID_,
 "whenAdd":_campaigns_creation_date_
}

Setting the coefficient of a selective auction of an advertising campaign

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_clientID_/campaigns/_campaignID_?token=_clients_token_

Transferred parameters send in the body of the request (required parameters marked in red):

Parameters Values
qualityFactor Contains a widgetUID and a new quality factor on the site. There can be several pairs in json format: {"_widgetUid1_":_qf1_,"_widgetUid2_s_sourceId2_":_qf2_,"_widgetUid3_":_qf3_}

Answer returned:

{  
 "id":_ad_campaign_ID_"
}

Possible errors:

  • ERROR_CAMPAIGN_USES_AUTORETARGETING_CANT_CHANGE_QF- autoretargeting is on
  • ERROR_CAMPAIGN_USES_PRICE_OPTIMIZATION_CANT_CHANGE_QF- autooptimization is on
  • ERROR_CAMPAIGN_IS_DSP_CANT_CHANGE_QF- DSP campaign
  • ERROR_QUALITY_FACTOR_INVALID_FORMAT - wrong data format in parameter qualityFactor
  • ERROR_WIDGETUID_INVALID_FORMAT - wrong data format in parameter _widgetUid2_or _widgetUid2_s_sourceId2_

Setting the coefficient of a selective auction to all sub-sources

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_clientID_/campaigns/_campaignID_?token=_clients_token_

Transferred parameters send in the body of the request (required parameters marked in red):

Parameters Values
widgetQualityFactor It contains a widgetUID and a new quality factor. Applies a source value to all its sub-sources. There can be several pairs in json format: {"_widgetUid1_":_qf1_,"_widgetUid2_":_qf2_,"_widgetUid3_":_qf3_}

Answer returned:

{  
 "id":_ad_campaign_ID_"
}

Possible errors:

  • ERROR_CAMPAIGN_USES_AUTORETARGETING_CANT_CHANGE_QF- autoretargeting is on
  • ERROR_CAMPAIGN_USES_PRICE_OPTIMIZATION_CANT_CHANGE_QF- autooptimization is on
  • ERROR_CAMPAIGN_IS_DSP_CANT_CHANGE_QF- DSP campaign
  • ERROR_WIDGET_QUALITY_FACTOR_INVALID_FORMAT - wrong data format in parameter widgetQualityFactor
  • ERROR_WIDGETUID_INVALID_FORMAT - wrong data format in parameter _widgetUid2_

Advertising campaigns targeting settings

Setting up the geo targeting of advertising campaigns

Getting geotargeting settings ad campaign of client:

Method GET
URL api.mgid.com/v1/goodhits/campaigns/_campaign_ID_/targetings/geo?token=_client's_token_

Answer returned:

{
   "targets":    {
      "actual":{
         "countries":{
            "_country_code_":{
               "code":"_ country_code _",
                "name":"_country_name_",
                "cities":[
                  "_city_ID_":{
                     "id":_ city_ID _,
                      "name":"_name_of_city",
                      "normalizedName":"_ Latin_letters_name _"                       
                  },
                  .......
               ]
            }            ......
         }
      },
      "requested":{
         "countries":{
            "_country_code_":{
               "code":"_country_code_",
                 "name":"_country_name_",
                 "cities":[
                  "_city_ID_":{
                     "id":_ city_ID _,
                       "name":"_ name_of_city_",
                       "normalizedName":"_ Latin_letters_name_"
                  },
                  .......
               ]
            }
         }
      }
   }
}

Section "actual"  contains the current geotargeting.  Section "request"  updated geotargeting settings that will be applied (or in the near future, or from the following day). If geotargeting settings are not used, it returns an answer like:

{
   "targets":{
      "actual":{
         "countries":[

         ]
      },
      "requested":{
         "countries":[

         ]
      }
   }
}

Getting a list of available countries for setting up geo targeting

Method GET
URL api.mgid.com/v1/dictionaries/geo?token=_client's_token_


Transferred parameters:

Parameter Value
type countries

Returns an array of countries that can be used for setting geotargeting:

[
   {
      "code":"_ two_letter_country_code _",
      "name":"_country_name_"
   },
   .....
]

Getting a list of available regions (cities) for geo targeting settings

Method GET
URL api.mgid.com/v1/dictionaries/geo?token=_client's_token_

Transferred parameters:

Parameters Value Comments
type cities
countries ['_ two_letter_country_code _', ....] An array of country codes for which you need to get a cities (regions) list.


Returns an array of regions (cities) that can be used for geo targeting:

[
   {
      "id":_city_ID_,
      "name":"_city_name_",
      "normalizedName":"_ name of city_Latin_Letters _",
      "countryCode":"_ two_letter_country_code _"
   },
   ......
]

Editing geo targeting settings for advertising campaign

Method PUT
URL api.mgid.com/v1/goodhits/campaigns/_campain_ID_/targetings/geo?token=_client's_token_


Transferred parameters:

Parameter Value
targets The list of countries and cities (regions) for targeting:
{ 'method':'set', 'cities': [ _city_ID_, . . . . . ], 'countries': [ two_letter_country_code _,  . . . . . . ] }If filled cities and countries in the priority will be countries parameter.
enabledFlag Flag on/off geo targeting(1/0)


If the request is correct, will be returned  ID edited ad campaign:

{
 "id":_campaign_ID_
}

If you do not specify any parameters or configured incorrectly, the changes  
settings will not be saved and will return an error message:

{
   "errors":[
      "[ERROR_NO_ENOUGH_PARAMETERS]"
   ]
}

Editing advertising campaign browser targeting

Method PUT
URL api.mgid.com/v1/goodhits/campaigns/_ad_campaign_ID_/targetings/browsers?token=_client's_token_


Transferred parameters:

Parameter Value
targets _ editing_method_ , _ browser_,_ browser_.....
enabledFlag 0 – target off, 1 — target on

Possible values for the  _editing_method_ :
include- inclusion of a browser in the list for targeting

Possible values for _browser_ :

Name Value
Google Chrome chrome
Safari safari
Opera Mini operamini
Opera Mobile operamoblie
Opera opera
Firefox firefox
Internet Explorer msie
Others others

Upon successful saving settings system returns campaign ID:

{
 "id":_campaign_ID_
}

Editing advertising campaign IP targeting   

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_client_ID_/campaigns/_ad_campain_ID_?token=_clients_token_


Transferred parameters send in the body of the request (required parameters marked in red):

Parameter Value
ipsFilter _ editing_methods _ , _filter_type_, IP1,IP2....


Settings:

  • Editing methods:
    • include include an address in the list
    • exclude remove an address from the list
  • Filter type :
    • except  
    • only
    • off – filter off

IP can be specified as single or as subnets (192.168.0.1/24)

Upon successful saving settings system returns campaign ID:

{
 "id":_campaign_ID_
}

Editing advertising campaign operating system targeting

Method PUT
URL api.mgid.com/v1/goodhits/campaigns/_ad_campaign_ID_/targetings/operatingsystems?token=_client's_token_


Transferred parameters:

Parameter Value
enabledFlag on/off OS targeting,  on=1, off=0
targets _editing_method_,_os_code1_,_os_code2_,_os_code3_

Operating systems:  

id name version os_code
8 Windows OS Other windowsos
9 Mac OS Other macos
10 Other Desktop OS otherdesctop
11 Android 2.2 and lower android22mobile
12 Android 2,3 android23mobile
13 Android 3.хх android3mobile
14 Android 4 android40mobile
15 Android 4,1 android41mobile
16 Android 4,2 android42mobile
17 Android 4,3 android43mobile
18 Android 4,4 android44mobile
19 iOS 4.хх and lower ios4mobile
20 iOS 5.хх ios5mobile
21 iOS 6.хх ios6mobile
22 iOS 7.хх ios7mobile
23 iOS 8.хх ios8mobile
24 Other Mobile OS othermobile
25 Android 2.2 and lower android22tablet
26 Android 2,3 android23tablet
27 Android 3.хх android3tablet
28 Android 4 android40tablet
29 Android 4,1 android41tablet
30 Android 4,2 android42tablet
31 Android 4,3 android43tablet
32 Android 4,4 android44tablet
33 iOS 4.хх and lower ios4tablet
34 iOS 5.хх ios5tablet
35 iOS 6.хх ios6tablet
36 iOS 7.хх ios7tablet
37 iOS 8.хх ios8tablet
38 Other Tablet OS othertablet
39 Android 5.xx android50mobile
40 Android 5.xx android50tablet
41 iOS 9.хх ios9tablet
42 iOS 9.хх ios9mobile
43 Android 6.xx android60mobile
44 Android 6.xx android60tablet
45 iOS 10.хх ios10mobile
46 iOS 10.хх ios70tablet
47 Android 7.xx android70tablet
48 Android 7.xx android70mobile
50 iOS 11.xx ios11mobile
51 iOS 11.xx ios11tablet
53 Android 8.xx android80mobile
54 Android 8.xx android80tablet
55 Android 9.xx android90mobile
56 Android 9.xx android90tablet
57 iOS 12.xx ios12mobile
58 iOS 12.xx ios12tablet
59 Android 10.хх android10mobile
60 Android 10.хх android10tablet
61 iOS 13.хх ios13mobile
62 iOS 13.хх ios13tablet
63 Windows OS 10 windowsos10
64 Windows OS 8,1 windowsos81
65 Windows OS 8 windowsos8
66 Windows OS 7 windowsos7
67 Windows OS Vista windowsosvista
68 Windows OS XP windowsosxp
69 Mac OS 10.12 Sierra macos1012
70 Mac OS 10.13 High Sierra macos1013
71 Mac OS 10.14 Mojave macos1014
72 Mac OS 10.15 Catalina macos1015
73 Other Smart TV othersmarttv
74 Android androidsmarttv
75 Fire OS (Amazon) fireossmarttv
76 tvOS (Apple TV) tvossmarttv
77 Tizen tizenossmarttv
78 webOS webossmarttv

Editing methods :
include - add OS to the list
exclude - remove OS from the list
Upon successful saving settings system returns campaign ID:

{
 "id":_campaign_ID_
}

Editing the filter settings on the sites for advertising campaign by UID

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_client_ID_/campaigns/_ad_campaign_ID_?token=_clients_token_

Transferred parameters send in the body of the request:

Parameter Value
widgetsFilterUid editing_method, filter_type, uid1,uid2…

you can send sub-source parameters in brackets filter_type, uid1(subid subid sibid),uid2… or through "s" filter_type, UID1sSUBID1...

block-widget-priority

For the edit method include, when it receives a request to add sub_id, it checks whether the source is added to the filter, if added, then the record of the source is ignored. Thus, using this parameter, you can slightly change the query processing logic.

Request example:

api.mgid.com/v1/goodhits/clients/{client id}/campaigns/{campaign id}?token={token}&widgetsFilterUid=include, only, {uid id}s{subid id}&block-widget-priority

Editing methods:

  • include - include in list
  • exclude - exclude from the list

Filter types:

  • only
  • except
  • off


On success - returns the identifier of editable ad campaign

{"id":_ad_campaign_ID_}

Example response with errors in the data - sites not transferred:

{"errors":["[WIDGETS_IDS_CANNOT_BE_EMPTY]"]}

Example response with errors in the data - non-existing sites id transferred:

{"errors":["[WIDGETS_WITH_THESE_IDS_DO_NOT_EXIST]"],"data":["1000000001000"]}

Example response with errors in the data - filter parameters not transferred(include|exclude,off|only|except) or transferred in wrong way:

{"errors":["[ERROR_NOT_VALID_FILTER_TYPE]"]}

If transfered valid & non-valid IDs ("widgetsFilter": "include, only, ttttts1, 5676301111, 5676672rrr, eeeeee") - valid IDs will be written in database, for non-valid will be the answer with a list of non-valid IDs:

{"id":_ad_campaign_ID_, "errors":"[WIDGETS_WITH_THESE_IDS_DO_NOT_EXIST]","data":["ttttts1","5676672rrr","eeeeee"]}

When sites not passed - it's a non-valid situation.

Working with client's teasers

Constants and identifiers in use

Currency code to display the price of the product:

id combname name_utf
1 rub руб
4 uah грн
5 usd $
6 eur
9 byn руб
12 inr
23 ils
35 gel
38 kzt
43 aed د.إ
46 inr


Teaser status:

Status Description
onModeration Teaser on moderation
rejected Teaser is rejected
active Teaser is active
new New teaser, don't have CTR yet
goodPerformance Teaser is in shows
badPerformance Teaser have no shows in one or more regions because have low rating. It is necessary to set a higher price per click or replace the teaser on the other, which could provide a higher CTR
blocked Blocked teaser
campaignBlocked Blocked campaign

Getting a list of client teasers

Method GET
URL api.mgid.com/v1/goodhits/clients/_client_ID_/teasers[/_teaser_ID_]


If _teaser_ID_ is not passed, then method returns a list of client teasers. If _teaser_ID_ is passed, then method returns information about current teaser.

Transferred parameters (required parameters are marked in red):

Parameters Value
token _client's_token_
fields
(optional, use if passed _teaser_ID_)
Array of teaser properties, information
about which  necessary to obtain(for example:
fields=['title','url','statistics']).  If the parameter is not passed, then returns  all  Properties.
status Takes values from the table "Teaser statuses"; You can specify several statuses simultaneously (for example: status = ['active', 'onModeration']) to get all teasers with these statuses.
campaign Getting a list of client's teasers by campaign ID
limit limiting the number of teasers displayed on the page. If doesn't set - shows all teasers. Possible error when using the option limit: ["[ERROR_MAX_LIMIT_PER_PAGE_{max_allowed_limit}]"]
start sets the position of the element. Default - 0. For example: at the first request start = 0 limit = 700, the next request will be: start = 700 limit = 700. 

Answer returned:

{  
"_teaser_ID_":
        {
         "id":"_teaser_ID_",
         "title":"_teaser_titel_",
         "advertText":"_advertising text teaser_",
         "url":"_ advertising_link_",
         "imageLink":"_link_to_teaser_image_",
         "cropLeft":"_cropping_the_image_on_the_left _",
         "cropTop":"_cropping_the_image_on_top _",
         "cropWidth":"_width_of_cropping_part_",
         "priceOfClickByLocations":                
                [{"locationId":"_geo_group_id_",
                "locationName":"_geo_group_name_",
                "priceOfClick":"_price_of_click_by_geo_group_"},...]

         "goodPrice":_product_price_,
         "goodOldPrice":_ old_product_price _,
         "currency":_ currency_ID_to_display_the_price_of_product_,
         "category":
                 {
                "id":"_category_ID_", "name":"_category_name_"
                },
         "campaignId":_campaign_ID_,
         "status":"_teaser_status_",
         "reason_if_drop_karantin": _reason_rejection_ (displayed if teaser a rejected),
         "statistics":
                 {
                 "clicks":_total_clicks_,
                 "clicks_today": _today_clicks_,
                 "clicks_yesterday": _yesterday_clicks_,  
                 "hits":_total_shows_,
                 "hits_today": _today_shows_,
                 "hits_yesterday": _yesterday_shows_,  
                 "spent":_spent_all_,
                 "spent_today":_spent_today_,
                 "spent_yesterday":_spent_yesterday_,
                 "ctr":"_teaser_CTR_",

         "ctr_by_locations":          
                [{"locationId":"_geo_group_id_",
                "locationName":"_geo_group_name_",
                "ctr":"_ctr_by_geo_group_"},...]

           },

         "conversion":
                {
                "interest_all": _number_of_achievements_interest_stage_ for_all_time_,
                "decision_all":  _number_of_achievements_decision_stage_ for_all_time_,
                "buying_all":  _number_of_achievements_buying_stage_ for_all_time_,
                "interest_yesterday": _number_of_achievements_interest_stage_ for_yesterday_,
                "decision_yesterday": _number_of_achievements_decision_stage_ for_yesterday_,
                "buying_yesterday": _number_of_achievements_buying_stage_ for_yesterday_

         }
        },
"_teaser_ID_2_":
{ . . . . . . },
. . . . . . . . . }

Creating a new teaser for ad campaign

Method POST
URL api.mgid.com/v1/goodhits/clients/_client_ID_/teasers?token=_clients_token_


Transfered parameters (required parameters are marked in red must be transferred in POST method body)

Parameters Value
url URL advertising links. It's recommended to use %26 instead of & during parameters transmission
campaignId Campaign ID to which is teaser added
title Teaser title

  • for content/product campaign type - up to 65 characters
  • for push campaign type - up to 30 characters
advertText Advertising text. If this parameter is passed in the request, the validation will be as follows:

  • for content/product campaign type - up to 75 characters (optional)
  • for push campaign type - up to 40 characters (required)

If the parameter has not been passed, it will not be changed.

imageLink Link to teaser image. Minimum size 492x328 pixels
category Teaser category ID
priceOfClick Price per click, cents, with tenths. As a separator
between the whole number and the fraction can use a comma or period.

cropWidth

The size of rectangle in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. cropWidth cannot be less than 492px. If cropLeft is filled, then cropWidth cannot be less than cropWidth + cropLeft and cannot be larger than the image width imageLink

cropTop

The offset of rectangle from the top edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. If parameter transferred - it can be 0, but can not be less than the height of the image imageLink minus 328px. If the parameter wasn't transferred it is set to 0.

cropLeft

The offset of rectangle from the left edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. If parameter transferred - it can be 0, but cropWidth + cropLeft cannot be larger than the image width ImageLink. If the parameter wasn't transferred it is set to 0.

cropWidthQuadratic

The size of square in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. cropWidthQuadratic cannot be less than 328px. If cropLeftQuadratic is filled, then cropWidthQuadratic cannot be less than cropWidthQuadratic + cropLeftQuadratic and cannot be greater than the width of the image imageLink

cropTopQuadratic

The offset of square from the top edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. If parameter transferred - it can be 0, but can not be less than the height of the image imageLink minus 328px

cropLeftQuadratic

The offset of square from the left edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. If parameter transferred - it can be 0, but cropWidthQuadratic + cropLeftQuadratic can not be larger than the image width imageLink

whetherShowGoodPrice Flag display the price of goods (1/0)

If whetherShowGoodPrice = 1 parameters currency, goodPrice, goodOldPrice are required. If whetherShowGoodPrice = 0 then the following parameters will be ignored.

    currency Currency ID to display the price of the product
    goodPrice Price of the goods in a specified currency
    goodOldPrice Old price of the goods.

Categories list:

id name campaign_types parent_id
100 Automotive "product", "video", "push 0
101 Books and Literature "product", "video", "push 0
102 Events and Attractions "product", "video", "push 0
103 Events "product", "video", "push 102
104 Subscriptions "product", "video", "push 102
105 Casinos and Gambling "product", "video", "push 102
106 Family and Relationships "product", "video", "push 0
107 Marriage and Civil Unions "product", "video", "push 106
108 Dating "product", "video", "push 106
109 Pick up "product", "video", "push 106
110 Food and Drink "product", "video", "push 0
111 World Cuisines "product", "video", "push 110
112 Alcoholic Beverages "product", "video", "push 110
113 Healthy Living "product", "video", "push 0
114 Nutrition "product", "video", "push 113
115 Weight Loss "product", "video", "push 113
116 Women's Health "product", "video", "push 113
117 Children's Health "product", "video", "push 113
118 Fitness and Exercise "product", "video", "push 113
119 Wellness "product", "video", "push 113
120 Alternative Medicine "product", "video", "push 119
121 Smoking Cessation "product", "video", "push 119
122 Muscle Building "product", "video", "push 119
123 Brain Booster "product", "video", "push 119
124 Home and Garden "product", "video", "push 0
125 Home Appliances "product", "video", "push 124
126 Home Security "product", "video", "push 124
127 Home Improvement "product", "video", "push 124
128 Gardening "product", "video", "push 124
129 Medical Health "product", "video", "push 0
130 Diseases and Conditions "product", "video", "push 129
131 Sleep Disorders "product", "video", "push 130
132 Diabetes "product", "video", "push 130
133 Varicosis "product", "video", "push 130
134 Bone and Joint Conditions "product", "video", "push 130
135 Eye and Vision Conditions "product", "video", "push 130
136 Psoriasis "product", "video", "push 130
137 Papilloma "product", "video", "push 130
138 Skin and Dermatology "product", "video", "push 130
139 Medical Services "product", "video", "push 130
140 Other Treatment "product", "video", "push 130
141 Foot Health "product", "video", "push 130
142 Parasites "product", "video", "push 130
143 Hemorrhoid "product", "video", "push 130
144 Prostatitis "product", "video", "push 130
145 Sexual Health "product", "video", "push 130
146 Personal Finance "product", "video", "push 0
147 Personal Investing "product", "video", "push 146
148 Stocks and Bonds "product", "video", "push 147
149 Options "product", "video", "push 147
150 Insurance "product", "video", "push 146
151 Personal Debt "product", "video", "push 146
152 Financial Assistance "product", "video", "push 146
153 Retirement Planning "product", "video", "push 146
154 Real Estate "product", "video", "push 0
155 Shopping "product", "video", "push 0
156 For Kids "product", "video", "push 155
157 Gifts and Souvenirs "product", "video", "push 155
158 Services "product", "video", "push 155
159 Couponing "product", "video", "push 155
160 Sports "product", "video", "push 0
161 Sporting Goods "product", "video", "push 160
162 Fishing Sports "product", "video", "push 160
163 Style and Fashion "product", "video", "push 0
164 Beauty "product", "video", "push 163
165 Makeup and Accesories "product", "video", "push 164
166 Natural and Organic Beauty "product", "video", "push 164
167 Skin Care "product", "video", "push 164
168 Hair Care "product", "video", "push 164
169 Perfume and Fragrance "product", "video", "push 164
170 Other Beauty Products "product", "video", "push 164
171 Personal Care "product", "video", "push 163
172 Oral Care "product", "video", "push 171
173 Shaving "product", "video", "push 171
174 Women's Fashion "product", "video", "push 163
175 Women's Clothing "product", "video", "push 174
176 Women's Intimates and Sleepwear "product", "video", "push 175
177 Women's Outfits "product", "video", "push 175
178 Women's Accessories "product", "video", "push 174
179 Women's Jewelry and Watches "product", "video", "push 178
180 Other Women's Accessories "product", "video", "push 178
181 Women's Shoes and Footwear "product", "video", "push 174
182 Men's Fashion "product", "video", "push 163
183 Men's Сlothing "product", "video", "push 182
184 Men's Underwear and Sleepwear "product", "video", "push 183
185 Men's Outfits "product", "video", "push 183
186 Men's Accesories "product", "video", "push 182
187 Men's Jewelry and Watches "product", "video", "push 186
188 Other Men's Accesories "product", "video", "push 186
189 Men's Shoes and Footwear "product", "video", "push 182
190 Children's Clothing "product", "video", "push 163
191 Technology and Computing "product", "video", "push 0
192 Computing "product", "video", "push 191
193 Laptops "product", "video", "push 192
194 Desktops "product", "video", "push 192
195 Computer Peripherals "product", "video", "push 192
196 Computer Software and Applications "product", "video", "push 192
197 Consumer Electronics "product", "video", "push 191
198 Smartphones "product", "video", "push 197
199 Tablets and E-readers "product", "video", "push 197
200 Cameras and Camcorders "product", "video", "push 197
201 Wearable Technology "product", "video", "push 197
202 Energysavers "product", "video", "push 197
203 Self Defense "product", "video", "push 197
204 Solar Panels "product", "video", "push 197
205 Other Electronics "product", "video", "push 197
206 Travel "product", "video", "push 0
207 Video Gaming "product", "video", "push 0
208 Automotive "content" 0
209 Business and Finance "content", "push" 0
210 Careers "content", "push" 0
211 Education "content", "push" 0
212 Events and Attractions "content" 0
213 Family and Relationships "content" 0
214 Society "content" 213
215 Parenting "content" 213
216 Sex "content" 213
217 Fine Art "content", "push" 0
218 Food and Drink "content" 0
219 Cooking "content" 218
220 Alcoholic Beverages "content" 218
221 Healthy Living "content" 0
222 Wellness "content" 221
223 Nutrition "content" 221
224 Fitness and Exercise "content" 221
225 Hobbies and Interests "content", "push" 0
226 Amazing "content", "push" 225
227 Humor "content", "push" 225
228 Interests "content", "push" 225
229 Home and Garden "content" 0
230 Movies "content", "push" 0
231 Music and Audio "content", "push" 0
232 News and Politics "content", "push" 0
233 Politics "content", "push" 232
234 Crime "content", "push" 232
235 Disasters "content", "push" 232
236 News Russia "content", "push" 255
237 News Ukraine "content", "push" 255
238 Pets "content" 0
239 Pop Culture "content", "push" 0
240 Real Estate "content" 0
241 Science "content", "push" 0
242 Sports "content" 0
243 Style and Fashion "content" 0
244 Beauty "content" 243
245 Fashion Trends "content" 243
246 Body Art "content" 243
247 Technology and Computing "content" 0
248 Television "content", "push" 0
249 Travel "content" 0
250 Video Gaming "content" 0
251 Pets "product", "push 0
253 Business and Investing "product", "push" 0
254 Currencies "product", "push" 253
255 Local News "content", "push" 0
256 News India "content", "push" 255
257 International News "content", "push" 0

Answer returned:
Upon successful creation of the teaser response is returned:

{
 "id":_new_teaser_ID_,
}

Returns an error name  if try to creating teaser was failure:

{"errors":["[_ error_name_ _]"] }

The list of possible errors returned in the creation an editing teaser of campaign:

_ERROR_NAME_ specification
ERROR_PARAMETER_WHETHERSHO WGOODPRICE_CAN_NOT_BE_EMPTY Not passed a required parameter whetherShowGoodPrice
ERROR_PARAMETER_PRICEOFCLICK_ CAN_NOT_BE_EMPTY Not passed a required parameter priceOfClick
ERROR_PARAMETER_CATEGORY_CA N_NOT_BE_EMPTY Not passed a required parameter category
ERROR_ADVERT_TEXT_TOO_LONG Advertising text (parameter advertText) exceeds the maximum allowed length (no more than 75 characters)
ERROR_PARAMETER_TITLE_CAN_NO T_BE_EMPTY Not Transfered teaser title (required parameter title)
ERROR_TITLE_TOO_LONG Title teaser (parameter title) exceeds the maximum allowed length (no more than 65 characters)
ERROR_PARAMETER_IMAGELINK_CA N_NOT_BE_EMPTY Not assigned image link for the teaser (required parameter imageLink)
ERROR_PARAMETER_CAMPAIGNID_CA N NOT_BE_EMPTY Not transmitted campaign ID that creates teaser (required parameter campaignId)
ERROR_PARAMETER_URL_CAN_NOT_BE _EMPTY Not assigned to an advertising link to the teaser (required parameter url)
[ERROR_PARAMETER_CATEGORY_INCORRECT_FOR_THIS_CAMPAIGN_TYPE] Improperly selected category for this type of campaign

Editing ad campaign teaser settings

Method PUT
URL api.mgid.com/v1/goodhits/clients/_client_ID_/teasers/_teaser_ID_?token=_client's_token_


Transfered parameters (required parameters are marked in red):

Parameters Value
url URL advertising links
campaignId Campaign ID to which is teaser added
title Teaser title

  • for content/product campaign type - up to 65 characters
  • for push campaign type - up to 30 characters
advertText Advertising text. If this parameter is passed in the request, the validation will be as follows:

  • for content/product campaign type - up to 75 characters (optional)
  • for push campaign type - up to 40 characters (required)

If the parameter has not been passed, it will not be changed.

imageLink Link to teaser image. Minimum size 492x328 pixels
category Teaser Category ID

cropWidth

The size of rectangle in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. Can be empty.

cropTop

The offset of rectangle from the top edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. Can be empty.

cropLeft

The offset of rectangle from the left edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. Can be empty.

cropWidthQuadratic

The size of square in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. Can be empty.

cropTopQuadratic

The offset of square from the top edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. Can be empty.

cropLeftQuadratic

The offset of square from the left edge in pixels, that will be cut from uploaded image (imageLink) for the teaser's image creation. Can be empty.

whetherShowGoodPrice Flag display the price of goods (1/0)

If whetherShowGoodPrice = 1 parameters currency, goodPrice, goodOldPrice are required. If whetherShowGoodPrice = 0 then the following parameters will be ignored.

    currency Currency ID to display the price of the product
    goodPrice Price of the goods in a specified currency
    goodOldPrice Old price of the goods.

If any of the required parameters weren't passed, system returns error.

For example, not transmitted campaignId :

 {"errors":["[ERROR_PARAMETER_CAMPAIGNID_CAN_NOT_BE_EMPTY]"]}

If teaser on moderation, return error.

{"errors":["[ERROR_EDITING_TEASER_ON_MODERATION_NOT_PERMITTED]"]}

Changing advertising campaign teaser's CPC

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_client_ID_/teasers/_teaser_ID_?token=_clients_token_

Transferred parameters send in the body of the request:

Parameter Value
priceOfClickByLocation Installed CPC in tenth of cents for all geo groups. Can be used a period or comma as a delimiter.
priceOfClickByLocation_{geo_zones_groups_id} Installed CPC in tenth of cents for for a specific geo group. Can be used a period or comma as a delimiter.
geo_zones_groups_id iso name geo_zones_ids parent_id
32 US USA NULL
33 US The Midwest 197,204,205,207,211,219,220,224,227,231,232,242,316 32
34 US The North-East 195,196,199,200,201,203,214,216,217,315 32
35 US The West 198,212,215,225,229,234,236,237,240,241,243,244,245,318 32
36 US The South 202,206,218,208,209,210,213,221,222,223,226,228,230,233,235,238,239,317 32
37 US Other regions 246,247,248,249,250,4 32
38 GB United Kingdom 14,282 NULL
39 AU Australia 31 NULL
40 CA Canada 13 NULL
41 NZ New Zealand 50 NULL
42 L1 Latin America NULL
43 AR Argentina 40 42
44 VE Bolivarian Republic of Venezuela 88 42
45 BR Brazil 41 42
46 CL Chile 56 42
47 CO Colombia 57 42
48 CR Costa Rica 58 42
49 DO Dominican Republic 59 42
50 EC Ecuador 60 42
51 GT Guatemala 61 42
52 MX Mexico 42 42
53 PA Panama 77 42
54 PE Peru 78 42
55 BO Plurinational State of Bolivia 55 42
56 UY Uruguay 87 42
57 L1 Other countries 266 42
58 D1 German-speaking NULL
59 AT Austria 33 58
60 BE Belgium 28 66
61 DK Denmark 38 66
62 DE Germany 5 58
63 LI Liechtenstein 72 58
64 LU Luxembourg 74 58
65 CH Switzerland 34 58
66 E1 Europe NULL
67 AL Albania 53 66
68 HR Croatia 62 66
69 CY Cyprus 46 66
70 EE Estonia 11 66
71 FI Finland 22 66
72 GR Greece 25 66
73 IS Iceland 66 66
74 IE Ireland 23 66
75 IT Italy 20 66
76 LV Latvia 9 66
77 LT Lithuania 12 66
78 MC Monaco 75 66
79 ME Montenegro 273 66
80 NL Netherlands 29 66
81 NO Norway 30 66
82 PT Portugal 32 66
83 RS Serbia 81 66
84 SI Slovenia 83 66
85 SE Sweden 26 66
86 ES Spain 17 66
87 FR France 18 66
88 E1 Other countries 267,268 66
89 Eastern Europe NULL
90 BY Belarus 8 150
91 BG Bulgaria 263 89
92 C0 Crimea 108,281,314 150
93 CZ Czech Republic 262 89
94 HU Hungary 264 89
95 PL Poland 260 89
96 RO Romania 261 89
97 MD Republic of Moldova 10 150
98 RU Russia NULL
99 SK Slovakia 265 89
100 UA Ukraine NULL
101 A3 Arabic-speaking NULL
102 EG Egypt 44 101
103 IQ Iraq 64 101
104 JO Jordan 67 101
105 KW Kuwai 70 101
106 LB Lebanon 71 101
107 SA Saudi Arabia 82 101
108 SY Syrian Arab Republic 84 101
109 AE United Arab Emirates 39 101
110 QA Qatar 80 101
111 A3 Other countries 269,283,284,285,286,287,288,289,290,291,292,293,294,295 101
112 A1 Asia NULL
113 BD Bangladesh 54 112
114 CN China 24 112
115 KH Cambodia 69 112
116 HK Hong Kong 89 112
117 IN India 47 112
118 ID Indonesia 63 112
119 JP Japan 37 112
120 MY Malaysia 48 112
121 PK Pakistan 52 112
122 PH Philippines 79 112
123 KR Republic of Korea 35 112
124 LK Sri Lanka 73 112
125 SG Singapore 90 112
126 TW Taiwan 86 112
127 TH Thailand 49 112
128 VN Viet Nam 45 112
129 A1 Other countries 270 112
130 Western Asia NULL
131 AM Armenia 27 150
132 AZ Azerbaijan 16 150
133 IR Islamic Republic of Iran 65 130
134 IL Israel 7 130
135 GE Georgia 15 130
136 KZ Kazakhstan 6 150
137 KG Kyrgyzstan 36 150
138 TJ Tajikistan 43 150
139 TR Turkey 19 130
140 TM Turkmenistan 85 150
141 UZ Uzbekistan 21 150
143 A2 Africa NULL
144 KE Kenya 68 143
145 NG Nigeria 76 143
146 ZA South Africa 51 143
147 A2 Other countries 272 143
148 O1 Other countries 0,1 NULL
150 S1 CIS countries NULL
151 RU Far Eastern Federal District 168,124,278,258,183,137,93,127,274,111,188,300 98
152 RU Ural Federal District 155,123,121,115,104,169,301 98
153 RU Siberian Federal District 122,153,185,259,131,132,100,257,113,92,277,147,177,275,171,276,279,280,302 98
154 RU Southern Federal District 164,187,96,184,129,135,304 98
155 RU Northwestern Federal District 140,119,101,166,141,142,167,145,159,305 98
156 RU Central Federal District 181,161,146,106,125,109,163,174,143,134,162,95,126,144,139,103,306 98
157 RU North Caucasian Federal District 170,255,186,194,151,117,254,307 98
158 RU Moscow 94,251,308 98
159 RU Saint Petersburg 102,252,309 98
160 RU Other regions 3 98
161 UA Northern Ukraine 100
162 UA Central Ukraine 100
163 UA Southern Ukraine 100
164 UA Western Ukraine 100
165 UA Eastern Ukraine 100
166 UA Kyiv 112,253,313 100
167 UA Other regions 2 100
168 UA Donetsk 116 165
169 UA Lugansk 172 165
170 UA Kharkov 105 165
171 UA Volhynia 157 164
172 UA Zakarpattia Oblast 158 164
173 UA Ivano-Frankivsk 192,312 164
174 UA Lviv 193 164
175 UA Rivne 191 164
176 UA Ternopil 133 164
177 UA Khmelnytskyi 179 164
178 UA Chernivtsi 156 164
179 UA Zhytomyr 128,31 161
180 UA Sumy 175 161
181 UA Chernihiv 176 161
182 UA Vinnytsia 190,311 162
183 UA Dnipro 150 162
184 UA Kropyvnytskyi 160 162
185 UA Poltava 189 162
186 UA Cherkasy 178 162
187 UA Zaporizhia 173 163
188 UA Mykolaiv 182 163
189 UA Odessa 97 163
190 UA Kherson 99 163
191 RU Volga Federal District 152,180,118,165,138,136,154,107,114,256,130,98,120,149,110,148,303 98

Answer returned.
If all done correctly, system return an answer:

{ 
 "id":_teaser_ID_,
}

Some errors:
● if the parameter CPCs not specified or incorrect:

{"errors":["[EDIT_PRICE_REQUIRED_PRICES]"]}

● if the price is not indicated or specified is not a valid value:

{"errors":["[VALIDATION_NOT_FLOAT]","[VALIDATION_NOT_FLOAT]"]}

● if the price is less than minimum:

{"errors":["The price is not valid"]}

● if the price is higher than  maximum:

{"errors":["[LS_CAB_'51'_MORE_THAN_'50']","[LS_CAB_'51'_MORE_THAN_'50']"]}

 

Block / unblock a teaser for advertising campaign

Method PATCH
URL api.mgid.com/v1/goodhits/clients/_client_ID_/teasers/_teaser_ID_?token=_clients_token_


Transferred parameters send in the body of the request:

Parameters Value
whetherToBlockByClient 1 — block
0 — unblock

Answer returned.
If the operation is successful, it returns teaser ID:

{
 "id":"_teaser_ID_"
}

Removing teaser (move to bin)  

Method URL
DELETE api.mgid.com/v1/goodhits/clients/_client_ID_/teasers/_teaser_ID_?token=_client's_token_


Transferred parameters:

Parameters Value
reason A reason of Deleting. Max 225 symbol


Answer returned.
If the operation is successful, it returns teaser ID which was moved to bin:

{
 "id":"_teaser_ID_"
}

If a teaser with the specified ID does not exist in the system or have already been
moved to the bin, then the message will be returned:

[ERROR_RESOURCE_NOT_FOUND]