-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b517af2
commit eb7d615
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package tiktok | ||
|
||
/* | ||
Query Ads | ||
Use POST /v2/research/adlib/ad/query to query ads. | ||
HTTP URL | ||
https://open.tiktokapis.com/v2/research/adlib/ad/query/ | ||
curl -L -X POST 'https://open.tiktokapis.com/v2/research/adlib/ad/query/?fields=ad.id,ad.first_shown_date,ad.last_shown_date' \ | ||
-H 'Authorization: Bearer clt.example12345Example12345Example' \ | ||
-H 'Content-Type: application/json' \ | ||
--data-raw '{ | ||
"filters":{ | ||
"advertiser_business_ids": [3847236290405, 319282903829], | ||
"ad_published_date_range": { | ||
"min": "20210102", | ||
"max": "20210109" | ||
}, | ||
"country_code": "FR", | ||
"unique_users_seen_size_range": { | ||
"min": "10K", | ||
"max": "1M" | ||
}, | ||
}, | ||
"search_term": "mobile games" | ||
}' | ||
*/ | ||
func (o *tiktok) ResearchAdQuery(searchTerm string, ) { | ||
data := map[string]string{} | ||
data["fields"] = "ad.id,ad.first_shown_date,ad.last_shown_date" | ||
// | ||
request := &ResearchAdQueryRequest{ | ||
SearchTerm: searchTerm, | ||
} | ||
resp, err := o.restyPostWithQueryParams(API_RESEARCH_AD_QUERY, request, data) | ||
if err != nil { | ||
o.debugPrint(err) | ||
//return nil, err | ||
} | ||
/*if resp.IsError() { | ||
return nil, fmt.Errorf("client access token management error %s", resp.String()) | ||
}*/ | ||
o.debugPrint(resp) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package tiktok | ||
|
||
/*{ | ||
"filters":{ | ||
"advertiser_business_ids": [3847236290405, 319282903829], | ||
"ad_published_date_range": { | ||
"min": "20210102", | ||
"max": "20210109" | ||
}, | ||
"country_code": "FR", | ||
"unique_users_seen_size_range": { | ||
"min": "10K", | ||
"max": "1M" | ||
}, | ||
}, | ||
"search_term": "mobile games" | ||
}*/ | ||
|
||
type ResearchAdQueryRequest struct { | ||
Filters ResearchAdQueryFilter `json:"filters"` | ||
SearchTerm string `json:"search_term"` | ||
} | ||
|
||
type ResearchAdQueryFilter struct { | ||
AdvertiserBusinessIDs []int64 `json:"advertiser_business_ids"` | ||
AdPublishedDateRange AdPublishedDateRange `json:"ad_published_date_range"` | ||
CountryCode string `json:"country_code"` | ||
} | ||
|
||
type AdPublishedDateRange struct { | ||
Min string `json:"min"` | ||
Max string `json:"max"` | ||
} |