This is a Singer tap that produces JSON-formatted data following the Singer spec.
This tap:
- Pulls data from the Microsoft Dataverse Web API
- Discovers all available entities and their fields.
- Some entities are excluded as a result of testing. See
EXCLUDED_ENTITIES
in streams.py
- Some entities are excluded as a result of testing. See
- Includes a schema for each resource reflecting most recent tested data retrieved using the API. See the EntityType page for details.
- Some streams incrementally pull data based on the previously saved state. See the bookmarking strategy section for more details.
Some endpoints in the Microsoft Dataverse Web API support a modifiedon
field that allows for INCREMENTAL
replication. However, in some cases there is no such field available so the endpoints require FULL_TABLE
replication.
The API supports pagination using the @odata.nextLink
in the response. The page size for each request can be specified in the config using max_pagesize
otherwise it defaults to 100 and the API max is 5,000.
The API uses OAuth2.0 for authorization and authentication. See the Microsoft docs page for more details. The guide for adding an Azure AD app has all the required steps for setting it up.
The high level steps are as follows:
- Create an Azure AD app
- Add a
client_secret
andredirect_uri
to the Azure AD app - Obtain a
refresh_token
for the app using authorization code grant type and both offline_access and default scope. Example: offline_access <organization_uri>/.default> - Add
refresh_token
to config and the tap will retrieve the access token when run
- Install
Clone this repository, and then install using setup.py. We recommend using a virtualenv:
$ virtualenv -p python3 venv
$ source venv/bin/activate
$ pip install -e .
-
Create your tap's config.json file. The tap config file for this tap should include these entries:
start_date
- (rfc3339 date string) the default value to use if no bookmark exists for an endpointuser_agent
(string, required): Process and email for API logging purposes. Example: tap-dynamics <api_user_email@your_company.com>organization_uri
(string, required): the MS Dynamics 365 domain URI for environment. Example:https://<org-name>.<region>.dynamics.com
client_id
(string, required): The Azure AD app client idclient_secret
(string, required): The Azure AD app client secretredirect_uri
(string, required): The Azure AD app redirect URIrefresh_token
(string, required): The OAuth2.0 refresh token (see Authentication section above)api_version
(string, optional): The API version. Example: "9.2"max_pagesize
(integer, optional): The maximum number of records per page to request for pagination
And the other values mentioned in the authentication section above.
{
"start_date": "2021-04-01T00:00:00Z",
"user_agent": "Stitch Tap ([email protected])",
"organization_uri": "<https://YOUR_ORG_NAME.YOUR_INSTANCE_REGION.dynamics.com>",
"client_id": "<YOUR_AZURE_APP_CLIENT_ID>",
"client_secret": "<YOUR_AZURE_APP_CLIENT_SECRET>",
"redirect_uri": "<YOUR_AZURE_APP_REDIRECT_URI>",
"refresh_token": "<YOUR_OAUTH2.0_REFRESH_TOKEN>",
"api_version": "<DATAVERSE_WEB_API_VERSION>",
"max_pagesize": <MAX_RECORDS_PER_PAGE>
}
- Run the Tap in Discovery Mode This creates a catalog.json for selecting objects/fields to integrate:
tap-dynamics --config config.json --discover > catalog.json
See the Singer docs on discovery mode here.
- Run the Tap in Sync Mode (with catalog) and write out to state file
For Sync mode:
$ tap-dynamics --config tap_config.json --catalog catalog.json >> state.json
$ tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
To load to json files to verify outputs:
$ tap-dynamics --config tap_config.json --catalog catalog.json | target-json >> state.json
$ tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
To pseudo-load to Stitch Import API with dry run:
$ tap-dynamics --config tap_config.json --catalog catalog.json | target-stitch --config target_config.json --dry-run >> state.json
$ tail -1 state.json > state.json.tmp && mv state.json.tmp state.json
Copyright © 2018 Stitch