It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.
Sometimes you want to just use Contour from, for example, a Flash movie or through an AJAX call. This is not currently possible with Contour out of the box, but this package will let you do just that!
With this package you can do a GET or POST request to get all Contour forms, get the fields (including prevalues) of a specific form and fill a Contour form and send it without even being in an Umbraco context. It will give you any validation and manditory field errors in a json string for you to use as you see fit.
After you install the package, make sure to add these few lines to the /config/restExtensions.config file (I hope to be able to automate this in a future release):
<ext assembly="/bin/Cultiv.RestContour" type="Cultiv.RestContour.SubmitContourForm" alias="submitContourForm">
<permission method="CreateRecord" allowAll="true" returnXml="false" />
<ext assembly="/bin/Cultiv.RestContour" type="Cultiv.RestContour.GetContourForm" alias="getContourForm">
<permission method="GetAllForms" allowAll="true" returnXml="false" />
<permission method="GetFormFields" allowAll="true" returnXml="false" />
Careful here: everybody has permission to post to the form.
Note: Remove the /bin/ reference when working with Umbraco >= 4.5
To get forms and fields:
Go to yoursite.ext/base/getContourForm/GetAllForms to get all of the forms available.
Then go to yoursite.ext/base/getContourForm/GetFormFields/?formGuid=xxx-xx etc to get all of the fields, and their paremeters and prevalues.
Submitting a form:
Go to yoursite.ext/base/submitContourForm/CreateRecord.aspx/
After the URL you are going to have to specify the queryString parameter "formGuid". This is the guid of the Contour form.
There are three more (optional) queryString paramaters that you can pass:
- nodeId - will indicate to which Umbraco node the form pertains (will be -1 when left empty)
- userIpAddress - the IP address of the user submitting the form (will revert to the server variable REMOTE_ADDR if left empty, please make sure that you don't get the server's IP address instead of the user's when using in a Flash or AJAX environment!).
- culture - example: value "en-US"; this is to force the form being submitted in a particular language, you need to use this if you are running a multilingual site and want to use dictionary items to send e-mails for example.
Of course this also works with a POST as opposed to a GET.
All of these url's have an optional parameter:
1.0.1 - Workflow was triggered for each field, this is now fixed.
1.0.2 - userIPAddress and nodeId no longer mandatory, nice error message when formGuid is omitted.
2.0.0 - Extra services to also fetch all forms and formfields
2.0.1 - Added support for multilingual sites through the culture parameter