Master CSV Import
1 POST - http://<your_account_id>.appspot.com/api/1/<master_name>/csv
Use this API to insert/update master data, For example lets consider a CountryMaster, where the field names are CountryName, Population and CountryCode.
To insert a record in CountryMaster,
csv_data: CountryName,Population,CountryCode\nGermany,100000,GER\nCanada,40000,CAN
To update existing records in CountryMaster,
csv_data: CountryName,Population,CountryCode\nGermany,1112222,GER
In the above example, CountryName is primary column. Providing an existing CountryName will update the record instead of creating new one.
using CURL command,
[for local path]
curl -H "api_key:<your_api_key>" -X POST --data-urlencode csv_data@D:\Work\CountryMaster.csv http://<your_account_id>.appspot.com/api/1/CountryMaster/csv
[OR]
curl -H "api_key:<your_api_key>" -X POST --data-urlencode [email protected]://<your_account_id>.appspot.com/api/1/CountryMaster/csv
master.csv file should in standard csv format,
CountryName,Population,CountryCode
Germany,100000,GER
Canada,40000,CAN
Note:
Deleting master data is not implemented part of REST API.
But you can replace the complete master data with new CSV file by providing an extra argument –data-urlencode “replace=Yes”