This repository contains the source code for an example implementation of the PHP REST API client for xTuple ERP. This client uses the Google API's client library for PHP.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

xTuple PHP REST API Client Example

xTuple ERP PHP REST API Client Example using the Google APIs Client Library for HP that uses Google APIs Client Library for PHP and JSON-Patch PHP library to interface with xTuple's REST API.

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

  1. Clone or download this repo:

    git clone

2.Copy this directory xtuple-php-rest-client-example to a path exposed by your PHP server. For example:

  1. Register for an OAuth 2.0 Services Account Client in your xTuple Mobile Client's OAUTH2 interface. You will be prompted to download a PK12 keystore file. See OAuth 2.0 Service Accounts Scenario for more information.
  2. Save the PK12 keystore file in the same directory as this file and the index.php file.
  3. Copy the sample_local_config.php file to local_config.php and edit it to set all of your environment and OAuth 2.0 client specific settings:

    cp sample_local_config.php local_config.php
  4. Visit the index.php file on your PHP server. For example:


Note, make sure your xTuple Mobile Client is running before loading index.php.

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.



Apache License, Version 2.0

Copyright (c) 2012-2014 xTuple