I'm beginning to design a web-based API and the very first issue—how will users interact with it—left me at a loss. This is an API that is only going to be used by other folks within our company and will be used by people who have some programming knowledge, so there's a good bit of leeway in all respects, and it needn't be simple enough for laymen.
Should I have a single URL and have all the information passed as query parameters:
http://hostname/api/v1?func=getZipCode&state=Ohio&city=Toledo&street='100 Cherry Street'
Or something RESTful:
http://hostname/api/v1/getZipCode/Ohio/Toledo/100 Cherry Street
Or is SOAP the way to go:
POST /api/v1 HTTP/1.1
<?xml version="1.0"?>
<soap:Envelope>
<soap:Body xmlns:m="http://hostname/api/v1/wsdl">
<m:getZipCode>
<m:state>Ohio</m:state>
<m:city>Toledo</m:city>
<m:street>100 Cherry Street</m:street>
</m:getZipCode>
</soap:Body>
</soap:Envelope>
What are the (dis)advantages of each approach?