1
API Usage scripts
Question asked by Brian Burns - 4/5/2025 at 1:51 PM
Unanswered
hey all ,
I am wondering if someone else has used api/scripts to create users/alias and add delete domains .. i have been struggling with it and documentation is not very clear .. please please if someone has some scripts to get started .. i finally was able to add alias and it shows in webgui but when i try to use it it gets "no such user " btw i am using smartmail from namecrane and their support just sends me to documentation for smartermail api :(

6 Replies

Reply to Thread
0
Mart Vernik Replied
Here is sample script (alias.sh) to add group members to alias:
koodivaramu.eesti.ee/rahvusarhiiv/sm

To get started, monitor what you are doing in web interface:
1) open browser developer tools (F12)
2) add new alias
3) open "Network" section and select "alias-put"
 - from "Headers" you can see what the API url is: /api/v1/settings/domain/alias-put/
 - from "Payload->view source" you can see what is sent to API
0
Tony Scholz Replied
Employee Post
Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com
0
Brian Burns Replied
# Define path segments as arrays
slash = "/"
auth_parts = ["api", "v1", "auth", "authenticate-user"]
auth_uri = hostname + slash + slash.join(auth_parts)

list_search_parts = ["api", "v1", "settings", "domain", "account-list-search"]
list_search_endpoint = slash.join(list_search_parts)

delete_parts = ["api", "v1", "settings", "domain", "alias-delete", alias_name]
delete_endpoint = slash.join(delete_parts)

update_parts = ["api", "v1", "settings", "domain", "alias-put"]
update_endpoint = slash.join(update_parts)
0
Tony Scholz Replied
Employee Post
Ok, so you are able to create the alias via the API but are not able to use it. 

  1. Are you trying to send as the alias from webmail or from the API? 
  2. Do you have "Send From" enabled for this alias address?
  3. Are you authenticating as one of the users of this alias address?


Send From - Denotes whether users are able to send from the alias.
Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com
0
Brian Burns Replied
1. yes i can send from gui in domain gui TO that email just has one option "Send email" 
2. no but this is supposed to be for a incoming email forwarding to another email
3. yes            
0
Brian Burns Replied
pastebin dot com slash 7g66mrzA if you want to check out the python script            

Reply to Thread

Enter the verification text