Account

Last updated: October 20th 2021

Introduction

About Accounts

Account management API calls. Allowing you to add sub organizations and users.

AddSubOrganization

This API call creates a sub organization. Note that all of these operations require a token - see the authentication section for more information. The new sub organization will be added to the organization that you have logged in to.

Authentication Endpoint
Method: POST
https://apinie.sensorpro.net/api/Account/AddSubOrganization/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Request Body


    {
        "Company": "{Organization Short Code}",
        "User": "{Users Email}",
        "IsAPIUser": false,
        "Password": "{Users Password}",
        "CnfPassword": "{Confirm Users Password}",
        "ShareCredit": false,
        "CopyAuthorizedSenderEmail": false
    }

Input Parameters

    • Required
    • Company: Your organization name. This is used to login. It should be a shortened version of company name, not containing any special characters or spaces.
    • IsAPIUser: Is the user an API user. API users cannot login through the UI.
    • Password: User password (password should be a minimum of 8 characters 1 uppercase, 1 number, 1 special character @ ! $ . )
    • ShareCredit: Share credit with parent organization
    • CopyAuthorizedSenderEmail: Copy authorized emails from parent organization

Response Output


    {
        "APIKey": "9f2c5373d713fd5b2ca60c7385e1605c",
        "AddCount": 1,
        "Result": {
            "RequestId": "fc3f87dd-ecb8-4e51-99ab-1c63b0c11a02",
            "ErrorMessages": [],
            "StatusMesssages": [],
            "TotalStatusMessages": 0,
            "TotalErrors": 0
        }
    }
Response Values:
  • APIKey - The API key for newly created organization
  • AddCount - Total number of organizations added
  • RequestId - Unique request ID
Sample Code:

    var client = new RestClient("https://apinie.sensorpro.net/api/Account/AddUpdateUser/34f10088-b34d-4530-86f6-f6607dbc0345");
    client.Timeout = -1;
    var request = new RestRequest(Method.POST);
    request.AddHeader("Content-Type", "application/json");
    var body = @"{
    " + "\n" +
    @"    ""User"": ""rcoady@gmail.com"",
    " + "\n" +
    @"    ""FirstName"": ""richardMM 1"",
    " + "\n" +
    @"    ""LastName"": ""coady"",
    " + "\n" +
    @"    ""Email"": ""rcoady@gmailX2.com"",
    " + "\n" +
    @"    ""UICulture"": ""en-GB"",
    " + "\n" +
    @"    ""Culture"": ""en-GB"",
    " + "\n" +
    @"    ""Password"": ""pass@123!G"",
    " + "\n" +
    @"    ""PasswordCnf"": ""pass@123!G"",
    " + "\n" +
    @"    ""Role"": ""Admin"",
    " + "\n" +
    @"    ""Menu"": ""*sys"",
    " + "\n" +
    @"    ""CampaignAdmin"": true,
    " + "\n" +
    @"    ""APIUser"": false,
    " + "\n" +
    @"    ""EnableAdvancedEdit"": false
    " + "\n" +
    @"}";
    request.AddParameter("application/json", body,  ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    Console.WriteLine(response.Content);


    curl --location --request POST 'https://apinie.sensorpro.net/api/Account/AddUpdateUser/34f10088-b34d-4530-86f6-f6607dbc0345' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "User": "rcoady@gmail.com",
    "FirstName": "richardMM 1",
    "LastName": "coady",
    "Email": "rcoady@gmailX2.com",
    "UICulture": "en-GB",
    "Culture": "en-GB",
    "Password": "pass@123!G",
    "PasswordCnf": "pass@123!G",
    "Role": "Admin",
    "Menu": "*sys",
    "CampaignAdmin": true,
    "APIUser": false,
    "EnableAdvancedEdit": false
    }'

                                                

    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\r\n    \"User\": \"rcoady@gmail.com\",\r\n    \"FirstName\": \"richardMM 1\",\r\n    \"LastName\": \"coady\",\r\n    \"Email\": \"rcoady@gmailX2.com\",\r\n    \"UICulture\": \"en-GB\",\r\n    \"Culture\": \"en-GB\",\r\n    \"Password\": \"pass@123!G\",\r\n    \"PasswordCnf\": \"pass@123!G\",\r\n    \"Role\": \"Admin\",\r\n    \"Menu\": \"*sys\",\r\n    \"CampaignAdmin\": true,\r\n    \"APIUser\": false,\r\n    \"EnableAdvancedEdit\": false\r\n}");
    Request request = new Request.Builder()
    .url("https://apinie.sensorpro.net/api/Account/AddUpdateUser/34f10088-b34d-4530-86f6-f6607dbc0345")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .build();
    Response response = client.newCall(request).execute();

                                                

