#!/bin/bash

tokens_file='/etc/direct-tokens/api_test_tokens'
client_login='lamodasem'
operator_login='at-direct-super'
oauth_token=$(grep $operator_login $tokens_file |awk '{print $2}' | head -n1)


SCRIPTPATH=`readlink -f $0`
SCRIPTDIR=`dirname $SCRIPTPATH`

source $SCRIPTDIR/beta_number

SERVICE_URL="$JSON_URL/adgroups"
#echo $SERVICE_URL

curl \
     -k \
    -H "Authorization: Bearer $oauth_token" \
    -H 'Accept-Language: da, en-gb;q=0.8, ru;q=0.6, en;q=0.7' \
    -H "Client-Login: $client_login" \
    -d '
  {
    "method":"add",
    "params": {
        "AdGroups" : [
            {
                "CampaignId" : 3346909,
                "Name" : "Group1",
                "NegativeKeywords" : [
                    "one",
                    "two",
                    "three"
                ]
            },
            {
                "CampaignId" : 3947153 ,
                "Name" : "Group2",
                "NegativeKeywords" : [
                    "one",
                    "two",
                    "three"
                ],
                "RegionIds" : [
                    0
                ]
            }
        ]
    }
  }' \
    "$SERVICE_URL"

echo
