API Integraiton - transfer

API Integration - transfer PRODUCT     AVGIDEA, INC. 

In addition to applications external to ADP, various APIs can be called in Python from functions executed by Avgidea Function.

To execute APIs from a function, Avgidea Function must be configured and quotas must be set.


Working with Storage

Objects can be retrieved and stored between the function execution environment (runtime) and Storage. Objects on the runtime are temporarily stored and deleted when the function execution ends.

# Obtaining a file from Storage

adpy.get(datasource='as1', object='file1.csv')

Function

Parameters

# Saving a file to Storage

adpy.put(datasource='as1', object='file1.csv')


Funciton

Parameters

Copying Object between Storage

You can perform object copying between Avgidea Storage Datasources.

# Copy object from as1 to as2 (single object)

adpy.log("start transfer from as1 to as2")

resp = adpy.transfer(frm='as1', to='as2',  object='sample.csv')

adpy.log("end transfer : " + resp['status'])


Function

Parameters

Return value

# Copy object from as1 to as2 (multiple objects)

adpy.log("start transfer from as1 to as2")

resp = adpy.transfer(frm='as1', to='as2', filter='sample')

adpy.log("end transfer : " + resp['status'])


Function

Parameters

Return value

Loading CSV files from storage to database

From within a function, you can send a request to load a CSV file on Storage into the database.

# Uploading CSV file from as1 to orcl

adpy.log("start transfer from as1 to orcl")

resp = adpy.transfer(frm='as1', to='orcl', object='employees.csv', table='employees', worker=4)

adpy.log("end transfer : " + resp['status'])


Function

Parameters

Return value

Extracting CSV files from a database

From within a function, you can send a request to extract a table in the database to Storage.

# Extract a CSV file from orcl to as1

adpy.log("start transfer from as1 to orcl")

resp = adpy.transfer(frm='orcl', to='as1', table='sample')

adpy.log("end transfer : " + resp['status'])


Function

Parameters

Return value