xTuple PHP REST API Client Example
These are some very basic DELETE, GET, PATCH and POST request examples.
WARNING: These examples are in no way secure or using best practices for PHP application. This is meant for educational purposes only.
There is a lot more that could be done to expand on these examples. TODO: Create a basic user interface. TODO: Change POST into an add form that creates fields from the JSON-Schema. TODO: Change PATCH into an edit form that creates fields from the JSON-Schema.
Install and Run the Client
Clone or download this repo:
git clone firstname.lastname@example.org:xtuple/xtuple-php-rest-client-example.git
2.Copy this directory
xtuple-php-rest-client-example to a path exposed by your PHP server.
- Register for an OAuth 2.0
Services AccountClient in your xTuple Mobile Client's
OAUTH2interface. You will be prompted to download a PK12 keystore file. See OAuth 2.0 Service Accounts Scenario for more information.
- Save the PK12 keystore file in the same directory as this file and the
local_config.phpand edit it to set all of your environment and OAuth 2.0 client specific settings:
cp sample_local_config.php local_config.php
index.phpfile on your PHP server. For example:
Note, make sure your xTuple Mobile Client is running before loading
Using the Example
You should be presented with a list of contacts. Initially, at the bottom of
the list, there is a link to
Add Contact 42. You can click on a contact's
number to view it. Each contact has links to
Delete it or
Add a comment.
Copyright (c) 2012-2014 xTuple http://www.xtuple.com/