Accessing Ads accounts | Docs | Twitter Developer Platform

文章推薦指數: 80 %
投票人數:10人

The authenticated Twitter user account making requests on the API is referred to as the 'current user.' A listing of advertising accounts that the current user ... AccessingAdsaccounts UseraccountsvsAdaccounts TherearetwodifferenttypesofaccountsinvolvedinusingtheAdsAPI: advertisingaccounts and Twitteruseraccounts.ThroughoutAdsAPIdocumentation,theterm“account”usuallyreferstotheadvertisingaccount. Advertisingaccountsareregisteredon ads.twitter.com andidentifiedintheAPIby account_id.AdvertisingaccountslinkdirectlytofundingsourcesandleveragecontentfromoneormoreTwitteruseraccountsas‘promotableusers’.EachadvertisingaccountcangrantpermissiontooneormoreTwitteruseraccounts.Theadvertisingaccount,or“currentaccount,”isrepresentedinnearlyeveryURLexecutedasanin-line :account_id parameter. Twitteruseraccounts(suchas@AdsAPI)areidentifiedby user_id intheAdsAPI.Oneormoreoftheseaccountscanbeassociatedwithanadvertisingaccount.TheauthenticatedTwitteruseraccountmakingrequestsontheAPIisreferredtoasthe‘currentuser.’Alistingofadvertisingaccountsthatthecurrentuserhasaccesstocanbefoundwith GETaccounts.‘Promotableusers’areTwitterhandlesthatcanbepromotedbyaspecificadvertisingaccount.Formoredetailsaboutthis,see ObtainingAdsAccountAccess.   MethodsforAdaccountaccess TherearetwomethodsyoucanusetomakeAdsAPIrequestsforanadvertiser’saccount: MakingrequestsonbehalfofanAdvertiser(recommended) Makingrequestsusingyouraccount thathasbeengrantedaccesstoanAdvertiser'saccount,e.g.anAgency supportingmultipleaccounts. Thisdocumentisabriefoverviewofthedifferencesbetweentheseoptionsandshouldbeusedinconjunctionwithourotherresources,suchasthemulti-userloginFAQ.  AsdescribedinAuthorizingarequest,allrequeststotheAdsAPIrequireAuthorizationheadersusing OAuth1.0a withanaccesstokenobtainedvia 3-legged OAuth flow.Yourapplicationwillneedtoimplementaweb-basedOAuthflowto obtainaccesstokens.AdsAPIdevelopersshouldneverrequestthatourTwitteradvertiserssharetheirlogincredentials. Bydefault,eachTwitterdeveloperapplicationcontainsastaticaccesstokenthatcanbeusedtomakeAdsAPIrequestsfortheaccountthatownstheapplication.Thesecredentialsareidealforsingle-accountusecaseswithoutrequiringa3-leggedorPIN-basedOAuthflow.Ifyouaren'taccessinganotherTwitterAdsAccount,usethesesingle-usercredentialsinsteadofthefollowingsteps. Levelsofaccess App-levelpermissions EachuserwillhavealevelofaccessasrequesteduponapplicationtotheAdsAPI: Analytics(Read-only):UserhasaccesstoAnalyticsendpointswithread-onlyaccess.UsercannotaccessCampaignManagement,CreativeorCustomAudiencesendpoints,butwillbeabletopullmetricsbypassingthroughcreativeentitiesintherequestparametersoftheAnalyticsendpoints.Topullthegranularityofmedia_idormedia_name,theuserapplicationwouldneedtohaveAdsAPIwriteaccess. CampaignManagement&Creative(Read&Write):UserhasaccesstoCampaignManagementandCreativeendpointswithread&writeaccess.UseralsohasaccesstoAnalyticsendpoints.  CustomAudiences(Read&Write):UserhasaccesstoCustomAudiencesendpointswithread&writeaccess.UseralsohasaccesstoCampaignManagement,Creative,andAnalyticsendpoints.ThisaccesslevelalsorequiresanadditionalreviewperioduponsubmissionoftheCustomAudiencesapplication. Note:ForallUser-levelpermissions,adaccountlevelpermissionfortheuserwillneedeither Accountadministrator, Admanager or CreativeManagerpermissionstopullinformationforcreatives. AdAccount-levelpermissions EachuserthathasaccesstoanAdsAccountwillhaveaspecificaccount-levelpermission: Accountadministrator,Admanager,Campaignanalyst,Organicanalyst,andCreativeManager;see business.twitter.com forthelatestdocumentationforaccount-levelpermissions.ApplicationsshouldretrievethepermissionsforthecurrentlyauthenticateduserviatheAuthenticatedUserAccess APIendpointtodeterminewhichAPIendpointsandAdsfeaturestheycanaccess.                                                                                  Methodsofobtainingaccesstokens 1.Obtainanadvertiser's(User)accesstoken Therearetwomethodsofobtaininganadvertiser’saccesstoken.Themostcommonmethodisviaa 3-leggedOAuthflow directlyfromwithinyourwebUI.ApplicationsthatdonothaveapubliclyaccessibleUIexposedtoadvertiserscanimplementan PIN-based Oauthprocess.Aftertheusercompletesthe3-leggedflow,yourapplicationwillhavecredentialstomakerequestfortheirAdsaccountviatheAPI. ObtainingusercredentialsviaOAuthflowisthemethodwehighlyrecommendforthemajorityofAdsAPIdeveloperstogainaccesstoanadvertiseraccount.ItallowsyoutocalltheAPIonbehalfofauserandtakeactionsasthatuser.Thesetokensdonotexpirebutcanberevokedbytheuseratanytime. 2.Obtainyour(Developer)accesstoken Thisoptionrequirestheadvertiserto grantyour@username (or@usernames)accesstotheirTwitterAdsaccountviatheTwitterUIatads.twitter.com.Accesstokens obtainedthroughthe3-leggedOAuthflowforyouraccountwillbeabletoaccesstheadvertiser'sTwitterAdsaccount. ThisallowsyoutocalltheAPIusingtheOAuthtokensofyourown@usernameratherthantheadvertiser’sOAuthtokens.ThekeydistinctiononthisoptionisthatyoumayonlycreatePromoted-OnlyTweetsiftheTweetdelegation/composerpermissionhasbeengrantedtoyour@username. TogainaccesstocreatePromoted-OnlyTweetsonbehalfoftheFULLpromotableuserontheaccount,youmustalsobegrantedaccesstocreateTweetsinthisflow.ThatwillenableaccessviatheTWEET_COMPOSERpermissionontheGETaccounts/:account_id/authenticated_user_accessendpoint. Differencesbetweenthesemethods   Advertiser(User)OAuthToken (Developer)OAuthToken  (@usernameaddedtoseparateaccount) AccessAdsAccount ✔ ✔ CreateTweetsonBehalfofUser ✔ ✔* ManageCampaigns ✔ ✔ AccessAnalytics ✔ ✔ CreateCardsonBehalfofUser ✔ ✔ DeveloperabilitytoAccess viaTwitterAdsUI   ✔ RateLimits DistinctperAdvertiser DistinctperAdvertiserAccount *seeObtainyour(Developer) accesstoken sectionabovefordetails. SampleUse-Case Advertiser'saccesstokenviaOAuth3-leggedwebflow Thestandardflowisweb-basedandusesthe3-leggedauthorizationOAuthflow.Thescreenshotsoutlinedherearepartofasamplethatyoucanviewthesourceofathttps://github.com/twitterdev/twauth-web. Atsomepointinyourapplication,youwillwanttoredirecttoTwitterinordertoauthorizeyourapplicationWhenyouredirecttoTwitterwiththerequesttoken,theuserwillbepromptedtoauthorizeyourapplicationUponauthorizingyourapplication,theuserwillberedirectedtothecallbackURLprovidedwhenyougeneratedtherequesttoken.Youwillusethistoobtainthepermanentaccesstokenforthisuserandstoreitlocally ByusingTwitter’sservicesyouagreetoourCookiesUse.Weusecookiesforpurposesincludinganalytics,personalisation,andads. OK ThispageandcertainotherTwittersitesplaceandreadthirdpartycookiesonyourbrowserthatareusedfornon-essentialpurposesincludingtargetingofads. Throughthesecookies,Google,LinkedInandDemandbasecollectpersonaldataaboutyoufortheirownpurposes. Learnmore. Accept Decline



請為這篇文章評分?