{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Integrations","type":"markdown"},"seo":{"title":"Web Server and HTTP Put Endpoint Export Integration","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"web-server-and-http-put-endpoint-export-integration","__idx":0},"children":["Web Server and HTTP Put Endpoint Export Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can write job results from Treasure Data directly to a web server or HTTP API that accepts a PUT request."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Basic knowledge of Treasure Data, including the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/"},"children":["TD Toolbelt"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A web server configured to accept query results as PUT requests."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"static-ip-address-of-treasure-data-integration","__idx":2},"children":["Static IP Address of Treasure Data Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your security policy requires IP whitelisting, you must add Treasure Data's IP addresses to your allowlist to ensure a successful connection."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Please find the complete list of static IP addresses, organized by region, at the following ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/endpoints/ip-addresses-integrations-result-workers"},"children":["document"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"use-the-treasure-console-to-create-your-connection","__idx":3},"children":["Use the Treasure Console to Create Your Connection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use the Treasure Console to configure your connection."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-new-connection","__idx":4},"children":["Create a New Connection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Go to TD Catalog; search and select the integration."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"get-your-web-server-connection-details","__idx":5},"children":["Get Your Web Server Connection Details"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Obtain your credentials to access your HTTP endpoint if any are required."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"write-the-query","__idx":6},"children":["Write the Query"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Go to the Treasure Console query editor page and compile your query."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"specify-the-result-export-details","__idx":7},"children":["Specify the Result Export Details."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After your query setup is complete, select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Export Results"]}," located at the top right of your query editor."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191107-200348.5827697cbd1a5c4160dab7ef09d1e1680b6e89e109d912cd2dc36c5dc3640399.f854537a.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Choose Integration dialog opens. Type the connection name in the search box to filter and select your connection. In the Create Integration pane, select HTTP PUT from the drop-down menu. Edit all the information, including your ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Host, Port, and username and password"]}," if applicable."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191107-200437.4506a6e4c8f3917970e6779c816bc6cdec89aef7c4f88e10eb5c66c9d65b5e44.f854537a.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a port number is not specified, the default value is 80 for HTTP and 443 for HTTPS. If username and password are not given, then authentication is not used."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save and Continue"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"set-transfer-settings","__idx":8},"children":["Set Transfer Settings"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After setting up your connection, set the transfer parameters. Enter the endpoint path and parameter information."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191107-200517.7c6488d204aab972ee27a0349a4e91ed2d58f4f7f4cf07863987ba66e448e224.f854537a.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"domain-field-configuration","__idx":9},"children":["Domain Field Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enter only the domain information in the host field. Do not include the URL path in the host field. The following examples show endpoint URLs and their respective values."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example endpoint #1:"]}," http://www.yourdomain.com:80/api/custom_resources/resources"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Host"]},": www.yourdomain.com"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Port"]},": 80"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path & Params:"]}," /api/custom_resources/resources"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example endpoint #2:"]}," http://testapis.co/rest/api"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Host"]},":testapis.co"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path & Params:"]}," /rest/api"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example endpoint #3:"]}," http://www.randomapi.com/rest/api?parameter1"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Host"]},":www.randomapi.com"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path & Params:"]}," /rest/api?parameter1"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"execute-the-query","__idx":10},"children":["Execute the Query"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Either save the query with a name and run or just run the query. Upon successful completion of the query, the query result is automatically exported to the endpoint specified using a PUT request."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"activate-a-segment-in-audience-studio","__idx":11},"children":["Activate a Segment in Audience Studio"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also send segment data to the target platform by creating an activation in the Audience Studio."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Audience Studio"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select a parent segment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open the target segment, right-mouse click, and then select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create Activation."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Details"]}," panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Customize the activation output in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Output Mapping"]}," panel."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/ouput.b2c7f1d909c4f98ed10f5300df858a4b19f71a3b0834df952f5fb24018a5ea78.8ebdf569.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Attribute Columns",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Export All Columns"]}," to export all columns without making any changes."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["+ Add Columns"]}," to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["+ Add Columns"]},"to add new columns for your activation output."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["String Builder",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["+ Add string"]}," to create strings for export. Select from the following values:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["String: Choose any value; use text to create a custom value."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Timestamp: The date and time of the export."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Segment Id: The segment ID number."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Segment Name: The segment name."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Audience Id: The parent segment number."]}]}]}]}]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":6},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Set a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Schedule"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/snippet-output-connector-on-audience-studio-2024-08-28.a99525173709da1eb537f839019fa7876ffae95045154c8f2941b030022f792c.8ebdf569.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the values to define your schedule and optionally include email notifications."]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":7},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create"]},"."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need to create an activation for a batch journey, review ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation"},"children":["Creating a Batch Journey Activation"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage-from-cli","__idx":12},"children":["Usage from CLI"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also use CLI for Result Export to an HTTP endpoint."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"for-on-demand-jobs","__idx":13},"children":["For On-Demand Jobs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For on-demand jobs, just add the --result option to the td query command. After the job is finished, the results are sent to the specified URL via a PUT request."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td query \n  --result 'web://domain.com/path' \n  -w -d testdb \n  \"SELECT code, COUNT(1) AS cnt FROM www_access GROUP BY code\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Or doing POST request with method=post query parameter."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td query \n  --result 'web://domain.com/path?method=post' \n  -w -d testdb \n  \"SELECT code, COUNT(1) AS cnt FROM www_access GROUP BY code\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is another example URL. ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://en.wikipedia.org/wiki/Basic_access_authentication"},"children":["Basic HTTP authentication"]}," and port specification are supported."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"web://user:pass@domain.com:8080/path1/path2\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We also support transfer via HTTPS if you use webs as the protocol header instead of web. For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"webs://securedomain.com/path1/path2\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a port number is not specified, the default value is 80 for HTTP and 443 for HTTPS. If username and password are not given, then authentication is not used."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The request body is a JSON with the following fields: column_names, column_types, and data (the result of the query). An example of what the query above may output is shown below."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{ \"column_names\": [ \"code\", \"cnt\" ],\n  \"column_types\": [ \"string\", \"long\" ],\n  \"data\": [ [ \"200\", 4981 ], [ \"500\", 2 ], [ \"404\", 17 ] ] }\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The maximum number of rows is 100,000. If the result exceeds 100,000 rows, the remaining rows are thrown away."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"for-scheduled-jobs","__idx":14},"children":["For Scheduled Jobs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For scheduled jobs, just add the --result option when scheduling a job. After every job run, the results are sent via PUT requests in the same manner as on-demand jobs."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td result:create myweb web://domain.com/\n$ td sched:create hourly_count_example \"0 * * * *\" \n  -d testdb \n  --result myweb:path \n  \"SELECT code, COUNT(1) AS cnt FROM www_access GROUP BY code\"\n"},"children":[]}]},"headings":[{"value":"Web Server and HTTP Put Endpoint Export Integration","id":"web-server-and-http-put-endpoint-export-integration","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Static IP Address of Treasure Data Integration","id":"static-ip-address-of-treasure-data-integration","depth":2},{"value":"Use the Treasure Console to Create Your Connection","id":"use-the-treasure-console-to-create-your-connection","depth":2},{"value":"Create a New Connection","id":"create-a-new-connection","depth":3},{"value":"Get Your Web Server Connection Details","id":"get-your-web-server-connection-details","depth":3},{"value":"Write the Query","id":"write-the-query","depth":3},{"value":"Specify the Result Export Details.","id":"specify-the-result-export-details","depth":3},{"value":"Set Transfer Settings","id":"set-transfer-settings","depth":3},{"value":"Domain Field Configuration","id":"domain-field-configuration","depth":3},{"value":"Execute the Query","id":"execute-the-query","depth":3},{"value":"Activate a Segment in Audience Studio","id":"activate-a-segment-in-audience-studio","depth":2},{"value":"Usage from CLI","id":"usage-from-cli","depth":2},{"value":"For On-Demand Jobs","id":"for-on-demand-jobs","depth":3},{"value":"For Scheduled Jobs","id":"for-scheduled-jobs","depth":3}],"frontmatter":{"seo":{"title":"Web Server and HTTP Put Endpoint Export Integration"}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/int/web-server-and-http-put-endpoint-export-integration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}