Hook up your own application with The Machine's functionality.

client.new

This method will add a client item.

You call this method with the following URL:

Parameters

Parameters are the data you will pass with the call.

api_token

Your secret identifier. You find your API Token under Account Overview in the Account section.

Rules: Required.

name

The client's name.

Rules: Required.

email

The client's email.

Rules: Required if you add a new client. The email must be in a valid email format.

company (optional)

The client's company.

Rules: If this parameter is not specified it will use the client's name as a company.

address_line_01 (optional)

The client's address line 1.

Rules: None.

address_line_02 (optional)

The client's address line 2.

Rules: None.

city (optional)

The client's city.

Rules: None.

zip_code (optional)

The client's zip code.

Rules: None.

state (optional)

The client's state.

Rules: None.

country

The client's country.

Rules: Must be set to a supported country. Please see the list of supported countries.

tax_id (optional)

The client's Tax ID (VAT).

Rules: None.

get (optional)

If this parameter is set the result sent back will be the new client in XML data rather than the success message.

Rules: If parameter is used it must be set to "true". Otherwise it will be ignored.

Return Values

This is the result that will be passed back to you when you have sent a call.

Success

Success: Client added.

The client was successfully added.

If you have set the get parameter to "true" you will rather get the new client in XML sent back to you. Like this:

<?xml version="1.0" encoding="utf-8"?>
<method request="client.get">
    <client>
        <id>204607</id>
        <name>Sample Contact</name>
        <email>sample@invoicemachine.com</email>
        <company>Sample Company, Inc.</company>
        <address_line_01>35181 Invoice Street</address_line_01>
        <address_line_02>Sample Company</address_line_02>
        <city>Invoice City</city>
        <zip_code>92329</zip_code>
        <state>CA</state>
        <country>United States</country>
        <tax_id></tax_id>
    </client>
</method>
Error

Error: No data passed.

No data was passed to the method.

Error: API Token is invalid.

The API Token parameter is missing or incorrectly entered.

Error: Name is invalid.

The Name is missing.

Error: Email is invalid.

The Email parameter is missing or incorrectly entered.

Error: Country is invalid.

The Country parameter is missing or incorrectly entered.

Example

The example below is strictly a demonstration of the method and it's parameters. Methods should never be posted from a HTML form. They should be posted directly from your server script.

<form action="http://machine_id.invoicemachine.com/api/client.new" method="post">
    <input type="hidden" name="api_token" value="c86cea54c71sbb05a5f8297bed641944">
    <input type="hidden" name="name" value="Sample Contact">
    <input type="hidden" name="email" value="sample@invoicemachine.com">
    <input type="hidden" name="company" value="Sample Company, Inc.">
    <input type="hidden" name="address_line_01" value="35181 Invoice Street">
    <input type="hidden" name="city" value="Sample Company">
    <input type="hidden" name="zip_code" value="92329">
    <input type="hidden" name="state" value="CA">
    <input type="hidden" name="country" value="United States">
</form>