|
1 |
| -## Form Tools API |
| 1 | +# Form Tools API |
2 | 2 |
|
3 |
| -See the documentation for information about the Form Tools API: |
4 |
| -https://docs.formtools.org/api/ |
| 3 | +This repo contains the Form Tools API, providing some convenience methods to extend Form Tools in various ways: |
| 4 | +- Let's you create complex, multi-page forms that integrate well with Form Tools. |
| 5 | +- Let's you display Form Tools data on your website publicly |
| 6 | +- Provides ways to create user accounts, login to Form Tools programmatically |
| 7 | +- Lots more. |
5 | 8 |
|
| 9 | +The API documentation is pretty thorough. Please refer to one of the following sections: |
| 10 | + |
| 11 | +- [API v1.x](https://docs.formtools.org/api/) - current version, but soon to be legacy |
| 12 | +- [API v2.x](https://docs.formtools.org/api/v2) - this is coming (very) soon |
| 13 | + |
| 14 | +## API v1.x vs. v2.x |
| 15 | + |
| 16 | +Form Tools 3 was a complete rewrite of the application, including changing the codebase from functional code to |
| 17 | +object-oriented. The API v2.x was updated for Form Tools 3 compatibility, converting the API into a class. |
| 18 | + |
| 19 | +In terms of functionality, v1.x and v2.x of the API are identical: they (currently) provide the same methods. _What's |
| 20 | +changed has the way you call the API methods_. |
| 21 | + |
| 22 | +## Examples |
| 23 | + |
| 24 | +The documentation links above contains in-page example code for all the methods, but for something more hands-on |
| 25 | +check out the `examples/` folder in this repo. That contains some simple, bare-bones examples (no CSS!) of some of the |
| 26 | +API methods that can easily be shown. Other methods such as the form integration methods need additional work to |
| 27 | +configure Form Tools - so couldn't be included. See the [tutorials](https://docs.formtools.org/tutorials/) for further |
| 28 | +info on them. |
| 29 | + |
| 30 | +The`v1/` folder contains the old Form Tools 2.x compatible API methods (version 1.x of the API); the `v2/` |
| 31 | +folder contains Form Tools 3 compatible API methods (version 2.x of the API). For Form Tools 3 users, please use |
| 32 | +the `v2/` folder examples - `v1/` is just provided for people upgrading to Form Tools 3 and want to keep |
| 33 | +compatibility with their existing API forms and usage. |
| 34 | + |
| 35 | +### How to view the examples |
| 36 | + |
| 37 | +- Create a form in Form Tools - it doesn't matter if it's an internal, external or Form Builder form. Many of |
| 38 | +the Form Tools API methods rely on passing form IDs, view IDs and more. As such you may find you will need |
| 39 | +to edit these examples to pass the IDs/settings that are correct for your installation and forms. |
| 40 | +- The Form Tools download packages from (formtools.org)[https://formtools.org/download/] all include the API as |
| 41 | +part of the bundle, but if you're getting the code from the source github repos, be sure to upload the contents of |
| 42 | +the latest [API package version](https://github.com/formtools/api/releases) to your `[Form Tools root]/global/api/ folder`. |
| 43 | +- Edit the `examples-config.php` file in this folder to set the `$examples_enabled = true;` variable. The examples |
| 44 | +are all disabled by default to prevent accidentally exposing your Form Tools submission data to the outside world. |
| 45 | +If you're worried about this, just move the examples folder wherever you want on your server and change the paths |
| 46 | +to the api.php/API.class.php file. |
| 47 | + |
| 48 | +## Getting help |
| 49 | + |
| 50 | +Check out the [Form Tools forums](https://forums.formtools.org. If you think you've found a bug - please report it here |
| 51 | +on the github repo. Thanks! |
0 commit comments