2
Smartermail Rest API - powershell
Question asked by Tinashe Chikomo - 7/2/2020 at 5:24 AM
Answered
Hi there

I am attempting to use the code snippet below after getting the required authorization token:

$smBaseUrl="https://mail.server.com"
$uri="{0}/api/v1/settings/domain/mailing-lists/list" -f $smBaseUrl
$authHeader = @{ "Authorization"="Bearer ${accesstoken}" }    $response=Invoke-RestMethod -Uri $uri -Headers $authHeader -Method GET -ContentType "application/json"

but I get the error below , I do not any option to specify a domain name :

Invoke-RestMethod: {"message":"Domain does not exist."}

Please let me know what im doing wrong and how to get this working

Kind Regards,

2 Replies

Reply to Thread
0
Employee Replied
Employee Post Marked As Answer
Make certain that the access token you are using is a normal or domain admin user account. The domain is inferred from the user account. A system admin account will not suffice.  See the documentation for this API method below:

https://mail.smartertools.com/Documentation/api#/reference/SmarterMail.Web.Controllers.Api.MailingListController/GetAllMailingLists 
0
Tinashe Chikomo Replied
Thank you for the assistance Robert. 

Managed to get everything working

Reply to Thread