We are consuming a REST API which created an insert on Lead object. We want to enforce data integrity from the external application to salesforce so that any field level changes on the external application throws a compile error in the salesforce side. I know this can be done easily with SOAP but the question is how can we enforce a data contract between Salesforce and external application using REST API? Can we create a JSON object structure on the legacy application which would be referenced as an object in the salesforce side and data sent as a JSON Post? The goal is to enforce field level changes on both applications consistently instead of loose coupling which REST provides? Any thoughts? Buyan
An invalid xml/json request will return a 400 error to the calling application. This is the most of a "contract" that you can feasibly have with salesforce.com, because the service itself is compiled only when changes occur, not on each request. You could generate a WADL/WSDL that describes the contract between salesforce.com and your external system, but that would only cause a compilation error in your external application, not in salesforce.com.