For a money transfer I am envisioning something along these lines:

 

https://rest.secondlife.com/cgi-bin/rest.cgi?firstname=Joe&lastname=Smith&password=Blah&resource=/templates/MoneyTransferForm

 

The above URL is used to obtain the schema for the form that needs to be filled out to transfer money to another Avatar.  The HTTP GET returns an XML document:

 

<?xml version="1.0"?>
<MoneyTransferForm>
      <TargetKey></TargetKey>
      <Amount></Amount>
      <Status></Status>
</MoneyTransferForm>

 

 

You then modify the document to add the target Avatar’s key and the amount of money to send:

 

<?xml version="1.0"?>
<MoneyTransferForm>
      <TargetKey>66864f3c-e095-d9c8-058d-d6575e6ed1b8</TargetKey>
      <Amount>10</Amount>
      <Status></Status>
</MoneyTransferForm>

 

The document is then sent back to the server with modifications via an HTTP POST to a URL such as:

 

https://rest.secondlife.com/cgi-bin/rest.cgi?firstname=Joe&lastname=Smith&password=Blah&resource=/newresource/MoneyTransfer

 

The server’s reply to the POST contains an updated version of the form with the fields as you filled them out along with the resource ID (which can be used in a new URL to look at this MoneyTransfer at a later point) and its own modification to the status field indicating whether or not it was successful:

 

<?xml version="1.0"?>
<Resource ID=/resources/34754f3c-e095-d9c8-058d-d657532d91b8">
<MoneyTransferForm>
      <TargetKey>66864f3c-e095-d9c8-058d-d6575e6ed1b8</TargetKey>
      <Amount>10</Amount>
      <Status>1</Status>
</MoneyTransferForm>

 

 

At first I was a bit apprehensive toward REST.  I have used verb-based systems almost exclusively.  Now I’m now beginning to see the value in it.

I look forward to the day I can actually use the system!

 

-Sam

 

_______________________________________________
libsecondlife-dev mailing list
libsecondlife-dev@gna.org
https://mail.gna.org/listinfo/libsecondlife-dev

Reply via email to