AddUpdateUser

Add/update user to organization. Note that all of these operations require a token - see the authentication section for more information.

Add/update User Endpoint
Method: POST
https://apinie.sensorpro.net/Account/AddUpdateUser/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


    {
        "User": "{User ID should be email}",
        "FirstName": "{First name}",
        "LastName": "{Last name}",
        "Email": "{User email}",
        "UICulture": "en-GB",
        "Culture": "en-GB",
        "Password": "{Password}",
        "PasswordCnf": "{Confirm password}",
        "Role": "{User Role default Admin}",
        "Menu": "*sys",
        "CampaignAdmin": true,
        "APIUser": false,
        "EnableAdvancedEdit": false
    }

Input Parameters

  • Required
  • User - User ID should be users email address.
  • FirstName - First name .
  • LastName - Last name.
  • Email - User's email address
  • Optional
  • UICulture - Default en-GB
  • Culture - Default en-GB
  • Password - User password (password should be a minimum of 8 characters 1 uppercase, 1 number, 1 special character @ ! $ . )
  • Role - User role, default: Admin
  • Menu - Fixed to *Sys
  • CampaignAdmin - Is the user a campaign administrator?
  • APIUser - is this an API user? If so this user cannot login to the UI. Only API users can login through the API.
  • EnableAdvancedEdit - Enable advanced editor in email designer.

Response Output

The key return values are DesignIdHTML and DesignIdTXT. These will be used to create a broadcast in a subsequent API call.


¬{
    "UpdateCount": 1,
    "AddCount": 0,
    "FailedRequests": [],
    "Result": {
        "RequestId": "ece136ad-0fbd-4670-bdb2-142aeb27b841",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
    }
}

Response Values:
  • UpdateCount - The number of records updated
  • AddCount - Number of records added
Sample Code:
                                            
var client = new RestClient("https://apinie.sensorpro.net/api/campaign/AddDesignv2/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{     \"CampaignId\":2,   \"Name\":\"APIDesign\",   \"Description\":\"My API test design\",   \"ExtLinkId\":\"\",   \"HTMLMessage\":\"
View this email in your web browser
\\\"Logo\\\"

This email was sent to {personalemail}

You can remove yourself from our list by clicking here.

\", \"TextMessage\":\"my text version {unsubscribe}\", \"StyleSheet\":\".test{}\"}", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
                                            
<?php

$curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://apinie.sensorpro.net/api/campaign/AddDesignv2[Token]",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{  \"CampaignId\":2,\"Name\":\"APIDesign\",\"Description\":\"My API test design\",\"ExtLinkId\":\"\",\"HTMLMessage\":\"
View this email in your web browser
\\\"Logo\\\"

This email was sent to {personalemail}

You can remove yourself from our list by clicking here.

\",\"TextMessage\":\"my text version {unsubscribe}\",\"StyleSheet\":\".test{}\"}", CURLOPT_HTTPHEADER => array( "Content-Type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo &quot;cURL Error #:&quot; . $err; } else { echo $response; }
                                            
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{     \"CampaignId\":2,   \"Name\":\"APIDesign\",   \"Description\":\"My API test design\",   \"ExtLinkId\":\"\",   \"HTMLMessage\":\"
View this email in your web browser
\\\"Logo\\\"

This email was sent to {personalemail}

You can remove yourself from our list by clicking here.

\", \"TextMessage\":\"my text version {unsubscribe}\", \"StyleSheet\":\".test{}\"}"); Request request = new Request.Builder() .url("https://apinie.sensorpro.net/api/campaign/AddDesignv2[Token]") .post(body) .addHeader("Content-Type", "application/json") .build(); Response response = client.newCall(request).execute();