The Users API will provide you with the ability to add, list, update, transfer, or delete users on your account.
GET /webship/api/users
Gets the list of users on your Secureship account
GET /webship/api/user
Gets the user specific details based on the email address provided
POST /webship/api/users/add/
Adds the specific the user to your Secureship account
POST /webship/api/users/update/
Updates the selected user
POST /webship/api/users/delete/
Deletes the selected user from your Secureship account
{ "AccountNumber": "ZZZZZ" }
Your Secureship account number.
{ "AddressBook": true; }
Indicates whether or not you want the user's address book to be transferred to the new user.
{ "ApiKey": "APIKEY" }
The API key for your account.
{ "DisableUser": false; }
Enable or disable the user's account.
{ "Email": "user@mycompany.com" }
The email address of the user that will be added, updated, or deleted from the account.
{ "Firstname": "John" }
The user's first name.
{ "History": true; }
Indicates whether or not you want the user's history to be transferred to the new user.
{ "IsAdminUser": true; }
Give or remove adminstrative rights to this user.
{ "IsBillingUser": true; }
Give or remove billing rights to this user.
{ "IsSharingHistory": true; }
Give or remove the ability for this user to see the account's history.
{ "Lastname": "Smith" }
The user's last name.
{ "PartsBook": true; }
Indicates whether or not you want the user's parts book to be transferred to the new user.
{ "Username": "user@mycompany.com" }
The username you use to log into your Secureship account.
{ "TimeZone": 1 }
Indicates the user's timezone.
- 0 - Atlantic Standard Time
- 1 - Eastern Standard Time
- 2 - Central Standard Time
- 3 - Mountain Standard Time
- 4 - Pacific Standard Time
- 5 - US Mountain Standard Time
- 6 - US Eastern Standard Time
- 7 - Newfoundland Standard Time
- 8 - Alaskan Standard Time
- 9 - Hawaiian Standard Time
{ "TransferDataToUser": "AnotherUser@mycompany.com" }
The user that will receive all the Shipment History, Address Book and Parts Book Data.
{ "Users": [
{
"FirstName":"firstname",
"LastName":"lastname",
"Email":"user@mycompany.com",
"HasAdminAccess":true,
"HasBillingAccess":true,
"HasSharedAccess":true,
"IsDisabled":false,
"LastLoginDate":"2015-08-13T15:59:00",
"HasConfirmedInvitation":true
} ],
"Notifications":[""]
}
Returns a list containing all the users on the account.
HasSharedAccess: Indicates whether or not the user has access to see the history, address book, and parts book data from
other users on the account.
HasConfirmedInvitation: When a user is added to the account, they will receive an email notification
with their login link. Once they have clicked the link, the new user has confirmed their invitation.
IsDisabled: Indicates whether or not the user has login access to the account.
Notifications: Returns a list of warnings, information, or errors that were encountered while attempting to get the list of users.
{ "Notifications": [""] }
Returns a list of warnings, information, or errors related to the call.
{ "Successful": true }
Indicates whether or not the API call you made was successful.
/webship/api/users
Gets the list of users on your Secureship account
Sample
GET /webship/api/users
{
"ApiKey":"api123",
"AccountNumber":"123456",
"Username":"admin@mycompany.com"
}
Response:
{ "Users": [
{
"FirstName":"firstname",
"LastName":"lastname",
"Email":"user@mycompany.com",
"HasAdminAccess":true,
"HasSharedAccess":true,
"IsDisabled":false,
"LastLoginDate":"2015-08-13T15:59:00",
"HasConfirmedInvitation":true
} ],
"Notifications":[""],
"Successful":true
}
/webship/api/user
Gets the user specific details based on the email address provided
Sample
GET /webship/api/user
{
"ApiKey":"api123",
"AccountNumber":"123456",
"Username":"admin@mycompany.com"
"Email":"admin@mycompany.com"
}
Response:
{
"FirstName":"firstname",
"LastName":"lastname",
"Email":"user@mycompany.com",
"HasAdminAccess":true,
"HasSharedAccess":true,
"IsDisabled":false,
"LastLoginDate":"2015-08-13T15:59:00",
"HasConfirmedInvitation":true
"Notifications":[""],
"Successful":true
}
/webship/api/users/add/
Adds the specific the user to your Secureship account
Sample
POST /webship/api/users/add/
{
"ApiKey":"api123",
"AccountNumber":"123456",
"Username":"admin@mycompany.com",
"Email":"user@mycompany.com",
"FirstName":"FirstName",
"LastName":"LastName",
"TimeZone":"1",
"IsAdminUser":false,
"IsBillingUser":false,
"IsSharingHistory":true
}
Response:
{
"Notifications":["An email invitation has been sent to the user."],
"Successful":true
}
/webship/api/users/update
Updates the selected user
Sample
POST /webship/api/users/update/
{
"ApiKey":"api123",
"AccountNumber":"123456",
"Username":"admin@mycompany.com",
"Email":"user@mycompany.com",
"FirstName":"FirstName",
"LastName":"LastName",
"IsAdminUser":false,
"IsBillingUser":false,
"IsSharingHistory":true
"DisableUser":false
}
Response:
{
"Notifications":[""],
"Successful":true
}
/webship/api/users/delete/
Deletes the selected user from your Secureship account
Sample
POST /webship/api/users/delete/
{
"ApiKey":"api123",
"AccountNumber":"123456",
"Username":"admin@mycompany.com",
"Email":"user@mycompany.com",
"TransferDataToUser":"anotheruser@mycompany.com",
"History":true,
"AddressBook":true
"PartsBook":true
}
Response:
{
"Notifications":[""],
"Successful":true
}
> curl -X POST https://secureship.ca/webship/api/users --data "[insert your json here]"
>
or
> curl -X POST https://secureship.ca/webship/api/users --data @datafile.json
>
string jsonData = "...";
WebClient request = new WebClient();
request.Encoding = System.Text.Encoding.UTF8;
var results = request.UploadString(new Uri(USERS_URL), "POST",jsonData);
System.Diagnostics.Debug.WriteLine(results);
// Create the web request
HttpWebRequest request = WebRequest.Create(USERS_URL) as HttpWebRequest;
// Set type to POST
request.Method = "POST";
request.ContentType = "application/x‐www‐form‐urlencoded";
System.Text.StringBuilder data = new System.Text.StringBuilder();
data.Append(System.IO.File.ReadAllText(@"yourfile.json"));
byte[] byteData = System.Text.UTF8Encoding.UTF8.GetBytes(data.ToString());
// Set the content length in the request headers
request.ContentLength = byteData.Length;
// Write data
using (System.IO.Stream postStream = request.GetRequestStream())
{
postStream.Write(byteData, 0, byteData.Length);
}
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
System.IO.StreamReader reader = new
System.IO.StreamReader(response.GetResponseStream());
// Console application output
System.Diagnostics.Debug.WriteLine(reader.ReadToEnd());
}
<?php
$username = ' ';
$apikey = ' ';
$json = "insert your json code here";
$ch = curl_init(USERS_URL);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$json");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Basic " .
base64_encode($username . ":" . $apikey)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
?>