--- title: "End-to-End example" slug: "end-to-end-example" description: "Learn how to implement full data integration flow from authorizing the service to creating a source and attaching it to the flow with Snapchat as an example." updated: 2024-04-17T06:47:46Z published: 2024-04-17T06:47:46Z canonical: "docs.dataddo.com/end-to-end-example" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.dataddo.com/llms.txt > Use this file to discover all available pages before exploring further. # End-to-End Example This Snapchat **end-to-end example** demonstrates implementation of a full data integration ***flow***. This includes service authorization, ***source*** creation and connection to the ***flow***, ## Prerequisites - You have obtained an API access, Client ID and Client Secret to your Snapchat app. - You have implemented an OAuth 2.0 authorization flow to obtain refresh tokens from the users. ## Authorizing a Service In this example, we use a Snapchat ***authorizer*** with a [refresh token](/headless/docs/creating-an-authorizer#refresh-token-flow) flow is used. This method requires an independent implementation of OAuth 2.0 to make sure you can obtain refresh tokens from your users. ### Request ``` POST /services { "service": "snapchat_static", "data": { "staticKey": "REFRESH_TOKEN", "clientId": "YOUR_APP_CLIENT_ID", "clientSecret": "YOUR_APP_CLIENT_SECRET" } } ``` ### Response ``` { "id":1000 } ``` ## Creating a Source To create a ***source*** (in this case Snapchat), the following will be needed: - Provide the ID of the newly created ***authorizer*** (returned in the response of the previous step) - Other parameters specific for each ***source*** type | Parameter | Description | | --- | --- | | **oAuthId** | ID of the authorized service. Use the value generated by the [reponse of the previous step](/headless/docs/end-to-end-example#response). | | **organizationId** | ID of the Snapchat organization. You can use specific API endpoint to retrieve all organization IDs. | | **accountId** | ID of the Snapchat account. You can use specific API endpoint to retrieve all account IDs. | ### Request ``` POST /connectors/snapchat/create-source {"connectorId":"snapchat","templateId":"index","oAuthId":OAUTH_ID,"organizationId":"ORGANIZATION_ID","accountId":"ACCOUNT_ID","label":"Snapchat Insights","breakdown":"campaign","metrics":["spend","impressions"],"labels":["stats_id","stats_type","stats_start_time","stats_end_time"],"action_report_time":"conversion","swipe_up_attribution_window":"28_DAY","view_attribution_window":"1_DAY","sync_frequency":"day","day_of_week":"2","day_of_month":"1","hour":"3","minute":"25","timezone":"UTC","dateRange":"{{30d1}}","dateRangePreview":"{{30d1}}","search":"","request":null,"type":"snapchat","strategy":"incremental"} ``` ### Response ``` { "id": "string", "label": "string" } ``` ## Adding a Source to the Flow In this step, we create a simple ***flow*** that sends the data to Google Data Studio via an HTTP endpoint. ### Request ``` { "sources":["63b872052946b21e6d063cb2"], "app":"google_data_studio", "label":"GDS Flow" } ``` ### Response As you can see from the response, the API endpoint is attached to the ***flow*** which allows you to directly access the data. ``` { "label":"GDS Flow", "source":[{"source_id":"63b872052946b21e6d063cb2"}], "api":{ "app":"google_data_studio", "id":"63c47935b11d93741a0f1583" }, "id":"63c47935b11d93741a0f1582" } ```