findSubscription()

Subscription findSubscription(SearchCondition searchCondition)

This method searches by custom field for a subscription and returns an XML document with detailed information about the subscription. This method searches only custom fields that you have defined in Smile; it does not search any default properties such as USN or username.

You can call this method at any point in the subscription lifecycle after the subscription order is entered.

Parameters

searchCondition
Format: SearchCondition XML
Purpose: Defines a SearchCondition XML document that specifies the custom field attribute and value to find.

Example: Find a subscription by custom field

This example searches for a subscription that has the value JoeSmith1 in the custom field client_id.

The value in the <Attribute> element is the code name of the custom field. To find the code name, log in to Smile and click Configuration and Tools > Custom Fields, then click View next to the appropriate custom field. The code name is in the Code field.

The value in the <Value> field is the value in the custom field. If the value is part of a custom collection, specify the code name for the value. To find the code name, log in to Smile and click Configuration and Tools > Custom Collections, then click View next to the appropriate custom collection. The code names are listed next to each value in the custom collection.

<SearchCondition xmlns="http://xml.inomial.com/smile/2.xsd">
  <Equals>
    <Attribute>client_id</Attribute>
    <Value>JoeSmith1</Value>
  </Equals>
</SearchCondition>

Results

This method returns a Subscription XML document that contains detailed information about the subscription's properties and status.

This method returns null if no subscriptions match the search criteria.

There are no messages defined by this method.

Example: A returned Subscription XML document

This example shows a Subscription XML document. The document contains subscription properties (username, given name, family name, number of phone lines and the custom field client_id) and the subscription's status (provisioned, not suspended, activated and enabled).

Note: Smile uses the key attribute on the <Timezone> and <Costcentre> elements as an internal identifier.
<Subscription xmlns="http://xml.inomial.com/smile/2.xsd">
  <USN>120398123</USN>
  <SID>15</SID>
  <ServiceName>VOIP</ServiceName>
  <Parent>1204921324</Parent>
  <Properties>
    <Object>
      <String name="username">+61355501256</String>
      <String name="contactGiven">Joe</String>
      <String name="contactFamily">Smith</String>
      <Integer name="phoneLines">13</Integer>
      <String name="client_id">JoeSmith1</String>
    </Object>
  </Properties>
  <ProvisionStatus>Provisioned</ProvisionStatus>
  <SuspendStatus>Active</SuspendStatus>
  <ActivateStatus>Activated</ActivateStatus>
  <EnableStatus>Enabled</EnableStatus>
  <InvoicingCycle>
    <CycleType>Anniversary</CycleType>
    <CycleDay>24</CycleDay>
  </InvoicingCycle>
  <RatingCycle>
    <CycleType>Anniversary</CycleType>
    <CycleDay>24</CycleDay>
  </RatingCycle>
  <Timezone key="19">Australia/Sydney</Timezone>
  <CostCentre key="1">Example cost centre</CostCentre>
</Subscription>

Faults

TooManyResultsException

This fault is returned when more than one subscription matches the search criteria.

NoSuchItemException

This fault is returned when the custom field that you are searching for does not exist.

Java client syntax

java -cp build/smilewsv2-client.jar [options] com.inomial.smile.client.v2.examples.FindSubscription propName value
propName
Purpose: Specifies the custom field code name.
value
Purpose: Specifies the custom field value to find.
Note: For more information about the Java client and the options it accepts, see Java client syntax.