Listener requires the following items and conditions to create a new target:
- Metadata keys for mapping data columns
- JSON object with properties for the new target, read-only properties are ignored
- Associated source and system and connection details
- You are the owner of the associated source
Definition
POST https://listener-app-services.domain.com/v1/targets HTTP/1.1
Example Request
curl \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVfdG9rZW5fdGltZSI6MTU0MTM5OTE4MTk3ODMwOTAwMCwiZXhwIjoxNTQxNDg1NTgxLCJpZCI6Imxpc3RlbmVyIiwic2l0ZV9hZG1pbiI6dHJ1ZX0.3FBpr6sREqb34h2HWyVZZ1Nk54LoL2yVnMsvucoqoOE" \ -X POST \ -d '{ "target_id": "c1d03519-4caf-4f8e-8928-db9378de0512", "source_id": "4d4cb951-8536-4a1b-a86a-619e45661265", "system_id": "4adb9e82-bd13-4953-8daf-a0687eeed260", "owner": [ "listener" ], "collaborators": null, "created_at": "2018-11-05T09:18:10Z", "created_by": "listener", "updated_at": "2018-11-05T09:18:36Z", "updated_by": "listener", "name": "With_metadata", "description": "", "target_type": "teradata", "data_path": { "schema": "listener", "table": "test_json" }, "sample_size": 0, "system_info": { "host": "39.0.48.13", "password": "dbc", "port": "1025", "system_type": "teradata", "table": "test_json", "username": "dbc" }, "state": "1", "production": false, "bundle": false, "bundle_type": "records", "bundle_interval": 0, "data_map": { "mapping": [ { "column": "data", "field": "ls_data", "type": "JSON" }, { "column": "source_id", "field": "ls_source_id", "type": "VARCHAR" }, { "column": "time_stamp", "field": "ls_time", "type": "TIMESTAMP WITH TIME ZONE" }, { "column": "uuid", "field": "ls_uuid", "type": "VARCHAR" } ], "mapping_type": "manual" }, "properties": null, "use_dead_letter_queue": false, "dead_letter_queue": "" }' \ -i \https://listener-app-services-domain.com/targets
HDFS with Kerberos Example Request
{ "bundle": false, "bundle_interval": 0, "data_path": { "extension": "seq", "path": "/user/testuser" }, "dead_letter_queue": "", "name": "TestTargetKerberizedHDFS", "description": "Test Target Kerberized HDFS", "source_id": "{{source_id}}", "state": "1", "system_id": "{{system_id}}", "system_info": {}, "target_type": "hdfs", "properties": { "base64KeytabContent": "BQIAAABd...", "kdc": "ip-172-29-29-21.us-west-2.compute.internal:88", "principal": "testuser@CDH.US-WEST-2.COMPUTE.INTERNAL" } }
Example Response
HTTP/1.1 201 OK Content-Type: application/json
{ "target_id": "758fbda4-accc-4f90-8f09-cc0a164c8c28", "source_id": "84757abc-ba43-5736-0ba3-1bdac4748290", "system_id": "9dda5570-70e0-45be-8449-83f33320cd08", "owner": ["jd123456"], "created_at": "2015-07-04T10:20:00Z", "created_by": "av012345", "updated_at": "2015-12-20T10:20:00Z", "updated_by": "jd123456", "name": "My Data Target", "description": "A superb data target", "target_type": "teradata", "data_path": { "schema": "schema", "table": "table" }, "system_info": { "username": "ip112233", "password": "password" }, "state": 1, "production": false, "bundle": true, "bundle_type": "records", "bundle_interval": 500 }
Response Codes
Code | Description |
---|---|
201 | Target successfully created. |
400 | Required property missing from request. |
401 | Authorization header not found. |