User:Bwinton/Account Provisioner API

From MozillaWiki
Jump to: navigation, search

Provisioning API

suggestFromName

Preference Name: extensions.accountprovisioner.suggestFromName

Default Url: http://bwinton.latte.ca/work/provision/suggestFromName.cgi

Inputs

  • FirstName - <String> All the names of the user before the last name.
  • LastName - <String> The last name of the user.

Outputs:

   {"succeeded": true,
    "addresses": ["blake@winton.com", "blake@winton.org", "b@winton.com"],
                 /* May be empty. */
    "price": 20.00,
    /* Any other parameters will be sent back on the call to provision. */}
   {"succeeded": false,
    "errors": {"FirstName": "Invalid first name."}}
   {"error": "Missing first or last name."}

checkAddress

Preference Name: extensions.accountprovisioner.checkAddress

Default Url: http://bwinton.latte.ca/work/provision/checkAddress.cgi

Inputs

  • username - <String> The requested username.
  • domain - <String> The requested domain.

Outputs:

   {"succeeded": true,
    "username": "bwinton", "domain": "latte.ca"}
   {"succeeded": false,
    "addresses": [
      {"domain": "latte.ca", 
       "alternates": ["error", "error1"]},
      {"domain": "gmail.com",
       "alternates": ["error1209", "error1337", "error16666"]},
      {"domain": "yahoo.com",
       "alternates": ["error", "error1"]}]}
   {"error": "Missing username or domain."}


provision

Preference Name: extensions.accountprovisioner.provision

Default Url: http://bwinton.latte.ca/work/provision/provision.cgi

Inputs A JSON string containing whichever fields the provisioning process requires.

   "account": {
     "first_name": "Fred",
     "last_name": "Smith",
     "billing": { # all required except phone
       "address1": "",
       "address2": "",
       "city": "Toronto",
       "state": "ON",
       "country": "CA",
       "zip": "",
       "phone": "",
       "card_number": "1234...",
       "card_cvv": "123",
       "card_expiry_month": "04",
       "card_expiry_year": "2012"
     }
   },
   "items": [
     {
       "product": "personalized_email",
       "name": "bob@monkey.com",
       "quote": "35a4891b086f490a7bc0",
     }
   ]
   }


Outputs:

   {"succeeded": true,
    "config": "<clientConfig version=\"1.1\">
                 <emailProvider id=\"latte.ca\">
                   <domain>latte.ca</domain>
                   <displayName>Latte.ca</displayName>
                   <displayShortName>Latte.ca</displayShortName>
                   <incomingServer type=\"imap\">
                     <hostname>imap.latte.ca</hostname>
                     <port>993</port>
                     <socketType>SSL</socketType>
                     <username>%EMAILLOCALPART%</username>
                     <authentication>password-cleartext</authentication>
                   </incomingServer>
                   <outgoingServer type=\"smtp\">
                     <hostname>smtp.latte.ca</hostname>
                     <port>587</port>
                     <socketType>STARTTLS</socketType>
                     <username>%EMAILLOCALPART%</username>
                     <authentication>password-cleartext</authentication>
                   </outgoingServer>
                 </emailProvider>
               </clientConfig>"}

The string in the config attribute should be XML which conforms to the Autoconfig schema.

   {"succeeded": false,
    "errors": {"account.first_name": "Invalid first name.  Try \"Andrew\" instead.",
               "items.0.quote": "Quote is invalid or expired; please retry suggest."}}
   {"error": "Missing username or domain."}