...
Code Block |
---|
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetUserByEmailResponse xmlns="https://apparmor.com/API/"> <GetUserByEmailResult> <UserID>X1X2X3X5X6X7</UserID> <Username>user@email.com</Username> <FirstName>Jane</FirstName> <LastName>Smith</LastName> <SSOID>jsmith</SSOID> <Fields> <Field> <Name>First Name</Name> <VariableName>firstname</VariableName> <Type>TEXT</Type> <Capabilities>NONE</Capabilities> <Required>true</Required> <ValidationExpression /> <Subscriptions /> <Value>Jane</Value> <ModifiedDate>2020-06-03T13:13:59</ModifiedDate> </Field> <Field> <Name>Last Name</Name> <VariableName>lastname</VariableName> <Type>TEXT</Type> <Capabilities>NONE</Capabilities> <Required>true</Required> <ValidationExpression /> <Subscriptions /> <Value>Smith</Value> <ModifiedDate>2020-06-03T13:13:59</ModifiedDate> </Field> <Field> <Name>Alternate Email</Name> <VariableName>alternateemail</VariableName> <Type>TEXT</Type> <Capabilities>EMAIL</Capabilities> <Required>true</Required> <ValidationExpression>^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$</ValidationExpression> <Subscriptions> <Subscription> <SubscriptionID>46R24EP8ZYEG</SubscriptionID> <Type>EMAIL</Type> <GroupCode>everyone</GroupCode> <ModifiedDate>2020-06-02T15:59:01</ModifiedDate> </Subscription> <Subscription> <SubscriptionID>12HDF68KJDH1</SubscriptionID> <Type>EMAIL</Type> <GroupCode>faculty</GroupCode> <ModifiedDate>2020-06-02T15:59:01</ModifiedDate> </Subscription> </Subscriptions> <Value>user@altemail.com</Value> <ModifiedDate>2020-06-03T13:14:00</ModifiedDate> </Field> <Field> <Name>Mobile Phone</Name> <VariableName>mobilephone</VariableName> <Type>TEXT</Type> <Capabilities>VOICEANDSMS</Capabilities> <Required>true</Required> <ValidationExpression>\(?\d{3}\)?-? *\d{3}-? *-?\d{4}</ValidationExpression> <Subscriptions> <Subscription> <SubscriptionID>56R24EP8ZYEG</SubscriptionID> <Type>VOICE</Type> <GroupCode>everyone</GroupCode> <ModifiedDate>2020-06-02T15:59:01</ModifiedDate> </Subscription> <Subscription> <SubscriptionID>18HDF68KJDH1</SubscriptionID> <Type>SMS</Type> <GroupCode>everyone</GroupCode> <ModifiedDate>2020-06-02T15:59:01</ModifiedDate> </Subscription> </Subscriptions> <Value>647-992-7919</Value> <ModifiedDate>2020-06-03T13:14:00</ModifiedDate> </Field> <Field> <Name>Home Phone</Name> <VariableName>homephone</VariableName> <Type>TEXT</Type> <Capabilities>VOICE</Capabilities> <Required>true</Required> <ValidationExpression>\(?\d{3}\)?-? *\d{3}-? *-?\d{4}</ValidationExpression> <Subscriptions /> <Value>647-992-7919</Value> <ModifiedDate>2020-06-03T13:14:00</ModifiedDate> </Field> <Field> <Name>Allergies</Name> <VariableName>allergies</VariableName> <Type>TEXT</Type> <Capabilities>NONE</Capabilities> <Required>false</Required> <ValidationExpression /> <Subscriptions /> <Value>Peanuts</Value> <ModifiedDate>2020-06-03T13:14:00</ModifiedDate> </Field> </Fields> </GetUserByEmailResult> </GetUserByEmailResponse> </soap:Body> </soap:Envelope> |
Updating User Field Values
User fields are used to store information about users. When a change is required to a user field value, the UpdateField() function should be used. Parameters to this function include the “UserID” which is obtained from the user object, the variablename, and the new value.
Changes to a user field value will also automatically update any subscriptions to use the new value.
Adding a Subscription
When adding a subscription, the CreateSubscription() function will be used. The function requires the UserID obtained from the User object, the VariableName of the field that contains the contact information (e.g. email address, voice phone number, or SMS phone number) and the GroupCode of the mechanism group that the user should be subscribed to.
SendSMS and SendEmail Functions
The SendSMS() and SendEmail() functions allow validation that an email address or phone number is actually owned by the user. These functions can be used to send a verification code to the user. The implementation of the verification code functionality is left up to the developer using the API.
Other Functions
The remaining functions in the API are relatively straight forward. You are encouraged to view the documentation in the Service Definition for details of those functions.
Exceptions
When an error occurs, and exception object is returned. The exceptions for each function are listed in the Service Definition. Below is a sample XML Exception showing a “User not found” response:
Code Block |
---|
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">Server was unable to process request. ---> User not found</soap:Text>
</soap:Reason>
<soap:Detail />
</soap:Fault>
</soap:Body>
</soap:Envelope> |
The developer is expected to handle exceptions with their implementation of the API.