Member Roster Import
You can upload members' data without using the Member Account service user interface. To do this, you have to create an application user with administrator permissions and retrieve its credentials.
To create an application user for the Member Account service:
- Sign in to the Smart Trading Cloud at https://auth.edifecsfedcloud.com/.
- Go to the User Management page and click Create Application User on the upper-right corner.
- Enter an application name (for example, Members Upload) and click Create.
- After the new application user has been created, in group Applications, select this user in the list, and click More Actions (
).
- In the drop-down menu, select Reset Credentials to download the file with the application user credentials. This file contains a string that you will need to add to your curl requests.
- Click Yes, navigate to the location on your local drive where you want to download the .stcc file to, and click Save.
- With the application user selected, click Add to Another Group.
- Select the group Members Admins and click Add.
Note You do not need to create a new application user each time you upload data. You can use one and the same application user with the same credentials for all your uploads.
Upload Member Data using cURL
- At the command prompt, enter the following:
curl -F "file=@{ZipFileName}" -H "Authorization: CLAPP {AppUserCredentials}" -ssl -D - https://{YourOrganization’sMemberAccountServiceURL}/admin/api/members/import
Copy
curl -F "file=@roster.zip" -H "Authorization: CLAPP EAmMX9M0lrkvJS+8mZ….I9N+TCObEE=" -ssl -D - https://members.edifecsfedcloud.com/health.plan.inc/admin/api/members/import
- or -
If you access the Member Account service through a proxy server or a firewall, use the option -ssl-no-revoke:
curl –verbose –ssl-no-revoke -F "file=@{ZipFileName}" -H "Authorization: CLAPP {AppUserCredentials}" -ssl -D - https://{YourOrganization’sMemberAccountServiceURL}/admin/api/members/import
Copy
curl –verbose –ssl-no-revoke -F "file=@roster.zip" -H "Authorization: CLAPP EAmMX9M0lrkvJS+8mZ….I9N+TCObEE=" -ssl -D - https://members.edifecsfedcloud.com/health.pla.inc/admin/api/members/import
- To make sure that the data has been successfully uploaded, check the job status.
Upload Member Data using Script
You can also upload member data through a script. Unlike the cURL command, when you run the script, it downloads the report for the imported member data in response, so that you do not have to login to the application to see if the member data has been imported successfully. This report also contains any errors that might have occurred during the import, so you can take appropriate actions right away.
To run the script, provide values for the following parameters:
-
yourOrgAccountURL: Provide the URL of your organization.
-
token: Provide the application user credentials.
-
filename: Provide the name of the file that contains the member data that you want to import.
The following are the respective scripts for the Windows and Linux operating systems:
Windows
Copy
@echo off
::Put your Organization’s MemberAccountServiceURL here
set yourOrgAccountURL={YourOrganization’sMemberAccountServiceURL}
::Put your Application User token here
set token={AppUserCredentials}
::Provide the name of the file which you want to upload (should exists in same folder)
set fileName={ZipFileName}
set header_token="Authorization: CLAPP %token%"
set importURI="https://%yourOrgAccountURL%/admin/api/members/import?getReport=true"
echo:
ECHO Uploading...
::count maintained for 3 retries in case of failure
set /A retryCount=0
:upload
for /f "delims=" %%A in ('curl.exe -F "file=@%fileName%" -s -H %header_token% -ssl -D - %importURI%') do set "reportUrl=%%A"
ECHO.%reportUrl% | FIND /I "/api/jobs">Nul && (Echo:) || (
if %retryCount% lss 3 (
set /A retryCount=%retryCount%+1
Echo Retrying...
goto :upload
) else (
:: File Import failed.
echo:
Echo.Please check the Token, Account URL or FileName once.
Echo.Could not upload Roster file. Exiting...
exit /B 0
)
)
echo Roster File Uploaded
echo:
Echo Report URL: %reportUrl%
echo:
echo Downloading report...
echo:
::wait for 2 seconds till file processing
timeout 2 >Nul
:downloadReport
For /F "delims=" %%G In ('curl.exe -sOJ -H %header_token% -ssl -D - %reportUrl% -w "%%{http_code}"') do set "code=%%G"
:: response code 200 is assumed a successfully download
if %code%==200 (
echo Report has been Downloaded.
) else if %code%==204 (
Echo File is under process. Retrying...
echo:
::retry after 5 seconds
timeout 5 >Nul
goto :downloadReport
) else (
Echo.Could not download Report. Status code: %code%
echo:
Echo Please wait for some time and use the below curl to check the status of imported file:
echo:
Echo curl.exe -sOJ -H %header_token% -ssl -D - %reportUrl%
echo:
)
exit /B 0
Linux
Copy
#!/bin/bash
#Put your Organization’s MemberAccountServiceURL here
yourOrgAccountURL={YourOrganization’sMemberAccountServiceURL}
#Put your Application User token here
token={AppUserCredentials}
#Provide the name of the file which you want to upload (should exists in same folder)
fileName={ZipFileName}
header_token="Authorization: CLAPP ${token}"
importURI="https://${yourOrgAccountURL}/admin/api/members/import?getReport=true"
echo
echo Uploading...
echo
#count maintained for 3 retries in case of failure
retryCount=0
reportUrl=""
while [ $retryCount -lt 3 ];
do
response=$(curl -F "file=@${fileName}" -s -H "${header_token}" -ssl -D - $importURI)
reportUrl=$(echo "$response" | tail -n 1)
if [[ $reportUrl = *'/api/jobs'* ]]; then
break
fi
echo Retrying...
let retryCount++;
done
if [ $retryCount -eq 3 ] || [ -z $reportUrl ]
then
echo
echo Please check the Token, Account URL or FileName once.
echo Could not upload Roster file. Exiting...
exit 1
fi
echo
echo Roster File Uploaded
echo
echo Report URL: $reportUrl
echo
echo Downloading report...
echo
#wait for 2 seconds till file processing
sleep 2s
while true
do
code=$(curl -sOJ -H "${header_token}" -ssl $reportUrl -w %{http_code})
# response code 200 is assumed a successfully download
if [ $code -eq 200 ]
then
echo Report has been Downloaded.
exit 0
elif [ $code -eq 204 ]
then
echo File is under process. Retrying...
echo
# retry after 5 seconds
sleep 5s
else
echo Could not download Report. Status code: $code
break
fi
done
echo
echo Please wait for some time and use the below curl to check the status of imported file:
echo
echo curl -sOJ -H '"'"$header_token"'"' -ssl -D - $reportUrl
echo
exit 0