webCRM REST API

To access the webCRM REST API you need a webCRM Plus or webCRM Enterprise subscription.

The API and its reference documentation are located at api.webcrm.com.

Getting Started

The webCRM REST API uses JSON Web Token (JWT) for authentication. For that reason, all calls to the API must include an authorization field with the access token in the HTTP header.

Application Tokens

The application token is a GUID that uniquely identifies your webCRM instance and a set of access rights to the different parts of webCRM. You can create multiple tokens with different access rights. This is great for creating a test token that only has read access to your data.

Create your application tokens at webcrm.com > Configuration > Integration > API > REST. (Sign in to webCRM before using the link.)

Access Tokens

Use the application token to get an access token by calling https://api.webcrm.com/Auth/ApiLogin including the application token as authCode in the body.

POST /Auth/ApiLogin HTTP/1.1
authCode=12345678-90ab-cdef-1234-4567890abcdef

This returns the following JSON:

{
  "AccessToken": "67b91fd819c4…",
  …

Access tokens are valid for an hour.

Using the Access Token

Add Authorization: Bearer 67b91fd819c4… to the HTTP header. Example:

GET https://api.webcrm.com/Persons?Page=1&Size=10
Authorization: Bearer 67b91fd819c4…

This returns the list of the first ten persons registered in your webCMS system:

[
  {
    "PersonBlockMassEmail": false,
    "PersonCampaignPassword": "",
    "PersonCampaignWrongPasswordCount": 0,
    "PersonCheckMark1": false,
    …

 

Postman Collection

A Postman collection with basic scripts for accessing out API is available at www.getpostman.com/collections/fa529a0ada7a62955836.

Reference Documentation

Reference documentation provides a Swagger definition file for auto-generating API clients for most modern developer environments.

 

FAQ

 

QuotationLines and Linked data

To see if linked data is enabled you will either need to go into your webCRM system or see the error code from the given api call. If the error code is “Possible quotation not found” you have linked data enabled. If you don't have the error code or want to check whether linked data is enabled in your webCRM system go to Configuration -> Customfields -> choose either of the entities, Organization, Persons, Activities, Pipelines, Orders, and Products -> click the chain icon. You are now at the linked data page for the entity chosen, if any of the fields are used (not none) linked data is enabled.

In the scenario where linked data is enabled you will need to use the endpoints with /LinkedData after the entity chosen.

Example: GET /Activities/LinkedData

 

Quotationlines with linked data

Linked data is as the name might suggest data which is linked from one entity to another. If you want data from products on a Quotationline as an example, you can use linked data.
The way you accommodate this, is that you need to use the endpoint /QuotationLine/LinkedData
In the body you will see some of the normal Quotationline entities and some new ones. The new ones are the important part for linked data. You have QuotationLineLinkedDataItemData 1 – 9 and it is these fields that you need to use for the specific linked data which have been configured in the webCRM system.

When a new /QuotationLine/LinkedData has been created you will receive a QuotationLineLinkedDataId, this Id will be needed in the regular Quotationline endpoint where you will need to set it in the field QuotationLineLinkedDataId. You don't need to set QuotationLineData 1 – 9 in the Quotationline as the API will add the corresponding QuotationLineLinkedDataItemData's.

 

Quotationlines without linked data

To use Quotationlines via the API go to the documentation for all the available endpoints.
There are two rules that apply when using any of the the endpoints.

        When creating, QuotationLineId needs to be 0. When dealing with specific Quotationlines you need to use the id of the specific Quotationline.

 

Query endpoint

Q: Can I query for entities via the API?

A: We have an endpoint dedicated to that specific request. You can use SQL to retrieve the data you want with the only exception being, that you can't use insert.

Example:

https://api.webcrm.com/queries?script=select * from product where ProductUpdatedAt = 43853.4536689814

https://api.webcrm.com/Queries?script=SELECT PersonName FROM person JOIN Organisation ON Person WHERE Organisation = 1

 

Custom Fields

Q: What can I put in a custom field?

A: You can put more or less what you want. In the webCRM system you can select the type for the custom field.

The possible types is:

  • List
  • String
  • Integer
  • Double
  • Checkbox

Things to be aware of

To check a checkbox you input "Yes" and to uncheck you input "No".

For a list you will need to match the entities exact as it is case sensitive.