EveryonePrint includes a REST based API, which can be used for automated tasks, such as importing users email addresses from a scheduled task.
Refer to EveryonePrint Install Guide for general configuration and usage of the REST API (chapter "17. EveryonePrint API")
The following guide outlines an example of a text file containing username and email addresses for users and a Windows BAT file which can be scheduled in Windows scheduler.
- Create a txt file called emails.txt containing user email addresses, such as:
john,john@gmail.com
jane,jane@gmail.com - Create a bat file called email-import.bat containing the following script:
@echo off
setlocal
for /f "Tokens=*" %%a in (emails.txt) do set line=%%a&call :parse
endlocal
goto :EOF
:parse
for /f "Tokens=1-2 Delims=, " %%a in ("%line%") do set username=%%a&set emailaddress=%%b
echo Adding email address User: [%username%] Email: [%emailaddress%]
"C:\Program Files (x86)\EveryonePrint\lib\windows\curl\curl.exe" -X PUT -i -H "X-EOP-AuthToken: xyz" "http://127.0.0.1:7290/api/rest.cfm/useremails/?username=%username%&EmailAddress=%emailaddress%" - Modify/amend the values in bold above for :
- filename
- path to Curl
- API authorization token
- URL to EveryonePrint server
- When executing this bat file, the email addresses in the txt file will be imported.
Comments
0 comments
Please sign in to leave a comment.