REST Examples


Basics

HTTP Methods

GET - Used for retrieval methods. A GET method does not support a HTTP request body, so all request information is specified in the URL and query string. Examples:
https://api.yourhost.com/accounts/10010
https://api.yourhost.com/api/accounts/1050213/journalentries?PageSize=5

POST - Generally used methods that insert information into Tigerpaw. The Search methods are the exception. POST methods require a value or an object definition in the body of the HTTP request.

PUT - Methods used to update information in Tigerpaw. These methods require a value or object definition in the body of the HTTP request.

DELETE - Used to delete information from Tigerpaw. These methods use a mixture of URL and query string values and values defined in the body of the HTTP request.


Security

Please contact your account manager to request a copy of the Tigerpaw REST API Reference Guide. The reference guide will provide more information about security, including examples to help you get started.


Data formats

Using the Accept and Content-Type HTTP header you can control the data format of the request and response. By default the API will accept and return information in JSON format.

JSON response

GET /api/accounts/1053145 HTTP/1.1
Accept: application/json
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

XML response

GET /api/accounts/1053145 HTTP/1.1
Accept: application/xml
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

JSON request and response

GET /api/accounts/1053145 HTTP/1.1
Accept: application/xml
Content-Type: application/json
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

XML request and response

GET https://yourdomain.com/api/accounts/1053145 HTTP/1.1
Accept: application/json
Content-Type: application/xml
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

Note that the content and accept types do not need to be the same.


Search

Each document type provides both a basic and an advanced search method. Both methods require an HTTP POST with the criteria in the body of the request. When using a JSON request the value should be enclosed in quotes. For XML, use <string></string> tags.

POST /api/accounts/search/name HTTP/1.1
Content-Type: application/json
Content-Length: 389
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
"one*"
POST /api/accounts/search/name HTTP/1.1
Content-Type: application/xml
Content-Length: 389
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
<string>one*</string>

When performing an advanced search, if the search types are the same an OR condition will be used; otherwise it will be an AND condition. In the example request we are searching for accounts with a phone number that starts with 402 OR 531 OR 605 AND that have a contact name that contains "jim".

POST /api/accounts/search HTTP/1.1
Content-Type: application/json
Content-Length: 389
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
{
  "Criteria": [
    {
      "SearchType": "PhoneNumber",
      "Criteria": "402",
    },
    {
      "SearchType": "PhoneNumber",
      "Criteria": "531",
    },
    {
      "SearchType": "PhoneNumber",
      "Criteria": "605",
    },
    {
      "MatchType" : "Contains",
      "SearchType": "ContactName",
      "Criteria": "jim",
    }     
  ],

"PageSize": 10

}

You can also use an asterik or percent sign as wildcard values in the Criteria instead of the MatchType property. For example "%smith%" or "*smith*".


Paging

To page the results from a search or other lists add the PageSize and StartRow properties to URL. The PageSize property specifies the number of items to return. StartRow identifies the row number in the results to start the page from. If the StartRow is not specified it will be defaulted to 0 for the first row. By default the API is configured to allow a maximum page size of 50. The maximum page size can be changed in the web.config for the API. For more information refer to the Installation Requirements and Checklist for the REST API on configuring the SearchMaxPageSize.

GET /api/accounts/1050213/journalentries?PageSize=5 HTTP/1.1
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
GET /api/accounts/1050213/journalentries?PageSize=5&StartRow=5 HTTP/1.1
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
GET /api/accounts/1050213/journalentries?PageSize=5&StartRow=10 HTTP/1.1
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

The NextRow property in the response is the value for StartRow property for the next page.

{
   "JournalEntries":    [
            {
         "JournalEntry":          {
            "JournalEntryId": 1182308,
            "AccountNumber": 1050213,
            "RepNumber": 924,
            "Note": "Created Opportunity 13946 (Custom Form).",
            "DateCreated": "2016-08-22T00:00:00",
            "StartTime": "1900-01-01T15:20:17",
            "EndTime": "1900-01-01T15:20:00",
            "IsSystemEntry": true
         },
         "AccountName": "We Monitor Networks, Inc.",
         "PhoneNumber": "(123) 456-7890",
         "Rep":          {
            "FirstName": "Radhika",
            "LastName": "R",
            "PhoneNumber": "(402) 156-4566",
            "EmailAddress": "radhika@tigerpawsoftware.com",
            "DisplayName": "Radhika R",
            "SearchName": "Radhika R (radhika@tigerpawsoftware.com)"
         }
      },
    
    .....
   ],

"PageSize": 5,
"NextRow": 5,
"TotalCount": 2286,
"Success": true
}

Retreive document summary or detailed information

In the following example we are retrieving the summary information for account 10010.

GET /api/accounts/10010 HTTP/1.1
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

This request will retrieve detailed information for account 10010.

GET /api/accounts/10010/details HTTP/1.1
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9

Create a document

In this example we will create a service order using a POST method.

POST /api/serviceorders HTTP/1.1
Content-Type: application/json
Content-Length: 58
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
{
    "AccountNumber":1053250,
    "BriefDescription": "Service Requested",
    "WorkRequested":"Wor requested by user.",
    "AlternateContactPhoneNumber":"402-981-5847",
    "AlternateContactEmailAddress":"test@email.com",
    "DateTimeRequested":{"DateTime":"2016-06-30T14:20:00"},
    "ServiceOrderType":"Web",
    "TechnicianAssigned":2,
    "RepNumber":2,
    "ModifiedByRepNumber":2
}

Update a document

In this example we will update an account's accounting information using a PUT method.

PUT /api/accounts/407555/accounting HTTP/1.1
Content-Type: application/json
Content-Length: 693
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9
{
      "ARCustomerNumber": "407555",
      "SalesTaxCode": "_10 TaxGS",
      "BOTaxType": "N/A",
      "DefaultTerms": "Due Upon Receipt",
      "DefaultPriceLevel": "01 List",
      "DefaultLaborRate": 19,
      "AllowedInvoicePaymentLateDays": null,
      "DefaultPayMethodID": 4418,
      "DefaultPriceLevelID": 1,
      "PrimaryBillToID": 471,
      "PrimaryShipToID": 529,
      "AddToAccountsReceiveable": false,
      "AlwaysBillParent": false,
      "ApplyQuantityDiscounts": true,
      "CreditHold": false,
      "EnableCentralBilling": false,
      "GSTExempt": false,
      "ProviderTaxExempt": true,
      "TaxGST": false,
      "TaxFreight": false,
      "TaxLabor": false
   }

Delete information from Tigerpaw

In this example we will remove a specific ship-to address from an account.

DELETE /api/accounts/1053145/accounting/shiptos?id=604 HTTP/1.1
Content-Type: application/json
Content-Length: 0
Host: api.yourhost.com
Authorization: TSI MGu0OWM5NTQtMGE0My00NjM5LWJjYWEtZDNhMGE3YzM4NDg5OlNwS0syRjYvc2lEVzlQWUpTZlNQYmk4Y081bXVLdXYwVVNQY2J4dFpUdlE9