Skip to content

Instantly share code, notes, and snippets.

@eftikharEmad
Last active March 1, 2022 07:48
Show Gist options
  • Save eftikharEmad/c429573358d66c6d2cc2dd8236af2fc2 to your computer and use it in GitHub Desktop.
Save eftikharEmad/c429573358d66c6d2cc2dd8236af2fc2 to your computer and use it in GitHub Desktop.
{
"openapi": "1.0.0",
"info": {
"title": "Google Ads API Web Service",
"version": "1.0"
},
"servers": [
{ "url": "https://api.server.test/v1" }
],
"paths": {
"/account-hierarchy": {
"get": {
"description": "Gets account hierarchy, ( all nested accounts, parents and their sub accounts )",
"parameters": [
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": { "type": "string" }
}
],
"responses": {
"schema": "json",
"params":[ {
"customer_id": { "type": "string", "desc": "customer client id" },
"name": { "type": "string", "desc": "customer client id" },
"parent_id": { "type": "string", "desc": "customer client owned account id" },
"parent_name": { "type": "string", "desc": "customer client owned account name" }
}]
}
}
},
"/reports/fetch-spending": {
"get": {
"description": "Gets ads fetching for date range",
"parameters": [
{
"name": "customer_id",
"description": "customer id, ex: 0123456789, this is the root account",
"required": true,
"schema": { "type": "string" }
},
{
"name": "start_date",
"format": "yyyy-MM-dd",
"description": "day at which fetch spending",
"required": true,
"schema": { "type": "date" }
},
{
"name": "end_date",
"format": "yyyy-MM-dd",
"description": "last day at which fetch spending",
"required": false,
"schema": { "type": "date" }
},
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": { "type": "string" }
}
],
"responses": {
"​schema": {"type": "json"},
"params":{
"entries": "Array of json",
"status": "ok",
"entry-sample":{
"impressions": {"type": "integer"},
"clicks": {"type": "integer"},
"cost": {"type": "integer", "desc": "in micro"},
"ad_group_id": {"type": "string"},
"ad_group": {"type": "string"},
"ad_group_status": {"type": "string"},
"day": {"type": "date"},
"campaign_id": {"type": "string"},
"campaign": {"type": "string"},
"campaign_status": {"type": "string"}
}
}
}
}
},
"/reports/test-fetch": {
"get": {
"description": "Test ads fetching",
"parameters": [
{
"name": "customer_id",
"description": "customer id, ex: 0123456789, this is the root account",
"required": true,
"schema": { "type": "string" }
},
{
"name": "start_date",
"format": "yyyy-MM-dd",
"description": "date for the fetching",
"required": true,
"schema": { "type": "date" }
},
{
"name": "end_date",
"format": "yyyy-MM-dd",
"description": "last date for the fetching, if not found it set as start_date",
"required": false,
"schema": { "type": "date" }
},
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": { "type": "string" }
}
],
"responses": {
"schema": { "type": "json" },
"params":{
"status": {"type":"string", "description": "ok, fail"}
"cost": { "type": "money", "unit": "micro dollar"}
}
}
}
},
"/reports/click-performance":{
"get": {
"description": "Google Clicks Preformance",
"parameters": [
{
"name": "customer_id",
"description": "customer id, ex: 0123456789, this is the root account",
"required": true,
"schema": { "type": "string" }
},
{
"name": "date",
"description": "date for the fetching",
"required": true,
"schema": { "type": "date" }
},
{
"name": "gclid",
"description": "used to link the visitor with gclid(google click id) with source ad group",
"required": true,
"schema": { "type": "string" }
},
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": { "type": "string" }
}
],
"responses": {
"schema": { "type": "json" },
"response":{
"status": "ok",
"results":{
"schema": { "type": "json" },
"params": {
"ad_group_id": {"type": "integer"},
"campaign_id": {"type": "integer"},
}
}
}
},
"faile response": {
"schema": { "type": "json" },
"response":{
"status": "failed",
"error": "return the error from the server"
}
}
}
},
"/campaigns": {
"get": {
"description": "Gets campaigns",
"parameters": [
{
"name": "customer_id",
"description": "formatted customer id, ex: 0123456789",
"required": true,
"schema": { "type": "string" }
},
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": { "type": "string" }
}
],
"responses": {
"status": "ok",
"entries": [
{"id": "campaign_id", "name": "campaign_name", "status": "campaign_status"}
....
]
}
}
},
"/campaign-criterions": {
"get": {
"description": "Gets campaign's criterions",
"parameters": [
{
"name": "customer_id",
"description": "customer id, ex: 0123456789",
"required": true,
"schema": { "type": "string" }
},
{
"name": "campaign_id",
"description": "campaign id",
"required": true,
"schema": { "type": "string" }
},
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": { "type": "string" }
}
],
"responses": {
"success": {
"schema": "json"
"sample": {
"status": "ok",
"criterions": {
"type": "Array",
"criterion_id": "integer",
"is_negative": "boolean",
"Format": ["criterion_id", "is_negative" ]
}
}
}
}
}
},
"/campaign-criterions": {
"post": {
"description": "Sets campaign's criterions",
"parameters": [
{
"name": "customer_id",
"description": "customer id, ex: 0123456789",
"required": true,
"schema": { "type": "string" }
},
{
"name": "operations",
"description": "campaign id",
"required": true,
"schema": {
"type": "array",
"operations list":[
"schema": {
"operator": ["Remove", "ADD"],
"operand":{
"campaign_id": "targted campaign id to be updated"
"criterion": {
"schema": "json",
"params": {
"id": "criterion id"
"xsi_type": "criterion type - Location"
}
},
"xsi_type": "criterion is negative or not "
}
},
"Remove criterion example": {
"operator": "REMOVE",
"operand": {
"campaign_id": 999999999,
"criterion": { "id": 1018306 }
}
},
"Add inclusion criterion example": {
"operator": "ADD",
"operand": {
"campaign_id": 999999999,
"criterion": { "id": 1018306, "xsi_type": "Location" }
}
},
"Add exclusion criterion example": {
"operator": "ADD",
"operand": {
"campaign_id": 999999999,
"criterion": { "id": 1018306, "xsi_type": "Location" },
"xsi_type": "NegativeCampaignCriterion"
}
}
]
}
},
{
"name": "company",
"description": "The calling client name, ex: RMDL, 33MR, KC",
"schema": {
"type": "string"
}
}
],
"responses": {
"type": "json"
"success-sample": ​{"status": "ok"}
"failur-sample": ​{"status": "faild", "error": "error message"}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment