Recipient Data Share Functions

The procedures listed here covers all the functions required by a Recipient of a Data Share.

Create Recipient Procedure

This function creates a Data Share Recipient.

Syntax

Share.create_recipient(name, email, description, owner, shares,
    token_lifetime)
The following are it's parameters and descriptions:
  • name: The name of the Recipient. This field is mandatory.
  • email: This field displays the mail address of the Recipient.
  • description: This field displays the description of the Recipient. If this field is missing, the tool uses an empty string.
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.
  • shares: You can view the following fields in the recipient shares dictionary: "[{"name","shareNameValue"},...]". If a parameter is missing, the tool uses an empty dictionary "[]".
  • token_lifetime: The tool uses recipient token lifetime in this format 'D HH:MM:SS'. If this field is missing, the tool uses '0 00:60:00'.

Example
In this example, you can create a Data Share Recipient:
adp.Share.create_recipient(
    name  = 'test_py_api_recipient_1',
    email = 'test@gmail.com'
)

//Output:
'{"createRecipient":true,"name":"TEST_PY_API_RECIPIENT_1"}'

Update Recipient Share Procedure

This function updates a Data Share Recipient.

Syntax

Share.update_recipient_shares(name, shares, owner)
The following are it's parameters and descriptions:
  • name: The name of the Recipient. This field is mandatory.
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.
  • shares: You can view the following fields in the recipient shares dictionary: "[{"name","shareNameValue"},...]". If a parameter is missing, the tool uses an empty dictionary "[]".

Example
In this example, you can update a Data Share Recipient:
recipient_name = 'test_py_api_recipient_1'
shares = json.dumps([{"name":'share_py_api_7'}])
adp.Share.update_recipient_shares(name = recipient_name, shares = shares)

//Output:
'{"status" : true}'

Delete Recipient Procedure

This function deletes a Data Share Recipient.

Syntax

Share.delete_recipient(name, owner)
The following are it's parameters and descriptions:
  • name: The name of the Recipient. This field is mandatory.
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.

Example
In this example, you can delete a Data Share Recipient:
adp.Share.delete_recipient (name  = 'renamed_test_py_api_recipient_2')

//Output:
'{ "status": true }'

Rename Recipient Procedure

This function renames a Data Share Recipient.

Syntax

Share.rename_recipient(name, new_name, owner)
The following are it's parameters and descriptions:
  • name: The name of the Recipient. This field is mandatory.
  • new_name: The name of the Recipient you want. This field is mandatory.
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.

Example
In this example, you can rename a Data Share Recipient:
adp.Share.rename_recipient(name = 'test_py_api_recipient_1', new_name = 'test_py_api_recipient_2')
//Output:
'{ "status": true }'

Get Recipient Procedure

This function receives details of the Data Share Recipient.

Syntax

Share.get_recipient(name, owner)
The following are it's parameters and descriptions:
  • name: The name of the Recipient. This field is mandatory.
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.

Example
In this example, you can receive details of a Data Share Recipient:
s = adp.Share.get_recipient('test_py_api_recipient_2')
json.loads(s)

//Output:
{'name': 'TEST_PY_API_RECIPIENT_2',
 'id': 40436,
 'type': 'DELTA_SHARING',
 'description': None,
 'email': 'test@gmail.com',
 'clientId': 'xxxxxxxxxxxx..',
 'clientSecret': 'xxxxxxxxxxxxxx..',
 'tokenDuration': None,
 'shares': [{'name': 'SHARE_PY_API_7',
   'id': 40419,
   'description': 'desc_share_py_api_7',
   'tablesCount': 2}],
 'created': '2024-11-12T15:34:08',
 'updated': '2024-11-12T15:36:13'}

Get Recipients Procedure

This function receives a list of Data Share Recipients based on data schema recipients owner.

Syntax

Share.get_recipients(owner)
The following are it's parameters and descriptions:
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.

Example
In this example, you can receive a list of Data Share Recipients:
s = adp.Share.get_recipients()
json.loads(s)
//Output:
[{'id': 40436,
  'name': 'TEST_PY_API_RECIPIENT_2',
  'type': 'DELTA_SHARING',
  'description': None,
  'email': 'test@gmail.com'}]

Get Recipient Sharing Profile Procedure

This function receives Recipient's Data Sharing profile.

Syntax

Share.get_recipient_sharing_profile(name, owner)
The following are it's parameters and descriptions:
  • name: The name of the Recipient. This field is mandatory.
  • owner: This field displays the Recipient owner. If this field is missing, the tool uses the current schema owner.

Example
In this example, you can receive the Data Sharing profile of a Data Share Recipient:
s = adp.Share.get_recipient_sharing_profile('test_py_api_recipient_2')
json.loads(s)

//Output:
{'shareCredentialsVersion': 2,
 'type': 'persistent_oauth2.0',
 'endpoint': 'https://abc-xyz//xx/delta_sharing',
 'tokenEndpoint': 'https://abcdefg.xx.com/adp/admin/oauth/token',
 'clientId': 'abcdefghijklmnopg..',
 'clientSecret': 'abcdefrtyuioohh..'}