{"id":7217,"date":"2019-06-13T21:04:57","date_gmt":"2019-06-13T21:04:57","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=7217"},"modified":"2024-09-25T13:50:14","modified_gmt":"2024-09-25T13:50:14","slug":"import-bing-ads-data-sql-server-performance-reports","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/","title":{"rendered":"Import Bing Ads data into SQL Server (Performance Reports)"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-7363 alignleft\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png\" alt=\"\" width=\"190\" height=\"158\" \/><\/a>In our previous blog post we saw how to <a href=\"https:\/\/zappysys.com\/blog\/import-rest-api-json-sql-server\/\" target=\"_blank\" rel=\"noopener\">import REST \/ SOAP API in SQL Server<\/a>. Using same concepts let&#8217;s look at how to import Bing Ads data into SQL Server. We will explore many techniques to call Bing Ads API and learn how to automate data extraction without doing any ETL. You can call Bing Ads API just using T-SQL code (Yes you heard it right). At the end of this article you will learn how to <strong>Download Performance Reports from Bing Ads Account<\/strong> without any coding (See sample screenshot below). Please go through full article carefully.<\/p>\n<p><strong>NOTE:<\/strong> Bing Ads now renamed as Microsoft Advertising but this article will use popular name for time being.<\/p>\n<h2><\/h2>\n<div id=\"attachment_7218\" style=\"width: 841px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7218\" class=\"size-full wp-image-7218\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table.png\" alt=\"Import Bing Ads data into SQL Server (Using SSMS T-SQL Code)\" width=\"831\" height=\"741\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table.png 831w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table-300x268.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table-768x685.png 768w\" sizes=\"(max-width: 831px) 100vw, 831px\" \/><\/a><p id=\"caption-attachment-7218\" class=\"wp-caption-text\">Import Bing Ads data into SQL Server (Using SSMS T-SQL Code)<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div class=\"content_block\" id=\"custom_post_widget-7048\"><h2>Requirements<\/h2>\r\nThis article talks about few tools and techniques in order to load API data in SQL Server. Please make sure following prerequisites are met.\r\n<ol>\r\n \t<li>Download and Install <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys ODBC PowerPack<\/a> (This includes XML \/ JSON \/ REST API and few other drivers for SQL Server and ODBC connectivity in tools like Excel, Power BI, SSRS)<\/li>\r\n \t<li>Make sure you have access to SQL Server Instance. If you cant find one still want to try what is mentioned in this article then install <a href=\"https:\/\/www.microsoft.com\/en-us\/sql-server\/sql-server-editions-express\" target=\"_blank\" rel=\"noopener\">FREE SQL Express Edition<\/a><\/li>\r\n \t<li>Confirm that you have SSMS Installed. If you don't have then you can download <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssms\/download-sql-server-management-studio-ssms?view=sql-server-2017\">from here<\/a>.<\/li>\r\n<\/ol><\/div>\n<h2>About Bing Ads API \/ SOAP Web Service<\/h2>\n<p>If you are new to Bing Ads API then <a href=\"https:\/\/docs.microsoft.com\/en-us\/advertising\/\" target=\"_blank\" rel=\"noopener\">start from here<\/a>. Bing Ads APIs are SOAP XML APIs. You can call it to automate <a href=\"https:\/\/docs.microsoft.com\/en-us\/advertising\/guides\/?view=bingads-13\" target=\"_blank\" rel=\"noopener\">many scenarios<\/a> for Bing Ads. In this article we will mainly focus on read scenario (e.g. Read Performance Data) but you can use these techniques to write \/ update (e.g. Create New Campaign).<\/p>\n<p>If you are new to SOAP WebService then <a href=\"https:\/\/zappysys.com\/blog\/calling-soap-web-service-in-ssis-xml-source\/\" target=\"_blank\" rel=\"noopener\">Check this article<\/a> to learn more. It will explain you\u00a0how to use tools like <strong>SoapUI<\/strong> tool to craft SOAP Requests for Bing API or any other SOAP API.<\/p>\n<p>For Bing API you can use Service WSDL files <a href=\"https:\/\/docs.microsoft.com\/en-us\/advertising\/guides\/web-service-addresses?view=bingads-13\" target=\"_blank\" rel=\"noopener\">found here<\/a>. Use URL ending <strong>?wsdl<\/strong> to import in SoapUI.<\/p>\n<h2>Example Bing API Request<\/h2>\n<p>Here is raw API request for Bing API. This sample assumes you have completed 3-Legged OAuth Authorization to obtain AccessToken and RefreshToken (Explained later in this article). Below request uses AccessToken you might have already obtained via <a href=\"https:\/\/docs.microsoft.com\/en-us\/advertising\/guides\/get-started?view=bingads-13#get-developer-token\" target=\"_blank\" rel=\"noopener\">process like this<\/a>. If you are using ZappySys tools then this will be generated automatically for you.<\/p>\n<p><strong>Request Method \/ URL:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">POST https:\/\/clientcenter.api.bingads.microsoft.com\/Api\/CustomerManagement\/v13\/CustomerManagementService.svc<\/pre>\n<p><strong>Headers:<br \/>\n<\/strong>Notice that for each Api you may need correct <strong>SOAPAction<\/strong> in Header. If you are not sure then use SoapUI Tool. Execute request in SoapUI and then go to <strong>Raw tab <\/strong><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/06\/soapui-get-contenttype-soapaction-raw-tab.png\" target=\"_blank\" rel=\"noopener\">like this one<\/a>.<\/p>\n<pre class=\"lang:default decode:true\">Content-Type: text\/xml; charset=utf-8\r\nSOAPAction: \"GetUser\"<\/pre>\n<p><strong>Body:<br \/>\n<\/strong>Notice that you have to replace <strong>AuthenticationToken<\/strong> and <strong>DeveloperToken<\/strong> in below request. AccessToken is placed inside AuthenticationToken tag. This Auth token is short lived and extracted via OAuth Process and DeveloperToken you can extract as mentioned in the previous section <a href=\"https:\/\/developers.ads.microsoft.com\/Account\">or get it from here<\/a>.<\/p>\n<pre class=\"lang:default highlight:1 decode:true\"><s:Envelope xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\">\r\n  <s:Header xmlns=\"https:\/\/bingads.microsoft.com\/Customer\/v13\">\r\n    <Action mustUnderstand=\"1\">GetUser<\/Action>\r\n    <AuthenticationToken i:nil=\"false\"><%access_token%><\/AuthenticationToken>\r\n    <DeveloperToken i:nil=\"false\">1052Bxxxxxxxxxxxxxx<\/DeveloperToken>\r\n  <\/s:Header>\r\n  <s:Body>\r\n    <GetUserRequest xmlns=\"https:\/\/bingads.microsoft.com\/Customer\/v13\">\r\n      <UserId i:nil=\"true\"><\/UserId>\r\n    <\/GetUserRequest>\r\n  <\/s:Body>\r\n<\/s:Envelope><\/pre>\n<p><strong>Response:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">&lt;s:Envelope xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\r\n  &lt;s:Header&gt;\r\n    &lt;h:TrackingId xmlns:h=\"https:\/\/bingads.microsoft.com\/Customer\/v13\"&gt;fddf3cb9-e4c2-4e75-9546-f3bc20ea91a8&lt;\/h:TrackingId&gt;\r\n  &lt;\/s:Header&gt;\r\n  &lt;s:Body&gt;\r\n    &lt;GetUserResponse xmlns=\"https:\/\/bingads.microsoft.com\/Customer\/v13\"&gt;\r\n      &lt;User xmlns:a=\"https:\/\/bingads.microsoft.com\/Customer\/v13\/Entities\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"&gt;\r\n        &lt;a:ContactInfo&gt;\r\n          &lt;a:Address&gt;\r\n            &lt;a:City i:nil=\"true\" \/&gt;\r\n            &lt;a:CountryCode&gt;US&lt;\/a:CountryCode&gt;\r\n            &lt;a:Id i:nil=\"true\" \/&gt;\r\n            &lt;a:Line1 i:nil=\"true\" \/&gt;\r\n            &lt;a:Line2 i:nil=\"true\" \/&gt;\r\n            &lt;a:Line3 i:nil=\"true\" \/&gt;\r\n            &lt;a:Line4 i:nil=\"true\" \/&gt;\r\n            &lt;a:PostalCode i:nil=\"true\" \/&gt;\r\n            &lt;a:StateOrProvince i:nil=\"true\" \/&gt;\r\n            &lt;a:TimeStamp i:nil=\"true\" \/&gt;\r\n            &lt;a:BusinessName i:nil=\"true\" \/&gt;\r\n          &lt;\/a:Address&gt;\r\n          &lt;a:ContactByPhone&gt;false&lt;\/a:ContactByPhone&gt;\r\n          &lt;a:ContactByPostalMail&gt;false&lt;\/a:ContactByPostalMail&gt;\r\n          &lt;a:Email&gt;someone@zappysys.com&lt;\/a:Email&gt;\r\n          &lt;a:EmailFormat i:nil=\"true\" \/&gt;\r\n          &lt;a:Fax i:nil=\"true\" \/&gt;\r\n          &lt;a:HomePhone i:nil=\"true\" \/&gt;\r\n          &lt;a:Id&gt;48045678&lt;\/a:Id&gt;\r\n          &lt;a:Mobile i:nil=\"true\" \/&gt;\r\n          &lt;a:Phone1&gt;111-222-3333&lt;\/a:Phone1&gt;\r\n          &lt;a:Phone2 i:nil=\"true\" \/&gt;\r\n        &lt;\/a:ContactInfo&gt;\r\n        &lt;a:CustomerId&gt;19112345&lt;\/a:CustomerId&gt;\r\n        &lt;a:Id&gt;48012345&lt;\/a:Id&gt;\r\n        &lt;a:JobTitle i:nil=\"true\" \/&gt;\r\n        &lt;a:LastModifiedByUserId&gt;48012345&lt;\/a:LastModifiedByUserId&gt;\r\n        &lt;a:LastModifiedTime&gt;2019-06-04T14:22:35.38&lt;\/a:LastModifiedTime&gt;\r\n        &lt;a:Lcid&gt;EnglishUS&lt;\/a:Lcid&gt;\r\n        &lt;a:Name&gt;\r\n          &lt;a:FirstName&gt;Someone&lt;\/a:FirstName&gt;\r\n          &lt;a:LastName&gt;Good&lt;\/a:LastName&gt;\r\n          &lt;a:MiddleInitial i:nil=\"true\" \/&gt;\r\n        &lt;\/a:Name&gt;\r\n        &lt;a:Password i:nil=\"true\" \/&gt;\r\n        &lt;a:SecretAnswer i:nil=\"true\" \/&gt;\r\n        &lt;a:SecretQuestion&gt;None&lt;\/a:SecretQuestion&gt;\r\n        &lt;a:UserLifeCycleStatus&gt;Active&lt;\/a:UserLifeCycleStatus&gt;\r\n        &lt;a:TimeStamp&gt;AAAAAJiX\/cU=&lt;\/a:TimeStamp&gt;\r\n        &lt;a:UserName&gt;someone@zappysys.com&lt;\/a:UserName&gt;\r\n        &lt;a:ForwardCompatibilityMap i:nil=\"true\" xmlns:b=\"http:\/\/schemas.datacontract.org\/2004\/07\/System.Collections.Generic\" \/&gt;\r\n      &lt;\/User&gt;\r\n      &lt;CustomerRoles xmlns:a=\"https:\/\/bingads.microsoft.com\/Customer\/v13\/Entities\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"&gt;\r\n        &lt;a:CustomerRole&gt;\r\n          &lt;a:RoleId&gt;41&lt;\/a:RoleId&gt;\r\n          &lt;a:CustomerId&gt;19160000&lt;\/a:CustomerId&gt;\r\n          &lt;a:AccountIds i:nil=\"true\" xmlns:b=\"http:\/\/schemas.microsoft.com\/2003\/10\/Serialization\/Arrays\" \/&gt;\r\n          &lt;a:LinkedAccountIds xmlns:b=\"http:\/\/schemas.microsoft.com\/2003\/10\/Serialization\/Arrays\" \/&gt;\r\n          &lt;a:CustomerLinkPermission i:nil=\"true\" \/&gt;\r\n        &lt;\/a:CustomerRole&gt;\r\n      &lt;\/CustomerRoles&gt;\r\n    &lt;\/GetUserResponse&gt;\r\n  &lt;\/s:Body&gt;\r\n&lt;\/s:Envelope&gt;<\/pre>\n<div class=\"content_block\" id=\"custom_post_widget-7357\"><h2>Things to know about REST \/ SOAP API<\/h2>\r\nBefore we deep dive into calling your specific APIs you like to integrate, you must have basic understanding what is REST API \/ SOAP API. In this section we will cover few important concepts and difference about these two API styles REST vs SOAP.\r\n<h3><strong>What is REST API (or RESTful API)<\/strong><\/h3>\r\nAs per wikipedia <a href=\"https:\/\/en.wikipedia.org\/wiki\/Representational_state_transfer\" target=\"_blank\" rel=\"noopener\">REST<\/a> is an architecture style which can be used to to expose data over the internet using http \/ https. Using REST style you can expose data operations \/ functions which can be called by other users. With API calls You can read \/ write data or just call business functions which triggers some workflow.\r\n\r\nMost APIs documents various aspects of calling API (REST or SOAP). You need to pass these details accurately. Refer to your\u00a0API documentation <a href=\"https:\/\/developer.zendesk.com\/rest_api\/docs\/support\/introduction\" target=\"_blank\" rel=\"noopener\">like this one for example<\/a>\u00a0. If its an internal API then contact API developer to get more details.\r\n<ul>\r\n \t<li><strong>URL and Parameters<\/strong>\u00a0 (or sometimes referred as endpoint)<\/li>\r\n \t<li><strong>Request Method<\/strong> (or sometimes referred as Verb)- e.g. GET, POST, PUT, PATCH .....<\/li>\r\n \t<li><strong>HTTP Headers<\/strong><\/li>\r\n \t<li><strong>Request Body<\/strong><\/li>\r\n<\/ul>\r\n<strong>Sample REST API Call<\/strong>\r\n\r\n<strong>Request:<\/strong>\r\n<pre class=\"lang:default decode:true\">POST http:\/\/myhost\/api\/v2\/customers\/new\r\nX-SecretKey: Abcdxxxxxxxxxxxxxx\r\nContent-Type: application\/json\r\n\r\n{ firstname: \"Someone\", lastname: \"Good\" }<\/pre>\r\n<strong>Response:<\/strong>\r\n<pre class=\"lang:default highlight:0 decode:true\">{\r\n request_status: \"CreatedOK\",\r\n new_customer_id: \"1234566\"\r\n}<\/pre>\r\n<h3>What is SOAP Web Service (XML API)<\/h3>\r\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/SOAP\" target=\"_blank\" rel=\"noopener\">SOAP Web Service<\/a>\u00a0is an old standard developed before REST Style got popular. SOAP is strictly XML based API on the other hand RESTful API can be any format. As we said earlier REST is an architecture style,\u00a0 and SOAP is a standard (XML Based Protocol to transfer data).\r\n\r\nFor more information on SOAP API <a href=\"https:\/\/zappysys.com\/blog\/calling-soap-web-service-in-ssis-xml-source\/\" target=\"_blank\" rel=\"noopener\">refer to this link \/ videos<\/a>\r\n<h3>Other Concepts Calling REST \/ SOAP<\/h3>\r\nThere are few things you have to find out from your API Provider (Read their documentation <a href=\"https:\/\/developer.zendesk.com\/rest_api\/docs\/support\/introduction\" target=\"_blank\" rel=\"noopener\">like this for example<\/a>). Few important concepts for API calling listed below.\r\n<ul>\r\n \t<li><strong>Authentication<\/strong> - Most APIs need some sort of credentials to verify your identity. Here are some common Auth mechanism\r\n<ul>\r\n \t<li><a href=\"https:\/\/zappysys.com\/blog\/how-to-set-base64-encoded-authorization-header-for-http-web-request\/\">Basic Authentication<\/a>,<\/li>\r\n \t<li><a href=\"https:\/\/zappysys.com\/blog\/rest-api-authentication-with-oauth-2-0-using-ssis\/\" target=\"_blank\" rel=\"noopener\">OAuth 1a or 2.0<\/a><\/li>\r\n \t<li><a href=\"https:\/\/zappysys.com\/blog\/call-soap-rest-api-using-dynamic-token-ssis\/\" target=\"_blank\" rel=\"noopener\">Dynamic Token Auth <\/a><\/li>\r\n \t<li>Pass API key via URL Parameter\r\ne.g. <span class=\"lang:default decode:true  crayon-inline\">http:\/\/myhost\/api\/v1\/getcustomers?apikey=###some-secret-key####<\/span><\/li>\r\n \t<li>Pass API key via Header<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li><strong>Pagination<\/strong> - Most APIs don't return huge amount of data in a single requests so you must call next request to continue fetch more data until all rows are fetched. There is no standard around pagination so find out from your API provider how to paginate. <a href=\"https:\/\/zappysys.com\/blog\/ssis-rest-api-looping-until-no-more-pages-found\/\" target=\"_blank\" rel=\"noopener\">Check this article for example<\/a> to learn about various pagination patterns.<\/li>\r\n \t<li><strong>Throttling (API calls rate limit)<\/strong> - Most API providers enforce API call rate limit. Which means you cannot call it more than X times in a given time. If you ever face such issue, You can enable <a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/09\/http-retry-settings-oauth-connection.png\" target=\"_blank\" rel=\"noopener\">error retry option like this<\/a> or simply <a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2016\/01\/rest-api-limit-throttling-pause-request-per-seconds.png\" target=\"_blank\" rel=\"noopener\">add delay like this<\/a> to slow down.<\/li>\r\n<\/ul>\r\n<h3>Must have Tools for API Testing \/ Debugging<\/h3>\r\nBefore you start integrating API calls in ZappySys products like <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">ODBC PowerPack<\/a> or <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">SSIS PowerPack<\/a>\u00a0you can start testing API using tools like CURL, Postman or Fiddler.\r\n<h4><strong>Fiddler<\/strong><\/h4>\r\nFiddler is the best API API debugger out there. It acts like a small Proxy server so you can see all Web requests on your system in a raw format. You can also use this tool to Test API requests (See Composer tab in Fiddler) however if API testing is your primary use case then use POSTMAN (see next) because it has more UI elements compared to Fiddler.\u00a0Here is <a href=\"https:\/\/zappysys.com\/blog\/how-to-use-fiddler-to-analyze-http-web-requests\/\">small tutorial to get started with Fiddler<\/a>.\r\n<h4><strong>Postman<\/strong><\/h4>\r\n<a href=\"https:\/\/www.getpostman.com\/\" target=\"_blank\" rel=\"noopener\">Postman<\/a> is probably the most popular tool to test API with full User interface. It's not data processing like ZappySys but you can pass various parts of API we talked earlier and test API before you can start using ZappySys for Data integration.\u00a0Here is <a href=\"https:\/\/www.youtube.com\/watch?v=t5n07Ybz7yI\">Video Tutorial to get started with Postman<\/a>.\r\n<h4><strong>cURL<\/strong><\/h4>\r\n<a href=\"https:\/\/curl.haxx.se\/\">CURL<\/a> is a simple yet most popular command line tool to call \/ test APIs. It doesn't have UI elements like previous two tools so have to learn about each options you can pass to this command line.<\/div>\n<h2>Step-By-Step: How to Import Bing Ads Data into SQL Server<\/h2>\n<p>Now let&#8217;s look at how to import Bing Ads Data into SQL Server Table. This tutorial will require 10-15 mins of your time. At the end of this tutorial you will be able to Read Bing Ads Performance Report and Import data into SQL Server. Step listed in this tutorial may help you to call Bing API in other tools like <a href=\"https:\/\/zappysys.com\/blog\/call-rest-api-using-ssis-web-service-task\/\">SSIS<\/a>, <a href=\"https:\/\/zappysys.com\/blog\/call-soap-api-power-bi-read-xml-web-service-data\/\">Power BI<\/a>, SSRS, Tableau and so on.<\/p>\n<p>So let&#8217;s get started.<\/p>\n<h3>Register OAuth App for Bing Ads API (Azure Active Directory App)<\/h3>\n<p>Very first thing to call any Bing API is to register OAuth App (Under Azure Active Directory Tab).<\/p>\n<p>Here is how to register OAuth App which can be used to call Bing Ads API later on.<\/p>\n<ol>\n<li>\n    <strong>Login to Azure Portal:<\/strong><\/p>\n<ul>\n<li>Navigate to the <a href=\"https:\/\/portal.azure.com\/#home\" target=\"_blank\" rel=\"noopener\"><strong>Azure Portal<\/strong><\/a> and log in using your credentials.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Access Azure Active Directory:<\/strong><\/p>\n<ul>\n<li>In the left-hand menu, click on <a target=\"_blank\" href=\"https:\/\/portal.azure.com\/#blade\/Microsoft_AAD_IAM\/ActiveDirectoryMenuBlade\/Overview\" rel=\"noopener\"><strong>Azure Active Directory<\/strong><\/a>.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Register a New Application:<\/strong><\/p>\n<ul>\n<li>Go to <a target=\"_blank\" href=\"https:\/\/portal.azure.com\/#blade\/Microsoft_AAD_IAM\/ActiveDirectoryMenuBlade\/RegisteredApps\" rel=\"noopener\"><strong>App registrations<\/strong><\/a> and click on <strong>New registration<\/strong>.<br \/>\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/register-azure-active-directory-oauth-app.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/register-azure-active-directory-oauth-app.png\" alt=\"\" width=\"638\" height=\"368\" class=\"alignnone size-full wp-image-7344\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/register-azure-active-directory-oauth-app.png 638w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/register-azure-active-directory-oauth-app-300x173.png 300w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><\/a>\n<\/li>\n<li><strong>Application Name:<\/strong> Enter a name for your application.<br \/>\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/create-new-azure-oauth-app-select-type.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/create-new-azure-oauth-app-select-type.png\" alt=\"\" width=\"392\" height=\"567\" class=\"alignnone size-full wp-image-7345\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/create-new-azure-oauth-app-select-type.png 392w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/07\/create-new-azure-oauth-app-select-type-207x300.png 207w\" sizes=\"(max-width: 392px) 100vw, 392px\" \/><\/a>\n<\/li>\n<li><strong>Supported Account Types:<\/strong> Choose the account types your app will support. For example, select <strong>Accounts in this organizational directory only<\/strong> if you need access to data in your organization only.<\/li>\n<li><strong>Redirect URI:<\/strong>\n<ul>\n<li>Set the type to <strong>Web<\/strong>.<\/li>\n<li>In the textbox enter <b>https:\/\/login.microsoftonline.com\/common\/oauth2\/nativeclient<\/b> as the Redirect URI or any other valid redirect URL, e.g., <b>https:\/\/zappysys.com\/oauth<\/b>.<\/li>\n<li>Use this Redirect URI in the <strong>Redirect URL<\/strong> grid row.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Save Client ID:<\/strong><\/p>\n<ul>\n<li>After registering the app, copy the <strong>Application (client) ID<\/strong> and paste it into the <strong>Client ID<\/strong> field in the API Connection Manager configuration.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Set Authorization &amp; Token URLs:<\/strong><\/p>\n<ul>\n<li>Click on the <strong>Endpoints<\/strong> link in the App registration overview.<\/li>\n<li><strong>Authorization URL:<\/strong> Copy the <strong>OAuth 2.0 authorization endpoint (v2)<\/strong> URL (e.g., <code>https:\/\/login.microsoftonline.com\/{your-tenant-id}\/oauth2\/v2.0\/authorize<\/code>) and paste it into the <strong>Authorization URL<\/strong> field in the configuration grid.<\/li>\n<li><strong>Token URL:<\/strong> Copy the <strong>OAuth 2.0 token endpoint (v2)<\/strong> URL (e.g., <code>https:\/\/login.microsoftonline.com\/{your-tenant-id}\/oauth2\/v2.0\/token<\/code>) and paste it into the <strong>Token URL<\/strong> field.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Create a Client Secret:<\/strong><\/p>\n<ul>\n<li>In the <strong>Certificates &amp; secrets<\/strong> tab, click <strong>New client secret<\/strong>.<\/li>\n<li>Set an expiration period for the secret.<\/li>\n<li>Copy the generated client secret and paste it into the <strong>Client Secret<\/strong> field in the API Connection Manager configuration.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Configure API Permissions:<\/strong><\/p>\n<ul>\n<li>Go to the <strong>API Permissions<\/strong> section.<\/li>\n<li>Click on <strong>Add a permission<\/strong>, select <strong>Microsoft Graph<\/strong>, and choose <strong>Delegated Permissions<\/strong>.<\/li>\n<li>Add the required permissions:\n<ul>\n<li>offline_access<\/li>\n<li>openid<\/li>\n<li>profile<\/li>\n<li>Sites.Read.All<\/li>\n<li>Sites.ReadWrite.All<\/li>\n<li>User.Read<\/li>\n<li>email<\/li>\n<\/ul>\n<div id=\"attachment_11177\" style=\"width: 903px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/azure-ad-app-required-app-permissions.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11177\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/azure-ad-app-required-app-permissions.jpg\" alt=\"azure-ad-app-required-app-permissions\" width=\"893\" height=\"681\" class=\"size-full wp-image-11177\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/azure-ad-app-required-app-permissions.jpg 893w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/azure-ad-app-required-app-permissions-300x229.jpg 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/azure-ad-app-required-app-permissions-768x586.jpg 768w\" sizes=\"(max-width: 893px) 100vw, 893px\" \/><\/a><p id=\"caption-attachment-11177\" class=\"wp-caption-text\">Azure AD App &#8211; Required API Permissions<\/p><\/div>\n      <\/li>\n<li><strong>Grant Admin Consent<\/strong> for the permissions that require it.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Generate Tokens:<\/strong><\/p>\n<ul>\n<li>Use the <strong>Generate Token<\/strong> feature in the API Connection Manager to generate authentication tokens.<\/li>\n<\/ul>\n<\/li>\n<li>\n    <strong>Use a Generic Account for Automation:<\/strong><\/p>\n<div style=\"background-color: #f5f2c4; border-style: solid; border-color: #000000; border-width: 1px; margin-top: 3px; margin-bottom: 6px; padding: 6px;\">\n\t\t<b>NOTE<\/b>: If you are planning to use your current data connection\/token for automated processes, we recommend that you use a generic account for token generation when the login box appears (e.g. sales_automation@mycompany.com instead of bob_smith@mycompany.com). When you use a personal account which is tied to a specific employee profile and that employee leaves the company, the token may become invalid and any automated processes using that token will fail. Another potentially unwanted effect of using a personal token is incorrect logging; the API calls (e.g. Read, Edit, Delete, Upload) made with that token will record the specific user as performing the calls instead of an automated process.\n    <\/div>\n<\/li>\n<li>That&#8217;s it!<\/li>\n<\/ol>\n<h3>Get Bing API Developer Token<\/h3>\n<p>Once we have OAuth App registered next thing is to obtain Developer Token for Bing Ads API. <a href=\"https:\/\/developers.ads.microsoft.com\/Account\" target=\"_blank\" rel=\"noopener\">Click here to request new token<\/a> or view existing Developer token.<\/p>\n<div class=\"content_block\" id=\"custom_post_widget-5411\"><h3><span style=\"font-size: 14pt;\">Configure ZappySys Data Gateway<\/span><\/h3>\r\nNow let's look at steps to configure Data Gateway after installation.\r\n<ol style=\"margin-left: 0;\">\r\n \t<li style=\"text-align: left;\">Assuming you have installed\u00a0<a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys ODBC PowerPack<\/a>\u00a0using default options (Which also enables Data Gateway Service)<\/li>\r\n \t<li style=\"text-align: left;\">Search \"Gateway\" in your start menu and click ZappySys Data Gateway\r\n<div class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/start-menu-open-zappysys-data-gateway.png\">\r\n<img decoding=\"async\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/start-menu-open-zappysys-data-gateway.png\" alt=\"Open ZappySys Data Gateway\" \/><\/a>\r\n<p class=\"wp-caption-text\">Opening ZappySys Data Gateway<\/p>\r\n\r\n<\/div><\/li>\r\n \t<li>First, make sure Gateway Service is running (Verify Start icon is disabled)<\/li>\r\n \t<li>Also, verify Port on General Tab\r\n<div class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/ZappySys-data-gateway-port-5000.png\">\r\n<img decoding=\"async\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/03\/ZappySys-data-gateway-port-5000.png\" alt=\"Port Number setting on ZappySys Data Gateway\" \/><\/a>\r\n<p class=\"wp-caption-text\">Checking port number setting on ZappySys Data Gateway<\/p>\r\n\r\n<\/div><\/li>\r\n \t<li>Now go to Users tab. <strong>Click Add<\/strong> icon to add a new user. Check Is admin to give access to all data sources you add in future. If you don't check admin then you have to manually configure user permission for each data source.\r\n<div class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/zappysys-data-gateway-add-user.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5453\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-configure-add-user.png\" alt=\"\" width=\"564\" height=\"438\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-configure-add-user.png 564w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-configure-add-user-300x233.png 300w\" sizes=\"(max-width: 564px) 100vw, 564px\" \/><\/a>\r\n<p class=\"wp-caption-text\">Adding the Gateway user<\/p>\r\n\r\n<\/div><\/li>\r\n<\/ol>\r\n&nbsp;<\/div>\n<h3>Create new Bing Ads API Data Source in Gateway<\/h3>\n<p>Once you setup Data Gateway user we can move to next step. To call Bing API we need to setup Connection for XML Driver in ZappySys Data Gateway.<\/p>\n<ol>\n<li>Click on Add New Data source. Name as <strong>BingAds<\/strong> and select <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/odbc-xml-soap-api-driver\/\" target=\"_blank\" rel=\"noopener\"><strong>Native &#8211; ZappySys XML Driver<\/strong><\/a> option.\n<div id=\"attachment_5557\" style=\"width: 572px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/odbc_json_driver_add_native_driver.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5557\" class=\"size-full wp-image-5557\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/odbc_json_driver_add_native_driver.png\" alt=\"Add Gateway Data Source\" width=\"562\" height=\"539\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/odbc_json_driver_add_native_driver.png 562w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/odbc_json_driver_add_native_driver-300x288.png 300w\" sizes=\"(max-width: 562px) 100vw, 562px\" \/><\/a><p id=\"caption-attachment-5557\" class=\"wp-caption-text\">Add Gateway Data Source<\/p><\/div><\/li>\n<li>Now click Edit to Configure Settings. For now we will only care OAuth Connection settings. All other options are overwritten in SQL Query.\n<div id=\"attachment_5440\" style=\"width: 572px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-create-datasource-2-2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-5440\" class=\"size-full wp-image-5440\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-create-datasource-2-2.png\" alt=\"Edit Gateway Data Source Settings\" width=\"562\" height=\"385\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-create-datasource-2-2.png 562w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/11\/gateway-create-datasource-2-2-300x206.png 300w\" sizes=\"(max-width: 562px) 100vw, 562px\" \/><\/a><p id=\"caption-attachment-5440\" class=\"wp-caption-text\">Edit Gateway Data Source Settings<\/p><\/div><\/li>\n<li>When UI opens Click on Load ConnectionString and Paste below connection string after changing some items (<strong>Screenshot may be differ<\/strong>). Make sure to replace following attributes.<strong>RefreshTokenFilePath<\/strong> &#8211; Enter some valid file path which will hold refresh token<br \/>\n<strong>ClientId<\/strong> &#8211; get Application Id from Azure Portal under App we created earlier)<br \/>\n<strong>DeveloperToken<\/strong> &#8211; Replace\u00a01052Bxxxxxxxxxxxx with your own devloper token.<\/p>\n<div id=\"attachment_7024\" style=\"width: 996px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/05\/zappysys-driver-load-connectionstring.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7024\" class=\"size-full wp-image-7024\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/05\/zappysys-driver-load-connectionstring.png\" alt=\"Load ZappySys Driver ConnectionString to configure UI\" width=\"986\" height=\"454\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/05\/zappysys-driver-load-connectionstring.png 986w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/05\/zappysys-driver-load-connectionstring-300x138.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/05\/zappysys-driver-load-connectionstring-768x354.png 768w\" sizes=\"(max-width: 986px) 100vw, 986px\" \/><\/a><p id=\"caption-attachment-7024\" class=\"wp-caption-text\">Load ZappySys Driver ConnectionString to configure UI<\/p><\/div>\n<p><strong>Use below string and replace parameters\u00a0<\/strong><\/p>\n<pre class=\"lang:default highlight:0 decode:true\">DRIVER={ZappySys XML Driver};\r\nDataPath='https:\/\/clientcenter.api.bingads.microsoft.com\/Api\/CustomerManagement\/v13\/CustomerManagementService.svc';\r\nDataConnectionType=OAuth;\r\nAuthUrl='https:\/\/login.microsoftonline.com\/common\/oauth2\/v2.0\/authorize';\r\nTokenUrl='https:\/\/login.microsoftonline.com\/common\/oauth2\/v2.0\/token';\r\nReturnUrl='https:\/\/login.microsoftonline.com\/common\/oauth2\/nativeclient';\r\nRefreshTokenFilePath='c:\\xxxxxx_some_folder_xxxxxxx\\BingAds_RefreshToken.txt';\r\nScopeSeparator='{space}';\r\nScope='https:\/\/ads.microsoft.com\/ads.manage offline_access';\r\nClientId='xxxxxxxxxxxxxx';\r\nUseCustomApp=True;\r\nRequestData='&lt;s:Envelope xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\r\n  &lt;s:Header&gt;\r\n    &lt;h:ApplicationToken i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Customer\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:AuthenticationToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Customer\/v13\"&gt;&lt;%access_token%&gt;&lt;\/h:AuthenticationToken&gt;\r\n    &lt;h:DeveloperToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Customer\/v13\"&gt;1052Bxxxxxxxxxxxx&lt;\/h:DeveloperToken&gt;\r\n    &lt;h:Password i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Customer\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:UserName i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Customer\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n  &lt;\/s:Header&gt;\r\n  &lt;s:Body&gt;\r\n    &lt;GetUserRequest xmlns=\"https:\/\/bingads.microsoft.com\/Customer\/v13\"&gt;\r\n      &lt;UserId i:nil=\"true\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;\/GetUserRequest&gt;\r\n  &lt;\/s:Body&gt;\r\n&lt;\/s:Envelope&gt;';\r\nRequestContentTypeCode=TextXml;\r\nRequestMethod='POST';\r\nRequestHeaders='SOAPAction: \"GetUser\"'<\/pre>\n<\/li>\n<li>Next to <strong>OAuth<\/strong> Click on <strong>Configure Settings<\/strong><\/li>\n<li>By default most of settings on OAuth connections should be pre-populated for you but still lets Notice few things. This is how to setup redirect URI<\/li>\n<li>\n<div id=\"attachment_7360\" style=\"width: 1027px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-oauth-redirect-url-azure-active-directory-oauth-app.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7360\" class=\"size-full wp-image-7360\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-oauth-redirect-url-azure-active-directory-oauth-app.png\" alt=\"Configure Redirect URI for Bing Ads API OAuth Connection\" width=\"1017\" height=\"486\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-oauth-redirect-url-azure-active-directory-oauth-app.png 1017w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-oauth-redirect-url-azure-active-directory-oauth-app-300x143.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-oauth-redirect-url-azure-active-directory-oauth-app-768x367.png 768w\" sizes=\"(max-width: 1017px) 100vw, 1017px\" \/><\/a><p id=\"caption-attachment-7360\" class=\"wp-caption-text\">Configure Redirect URI for Bing Ads API OAuth Connection<\/p><\/div><\/li>\n<li>Here is where you setup <a href=\"https:\/\/zappysys.zendesk.com\/hc\/en-us\/articles\/115004555334-How-to-handle-Changing-OAuth-RefreshToken-in-SSIS-ODBC-\" target=\"_blank\" rel=\"noopener\">Changing Refresh Token File path<\/a>. if you dont supply this path then your refresh token extracted first time will expire in 60 days.\n<div id=\"attachment_7361\" style=\"width: 609px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/handle-oauth-changing-refresh-token.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7361\" class=\"size-full wp-image-7361\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/handle-oauth-changing-refresh-token.png\" alt=\"Refresh Token File path (Only needed if API issues new Refresh Token when you request AccessToken)\" width=\"599\" height=\"355\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/handle-oauth-changing-refresh-token.png 599w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/handle-oauth-changing-refresh-token-300x178.png 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" \/><\/a><p id=\"caption-attachment-7361\" class=\"wp-caption-text\">Refresh Token File path (Only needed if API issues new Refresh Token when you request AccessToken)<\/p><\/div><\/li>\n<li>Once you verify all settings <strong>click<\/strong> <strong>Generate Token<\/strong> and Finish the process. It will populate <strong>AccessToken<\/strong> and <strong>RefreshToken<\/strong> Fields if everything goes well.\n<div id=\"attachment_7359\" style=\"width: 1054px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-zppysys-bing-ads-driver-oauth-connection.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7359\" class=\"size-full wp-image-7359\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-zppysys-bing-ads-driver-oauth-connection.png\" alt=\"Configure Bing Ads API Connection (OAuth 2.0)\" width=\"1044\" height=\"605\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-zppysys-bing-ads-driver-oauth-connection.png 1044w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-zppysys-bing-ads-driver-oauth-connection-300x174.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-zppysys-bing-ads-driver-oauth-connection-768x445.png 768w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/configure-zppysys-bing-ads-driver-oauth-connection-1024x593.png 1024w\" sizes=\"(max-width: 1044px) 100vw, 1044px\" \/><\/a><p id=\"caption-attachment-7359\" class=\"wp-caption-text\">Configure Bing Ads API Connection (OAuth 2.0)<\/p><\/div><\/li>\n<li>Click OK to save OAuth Connection UI to go back to main UI<\/li>\n<li>You can now <strong>Click Test Connection<\/strong> to confirm everything<\/li>\n<li>If you need to access Gateway from Other machine then go to <strong>Firewall tab<\/strong> and Click Add Rule<\/li>\n<li><strong>Click Save<\/strong> button <strong>on Gateway UI<\/strong> to save and restart the service.<\/li>\n<\/ol>\n<h3>Create a new Linked Server for Bing Ads API<\/h3>\n<p>Once we setup setup Bing Ads Data Source in Gateway we can move to next step which is create a Linked Server which points to Data gateway Data source we created. This will create a bridge between ZappySys Driver and SQL Server so you can call API via T-SQL.<\/p>\n<ol>\n<li>If you are using Latest ODBC PowerPack then on Data gateway UI you will See <strong>App Integration Tab<\/strong>. Copy Code and run it in SSMS to create a new linked server.\n<div id=\"attachment_7366\" style=\"width: 774px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/data-gateway-code-generator-sql-linked-server.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7366\" class=\"size-full wp-image-7366\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/data-gateway-code-generator-sql-linked-server.png\" alt=\"ZappySys Data Gateway code generator for Linked Server\" width=\"764\" height=\"702\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/data-gateway-code-generator-sql-linked-server.png 764w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/data-gateway-code-generator-sql-linked-server-300x276.png 300w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/><\/a><p id=\"caption-attachment-7366\" class=\"wp-caption-text\">ZappySys Data Gateway code generator for Linked Server<\/p><\/div><\/li>\n<li>If things go well when you execute code you may see some result in grid.<\/li>\n<\/ol>\n<h3>Run sample Queries to call Bing API in SQL Server \/ Import Data<\/h3>\n<p>Once Linked Server is created we can run various queries like below.<\/p>\n<p><strong>Example-1<\/strong><\/p>\n<pre class=\"lang:tsql decode:true\">--use all default settings from gateway data source UI\r\n--Read\r\nSelect * from OPENQUERY( [YourLinkedServer] , 'select * from $')&amp;nbsp;\r\n\r\n\/*\r\n--import\r\nSelect * into #tempTable from OPENQUERY( [YourLinkedServer] , 'select * from $')\u00a0\r\nSelect * from #tempTable\r\n*\/<\/pre>\n<p><strong>Example-2<\/strong><\/p>\n<pre class=\"lang:tsql decode:true \">--use Filter to extract specific Node from response XML\r\nSelect * from OPENQUERY( [YourLinkedServer] , \r\n'select * from $\r\nWITH(Filter=''$.s:Envelope.s:Body.GetUserRequest[*]'',\u00a0\r\n  ElementsToTreatAsArray=''GetUserResponse'' \r\n   )'\r\n)<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Example-3<\/strong><\/p>\n<pre class=\"lang:tsql decode:true \">--Override URL, Headers and Body Settings. Change DeveloperToken in below request\r\n--Header, Filter, URL, Request data is different for each Endpoint\r\n\r\nSELECT * FROM OPENQUERY([YourLinkedServer]\r\n, 'SELECT * FROM $\r\nWITH(\r\n\t ElementsToTreatAsArray=''GetUserResponse''\r\n\t,Src=''https:\/\/clientcenter.api.bingads.microsoft.com\/Api\/CustomerManagement\/v13\/CustomerManagementService.svc''\r\n\t,Filter=''$.s:Envelope.s:Body.GetUserResponse[*]''\t\r\n\t,Header=''SOAPAction: \"GetUser\"''\t\r\n\t,RequestData=''&lt;soapenv:Envelope xmlns:soapenv=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" xmlns:v13=\"https:\/\/bingads.microsoft.com\/Customer\/v13\"&gt;\r\n&lt;soapenv:Header&gt;\r\n   &lt;v13:DeveloperToken&gt;1052xxxxxxxxxxxxx&lt;\/v13:DeveloperToken&gt;\r\n   &lt;v13:AuthenticationToken&gt;&lt;%access_token%&gt;&lt;\/v13:AuthenticationToken&gt;\r\n&lt;\/soapenv:Header&gt;\r\n&lt;soapenv:Body&gt;\r\n   &lt;v13:GetUserRequest&gt;\r\n      &lt;v13:UserId xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:nil=\"true\"\/&gt;\r\n   &lt;\/v13:GetUserRequest&gt;\r\n&lt;\/soapenv:Body&gt;\r\n&lt;\/soapenv:Envelope&gt;''\r\n)')<\/pre>\n<p>&nbsp;<\/p>\n<h3>Download Bing Ads Performance Data in SQL Server Table<\/h3>\n<p>Now lets look at more complex example to read data from Bing Performance Report. Calling This API is tricky due to many steps involved in data extraction. But not to worry if you use ZappySys Drivers. This is API is somewhat similar as <a href=\"https:\/\/zappysys.com\/blog\/import-amazon-mws-data-sql-server-t-sql\/\" target=\"_blank\" rel=\"noopener\">Amazon MWS Report Request (See last section)<\/a>.<\/p>\n<p>Here are high level steps needs to be performed to call API for Bing Ads Report (e.g. Performance Report)<\/p>\n<ol>\n<li>Call\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/advertising\/reporting-service\/submitgeneratereport?view=bingads-13\" target=\"_blank\" rel=\"noopener\">SubmitGenerateReportResponse<\/a> API to request new Report. This returns\u00a0ReportRequestId<\/li>\n<li>Now we have to keep checking every few seconds see report is ready or not. Call <a href=\"https:\/\/docs.microsoft.com\/en-us\/advertising\/reporting-service\/pollgeneratereport?view=bingads-13\" target=\"_blank\" rel=\"noopener\">PollGenerateReport<\/a>\u00a0until Status field is Success from Pending<\/li>\n<li>Once previous step returns Success extract Report Download URL (Its Zip File which may contain data in CSV or XML)<\/li>\n<\/ol>\n<p>So lets get started to implement above login in a single T-SQL Query and load data into Table. There is a known limitation with Query Size we can send to data gateway from SSMS so we can use some tricks to read Body from File rather than hard coding in SQL. We can use\u00a0IsMultiPart=True and then supply Filepath in RequestBody (Path must start with @ symbol)<\/p>\n<ol>\n<li>Bing Report API needs 2 additional values along with DeveloperToken we got earlier. You need to supply <strong>AccountId<\/strong> and <strong>CustomerId<\/strong> part of Body so obtain it by visiting below page in your bing account.<br \/>\nVisit <a href=\"https:\/\/ads.microsoft.com\/cc\/accounts\" target=\"_blank\" rel=\"noopener\">https:\/\/ads.microsoft.com\/cc\/accounts<\/a><\/p>\n<div id=\"attachment_7362\" style=\"width: 666px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/how-to-get-bing-ads-accountid-customerid.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7362\" class=\"size-full wp-image-7362\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/how-to-get-bing-ads-accountid-customerid.png\" alt=\"Obtain Bing Ads AccountId, ClientId for APi calls\" width=\"656\" height=\"556\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/how-to-get-bing-ads-accountid-customerid.png 656w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/how-to-get-bing-ads-accountid-customerid-300x254.png 300w\" sizes=\"(max-width: 656px) 100vw, 656px\" \/><\/a><p id=\"caption-attachment-7362\" class=\"wp-caption-text\">Obtain Bing Ads AccountId, ClientId for APi calls<\/p><\/div><\/li>\n<li>Create new XML file for first step in a Notepad. Enter below content and save as\u00a0<strong>C:\\Requests\\BingAds\\sql_body1.xml<\/strong><br \/>\nReplace Following Values as per your settingsCustomerAccountId (Found 2 places)<br \/>\nCustomerId<br \/>\nDeveloperToken<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;s:Envelope xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\r\n  &lt;s:Header&gt;\r\n    &lt;h:ApplicationToken i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:AuthenticationToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;&lt;%access_token%&gt;&lt;\/h:AuthenticationToken&gt;\r\n    &lt;h:CustomerAccountId xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;481xxxxxxxxxxx&lt;\/h:CustomerAccountId&gt;\r\n    &lt;h:CustomerId xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;191xxxxxxxxxxx&lt;\/h:CustomerId&gt;\r\n    &lt;h:DeveloperToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;1052Bxxxxxxxxxxx&lt;\/h:DeveloperToken&gt;\r\n    &lt;h:Password i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:UserName i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n  &lt;\/s:Header&gt;\r\n  &lt;s:Body&gt;\r\n    &lt;SubmitGenerateReportRequest xmlns=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;\r\n      &lt;ReportRequest i:type=\"CampaignPerformanceReportRequest\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"&gt;\r\n        &lt;ExcludeColumnHeaders&gt;false&lt;\/ExcludeColumnHeaders&gt;\r\n        &lt;ExcludeReportFooter&gt;false&lt;\/ExcludeReportFooter&gt;\r\n        &lt;ExcludeReportHeader&gt;false&lt;\/ExcludeReportHeader&gt;\r\n        &lt;Format&gt;Xml&lt;\/Format&gt;\r\n        &lt;ReportName&gt;My Campaign Performance Report&lt;\/ReportName&gt;\r\n        &lt;ReturnOnlyCompleteData&gt;false&lt;\/ReturnOnlyCompleteData&gt;\r\n        &lt;Aggregation&gt;Hourly&lt;\/Aggregation&gt;\r\n        &lt;Columns&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;TimePeriod&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;AccountId&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;CampaignId&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;CampaignName&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;CampaignStatus&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;DeviceType&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;BidMatchType&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;QualityScore&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;AdRelevance&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;LandingPageExperience&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Revenue&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Assists&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;ExpectedCtr&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;DeliveredMatchType&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;AveragePosition&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Conversions&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;AdDistribution&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Network&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Clicks&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Impressions&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Ctr&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;AverageCpc&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;Spend&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;LowQualityClicks&lt;\/CampaignPerformanceReportColumn&gt;\r\n          &lt;CampaignPerformanceReportColumn&gt;LowQualityConversionRate&lt;\/CampaignPerformanceReportColumn&gt;\r\n        &lt;\/Columns&gt;\r\n        &lt;Filter&gt;\r\n          &lt;AccountStatus i:nil=\"true\" \/&gt;\r\n          &lt;AdDistribution i:nil=\"true\" \/&gt;\r\n          &lt;DeviceOS i:nil=\"true\" \/&gt;\r\n          &lt;DeviceType i:nil=\"true\" \/&gt;\r\n          &lt;Status i:nil=\"true\" \/&gt;\r\n        &lt;\/Filter&gt;\r\n        &lt;Scope&gt;\r\n          &lt;AccountIds xmlns:a=\"http:\/\/schemas.microsoft.com\/2003\/10\/Serialization\/Arrays\"&gt;\r\n            &lt;a:long&gt;481xxxxxxxxxxx&lt;\/a:long&gt;\r\n          &lt;\/AccountIds&gt;\r\n          &lt;Campaigns i:nil=\"true\" \/&gt;\r\n        &lt;\/Scope&gt;\r\n        &lt;Time&gt;\r\n          &lt;CustomDateRangeEnd i:nil=\"true\" \/&gt;\r\n          &lt;CustomDateRangeStart i:nil=\"true\" \/&gt;\r\n          &lt;PredefinedTime&gt;Yesterday&lt;\/PredefinedTime&gt;\r\n          &lt;ReportTimeZone&gt;PacificTimeUSCanadaTijuana&lt;\/ReportTimeZone&gt;\r\n        &lt;\/Time&gt;\r\n      &lt;\/ReportRequest&gt;\r\n    &lt;\/SubmitGenerateReportRequest&gt;\r\n  &lt;\/s:Body&gt;\r\n&lt;\/s:Envelope&gt;<\/pre>\n<p>&nbsp;<\/li>\n<li>Create another XML file for second step in a Notepad. Enter below content and save as\u00a0<strong>C:\\Requests\\BingAds\\sql_body2.xml<\/strong><br \/>\nReplace following values as per your need.<\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;s:Envelope xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\r\n  &lt;s:Header&gt;\r\n    &lt;h:ApplicationToken i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:AuthenticationToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;&lt;%access_token%&gt;&lt;\/h:AuthenticationToken&gt;\r\n    &lt;h:CustomerAccountId xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;480xxxxxxxxxxx&lt;\/h:CustomerAccountId&gt;\r\n    &lt;h:CustomerId xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;191xxxxxxxxxxx&lt;\/h:CustomerId&gt;\r\n    &lt;h:DeveloperToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;1052Bxxxxxxxxxxx&lt;\/h:DeveloperToken&gt;\r\n    &lt;h:Password i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:UserName i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n  &lt;\/s:Header&gt;\r\n  &lt;s:Body&gt;\r\n    &lt;PollGenerateReportRequest xmlns=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;\r\n      &lt;ReportRequestId&gt;[$a.ReportRequestId$]&lt;\/ReportRequestId&gt;\r\n    &lt;\/PollGenerateReportRequest&gt;\r\n  &lt;\/s:Body&gt;\r\n&lt;\/s:Envelope&gt;<\/pre>\n<p>&nbsp;<\/li>\n<li>Now try to execute below query. This should generate Performance report and download it in a SQL table for you.\n<pre class=\"lang:tsql decode:true\">select * into tmpBingAdsReport from OPENQUERY(Zs_BingAds,\r\n'SELECT c.* FROM $\r\nWITH(\r\n\t--submit report request for XML format\r\n\r\n\t alias=''a'' \r\n\t,Src=''https:\/\/reporting.api.bingads.microsoft.com\/Api\/Advertiser\/Reporting\/v13\/ReportingService.svc''\r\n\t,Filter=''$.s:Envelope.s:Body.SubmitGenerateReportResponse''\r\n\t,RequestData=''@C:\\Requests\\BingAds\\sql_body1.xml''\r\n\t,IsMultiPart=''True''\r\n\t,RequestContentTypeCode=''TextXml''\r\n\t,Header=''SOAPAction: \"SubmitGenerateReport\"''\r\n\t,RequestMethod=''POST''\r\n\t,EnableBodyPlaceholderForMultiPart=''True''\r\n\t,Meta=''[{\"Name\": \"ReportRequestId\",\"Type\": \"Int64\"}]''\r\n\r\n\t--keep checking status until report is ready - returns final url when done\r\n\r\n\t,join1_alias=''b''\r\n\t,join1_Filter=''$.s:Envelope.s:Body.PollGenerateReportResponse.ReportRequestStatus''\r\n\t,join1_RequestData=''@C:\\Requests\\BingAds\\sql_body2.xml''\r\n\t,join1_IsMultiPart=''True''\r\n\t,join1_Src=''https:\/\/reporting.api.bingads.microsoft.com\/Api\/Advertiser\/Reporting\/v13\/ReportingService.svc''\r\n\t,join1_RequestContentTypeCode=''TextXml''\r\n\t,join1_Header=''SOAPAction: \"PollGenerateReport\"''\r\n\t,join1_RequestMethod=''POST''\r\n\t,join1_EnableBodyPlaceholderForMultiPart=''True''\r\n\t,join1_EnableStatusCheck=''True'', \r\n\t,join1_StatucCheckMaxWaitSeconds=300, --wait max 5 mins?\r\n\t,join1_StatucCheckIterationWaitSeconds=5, --check every 5 sec?\r\n\t,join1_StatusSuccessValue=''Success'', --look for success word in response\r\n\r\n\t--Download report (Zip file) and Parse rows\r\n\r\n\t,join2_alias=''c''\r\n\t,join2_DataConnectionType=''Default''\r\n\t,join2_Src=''[$b.ReportDownloadUrl$]''\r\n\t,join2_Filter=''$.Report.Table.Row[*]''\r\n\t,join2_ElementsToTreatAsArray=''Row''\t\r\n\t,join2_RequestMethod=''GET''\r\n\t,join2_IsMultiPart=''False''\r\n\t,join2_FileCompressionType=''Zip''\t\r\n)')\r\n\r\nselect * from tmpBingAdsReport<\/pre>\n<div id=\"attachment_7218\" style=\"width: 841px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7218\" class=\"size-full wp-image-7218\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table.png\" alt=\"\" width=\"831\" height=\"741\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table.png 831w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table-300x268.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/import-bing-ads-data-into-sql-server-table-768x685.png 768w\" sizes=\"(max-width: 831px) 100vw, 831px\" \/><\/a><p id=\"caption-attachment-7218\" class=\"wp-caption-text\">Import Bing Ads data into SQL Server<\/p><\/div><\/li>\n<\/ol>\n<h2>Multi Step Query to download Report<\/h2>\n<p>So in previous section we saw how to write a single query to get your Performance Report from Bing Ads. However there will be time you want to split 3 steps into seperate queries.<\/p>\n<p>Here is how to do.<\/p>\n<pre class=\"lang:tsql decode:true \">\/*\r\nRPC and RPC OUT options must be turned on to run this proc\r\n\r\nEXEC master.dbo.sp_serveroption @server=N'Zs_BingAds', @optname=N'rpc', @optvalue=N'true'\r\nEXEC master.dbo.sp_serveroption @server=N'Zs_BingAds', @optname=N'rpc out', @optvalue=N'true'\r\n--Below needed to support EXEC + INSERT (dynamic query)\r\nEXEC master.dbo.sp_serveroption @server=N'Zs_BingAds, @optname=N'remote proc transaction promotion', @optvalue=N'false'\r\nAlso \r\n1. Change Body file path\r\n2. Change CustomerAccountId, CustomerId, DeveloperToken\r\n*\/\r\n\r\nALTER proc usp_Api_BingAds_Reports\r\nas\r\n--\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n--Step-1 - submit report request for XML format\r\n--\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\ncreate table #tmpBingAdsReport_Step1(ReportRequestId bigint)\r\nINSERT into #tmpBingAdsReport_Step1\r\nEXEC(\r\n'SELECT * FROM $\r\nWITH(\r\n Src=''https:\/\/reporting.api.bingads.microsoft.com\/Api\/Advertiser\/Reporting\/v13\/ReportingService.svc''\r\n,Filter=''$.s:Envelope.s:Body.SubmitGenerateReportResponse''\r\n,RequestData=''@c:\\BWProjects\\Requests\\BingAds\\sql_body1.xml''\r\n,IsMultiPart=''True''\r\n,RequestContentTypeCode=''TextXml''\r\n,Header=''SOAPAction: \"SubmitGenerateReport\"''\r\n,RequestMethod=''POST''\r\n,EnableBodyPlaceholderForMultiPart=''True''\r\n,Meta=''[{\"Name\": \"ReportRequestId\",\"Type\": \"Int64\"}]''\r\n)') AT zs_BingAds\r\n\r\n\r\n--\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n--Step2 - keep checking status until report is ready - returns final url when done\r\n--\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n\r\ndeclare @reportid varchar(100)\r\nselect top 1 @reportid=cast(ReportRequestId as varchar(100)) from #tmpBingAdsReport_Step1\r\n\r\ncreate table #tmpBingAdsReport_Step2(ReportDownloadUrl varchar(500))\r\nINSERT into #tmpBingAdsReport_Step2 \r\nEXEC(\r\n'SELECT * FROM $\r\nWITH(\r\n Filter=''$.s:Envelope.s:Body.PollGenerateReportResponse.ReportRequestStatus''\r\n,RequestData=''&lt;s:Envelope xmlns:s=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\r\n  &lt;s:Header&gt;\r\n    &lt;h:ApplicationToken i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:AuthenticationToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;&lt;%access_token%&gt;&lt;\/h:AuthenticationToken&gt;\r\n    &lt;h:CustomerAccountId xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;480xxxxxxxxx&lt;\/h:CustomerAccountId&gt;\r\n    &lt;h:CustomerId xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;191xxxxxxxxx&lt;\/h:CustomerId&gt;\r\n    &lt;h:DeveloperToken xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;105xxxxxxxxxxx&lt;\/h:DeveloperToken&gt;\r\n    &lt;h:Password i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n    &lt;h:UserName i:nil=\"true\" xmlns:h=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\" xmlns:i=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" \/&gt;\r\n  &lt;\/s:Header&gt;\r\n  &lt;s:Body&gt;\r\n    &lt;PollGenerateReportRequest xmlns=\"https:\/\/bingads.microsoft.com\/Reporting\/v13\"&gt;\r\n      &lt;ReportRequestId&gt;'+ @reportid +'&lt;\/ReportRequestId&gt;\r\n    &lt;\/PollGenerateReportRequest&gt;\r\n  &lt;\/s:Body&gt;\r\n&lt;\/s:Envelope&gt;''\r\n--,IsMultiPart=''True''\r\n,Src=''https:\/\/reporting.api.bingads.microsoft.com\/Api\/Advertiser\/Reporting\/v13\/ReportingService.svc''\r\n,RequestContentTypeCode=''TextXml''\r\n,Header=''SOAPAction: \"PollGenerateReport\"''\r\n,RequestMethod=''POST''\r\n--,EnableBodyPlaceholderForMultiPart=''True''\r\n,EnableStatusCheck=''True'', \r\n,StatucCheckMaxWaitSeconds=300, --wait max 5 mins?\r\n,StatucCheckIterationWaitSeconds=5, --check every 5 sec?\r\n,StatusSuccessValue=''Success'', --look for success word in response\r\n,Meta=''[{\"Name\": \"ReportDownloadUrl\",\"Type\": \"String\",Length:\"300\"}]''\r\n)') AT zs_BingAds\r\n\r\n\r\ndeclare @reportpath varchar(500)\r\nselect top 1 @reportpath=ReportDownloadUrl from #tmpBingAdsReport_Step2\r\n\r\nselect * from #tmpBingAdsReport_Step1\r\nselect * from #tmpBingAdsReport_Step2\r\n\r\n--\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n--Step-3 - Get report file\r\n--\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n--Static table\r\n--\/\/INSERT INTO BingAdsReport\r\nEXEC(\r\n'SELECT * FROM $\r\nWITH(\r\n DataConnectionType=''Default''\r\n,Src='''+ @reportpath +'''\r\n,Filter=''$.Report.Table.Row[*]''\r\n,ElementsToTreatAsArray=''Row''\t\r\n,RequestMethod=''GET''\r\n,IsMultiPart=''False''\r\n,FileCompressionType=''Zip''\t\r\n)') AT zs_BingAds\r\n\r\n\r\n--select * from tmpBingAdsReport_Step3\r\n--select * from openquery(Bing, 'select * from $')\r\n\r\n\r\n\/*\r\nselect * into tmpBingAdsReport from OPENQUERY(zs_BingAds,\r\n'SELECT c.* FROM $\r\nWITH(\r\n--submit report request for XML format\r\n\r\nalias=''a'' \r\n,Src=''https:\/\/reporting.api.bingads.microsoft.com\/Api\/Advertiser\/Reporting\/v13\/ReportingService.svc''\r\n,Filter=''$.s:Envelope.s:Body.SubmitGenerateReportResponse''\r\n,RequestData=''@c:\\BWProjects\\Requests\\BingAds\\sql_body1.xml''\r\n,IsMultiPart=''True''\r\n,RequestContentTypeCode=''TextXml''\r\n,Header=''SOAPAction: \"SubmitGenerateReport\"''\r\n,RequestMethod=''POST''\r\n,EnableBodyPlaceholderForMultiPart=''True''\r\n,Meta=''[{\"Name\": \"ReportRequestId\",\"Type\": \"Int64\"}]''\r\n\r\n--keep checking status until report is ready - returns final url when done\r\n\r\n,join1_alias=''b''\r\n,join1_Filter=''$.s:Envelope.s:Body.PollGenerateReportResponse.ReportRequestStatus''\r\n,join1_RequestData=''@c:\\BWProjects\\Requests\\BingAds\\sql_body2.xml''\r\n,join1_IsMultiPart=''True''\r\n,join1_Src=''https:\/\/reporting.api.bingads.microsoft.com\/Api\/Advertiser\/Reporting\/v13\/ReportingService.svc''\r\n,join1_RequestContentTypeCode=''TextXml''\r\n,join1_Header=''SOAPAction: \"PollGenerateReport\"''\r\n,join1_RequestMethod=''POST''\r\n,join1_EnableBodyPlaceholderForMultiPart=''True''\r\n,join1_EnableStatusCheck=''True'', \r\n,join1_StatucCheckMaxWaitSeconds=300, --wait max 5 mins?\r\n,join1_StatucCheckIterationWaitSeconds=5, --check every 5 sec?\r\n,join1_StatusSuccessValue=''Success'', --look for success word in response\r\n\r\n--Download report (Zip file) and Parse rows\r\n\r\n,join2_alias=''c''\r\n,join2_DataConnectionType=''Default''\r\n,join2_Src=''[$b.ReportDownloadUrl$]''\r\n,join2_Filter=''$.Report.Table.Row[*]''\r\n,join2_ElementsToTreatAsArray=''Row''\t\r\n,join2_RequestMethod=''GET''\r\n,join2_IsMultiPart=''False''\r\n,join2_FileCompressionType=''Zip''\t\r\n)')\r\n\r\nselect * from tmpBingAdsReport\r\n\r\nselect * from openquery(Bing, 'select * from $')\r\n*\/\r\ngo<\/pre>\n<p>&nbsp;<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article we saw how to import Bing Ads API data in SQL Server without any coding using <a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys ODBC PowerPack (SOAP \/ XML Driver)<\/a>. Download it it and try it for FREE to explore many API integration features not discussed in this article.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In our previous blog post we saw how to import REST \/ SOAP API in SQL Server. Using same concepts let&#8217;s look at how to import Bing Ads data into SQL Server. We will explore many techniques to call Bing Ads API and learn how to automate data extraction without doing any ETL. You [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7363,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[380,225,347,278],"tags":[513,67,7],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>Import Bing Ads data into SQL Server (Performance Reports) | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"Learn how to Import Bing Ads API into SQL Server using T-SQL code in few minutes. Extract and Download Performance Reports by calling Bing Ads API (OAuth).\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Import Bing Ads data into SQL Server (Performance Reports) | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"Learn how to Import Bing Ads API into SQL Server using T-SQL code in few minutes. Extract and Download Performance Reports by calling Bing Ads API (OAuth).\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ZappySys\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2019-06-13T21:04:57+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2024-09-25T13:50:14+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"300\" \/>\r\n\t<meta property=\"og:image:height\" content=\"250\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/zappysys\/\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/\",\"url\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/\",\"name\":\"Import Bing Ads data into SQL Server (Performance Reports) | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png\",\"datePublished\":\"2019-06-13T21:04:57+00:00\",\"dateModified\":\"2024-09-25T13:50:14+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82\"},\"description\":\"Learn how to Import Bing Ads API into SQL Server using T-SQL code in few minutes. Extract and Download Performance Reports by calling Bing Ads API (OAuth).\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png\",\"width\":300,\"height\":250},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Import Bing Ads data into SQL Server (Performance Reports)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82\",\"name\":\"ZappySys\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g\",\"caption\":\"ZappySys\"},\"sameAs\":[\"http:\/\/www.zappysys.com\/\",\"https:\/\/www.facebook.com\/ZappySys\/\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/zappysys\/\"],\"url\":\"https:\/\/zappysys.com\/blog\/author\/admin\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Import Bing Ads data into SQL Server (Performance Reports) | ZappySys Blog","description":"Learn how to Import Bing Ads API into SQL Server using T-SQL code in few minutes. Extract and Download Performance Reports by calling Bing Ads API (OAuth).","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/","og_locale":"en_US","og_type":"article","og_title":"Import Bing Ads data into SQL Server (Performance Reports) | ZappySys Blog","og_description":"Learn how to Import Bing Ads API into SQL Server using T-SQL code in few minutes. Extract and Download Performance Reports by calling Bing Ads API (OAuth).","og_url":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/","og_site_name":"ZappySys Blog","article_author":"https:\/\/www.facebook.com\/ZappySys\/","article_published_time":"2019-06-13T21:04:57+00:00","article_modified_time":"2024-09-25T13:50:14+00:00","og_image":[{"width":300,"height":250,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png","type":"image\/png"}],"author":"ZappySys","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/zappysys\/","twitter_misc":{"Written by":"ZappySys","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/","url":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/","name":"Import Bing Ads data into SQL Server (Performance Reports) | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png","datePublished":"2019-06-13T21:04:57+00:00","dateModified":"2024-09-25T13:50:14+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82"},"description":"Learn how to Import Bing Ads API into SQL Server using T-SQL code in few minutes. Extract and Download Performance Reports by calling Bing Ads API (OAuth).","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/06\/bing-ads-logo.png","width":300,"height":250},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/import-bing-ads-data-sql-server-performance-reports\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Import Bing Ads data into SQL Server (Performance Reports)"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/2756c237457fbc95d82cb38962f81f82","name":"ZappySys","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c9be148088ba9b8af8e955c5f7c22b5?s=96&d=mm&r=g","caption":"ZappySys"},"sameAs":["http:\/\/www.zappysys.com\/","https:\/\/www.facebook.com\/ZappySys\/","https:\/\/twitter.com\/https:\/\/twitter.com\/zappysys\/"],"url":"https:\/\/zappysys.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/7217"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=7217"}],"version-history":[{"count":18,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/7217\/revisions"}],"predecessor-version":[{"id":11178,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/7217\/revisions\/11178"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/7363"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=7217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=7217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=7217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}