Skip to main content

Crawler Import Service

Description

This service is used to simplify importing data to ATOLLON. In ATOLLON, it's possible to add more complex business logic based on request type and it's parameters. External developers are let go of understanding ATOLLON's blackbox.

Request

POST https://<HOST>/crab/crawler/<request_type>?instance=<instance_name>

Contact

Create contact (person or company) with (optionally) contact folder identified by context category (FPATypeCategory).

Request

POST https://<HOST>/crab/crawler/contact?instance=<instance_name>

Data in JSON format:

{
   "person": {
      "firstName":"<name>",
      "lastName":"<surname>",
      "companyPersonRelation": [
        {
         "companyExternalId":[{
           				      "system":"<system1>",
                              "id":"<Company contact oldexternal ID>"
                             }],
         "positionDesc":"<Position of person in company>",
         "companyName":"<Name of the related company>"
        }
      ]
   },
   "company": {
      "companyName": "<company name>"
   },
   "address": [
      {
         "street": "<street + number>",
         "city": "<city name>",
         "zip": "<zip text>",
         "region": "<region name>",
         "country": "<country name>",
         "addressType": "<address type1>"
      },
      {
         "street":"<street + number>",
         "city":"<city name>",
         "zip":"<zip text>",
         "region":"<region name>",
         "country":"<country name>",
         "addressType":"<address type2>"
      }
   ],
   "contacts": {
      "email": [
         {
            "contact": "<email1>",
            "contactInfoTypeName": ""
         }, {
            "contact": "<email2>",
            "contactInfoTypeName": ""
         }
      ],
      "phone": [
         {
            "contact": "<telefon1>",
            "contactInfoTypeName": ""
         }, {
            "contact": "<telefon2>",
            "contactInfoTypeName": ""
         }
      ],
      "mobile": [
         {
            "contact": "<mobil1>",
            "contactInfoTypeName": ""
         }, {
            "contact": "<mobil2>",
            "contactInfoTypeName": ""
         }
      ],
      "web": [
        {
            "contact": "<web1>",
            "contactInfoTypeName": ""
         }, {
            "contact": "<web2>",
            "contactInfoTypeName": ""
         }
      ]
   },
   "description": "<Contact text field>",
   "contactGroup": [
     {
      	"name": "<Group 1>",
       	"description": "<description>"
     }, {
      	"name": "<Group 2>",
       	"description": "<descritpion>"
     }
   ],
   "contactFolder": [
    {
      "category": "<string1>",
      "refId": ""
      }, {
      "category": "<string2>",
      "refId": ""
      }
    ],
   "externalId": [
     {
      "system": "<system1>",
      "id": "<Contact old id>"
   	 }, {
      "system": "<sytem2>",
      "id": "<Contact old id>"
   	 }
   ],
   "regNo": "<registered number of business>",
   "vatNo": "<VAT number>",
   "trackingCode": "<string>",
   "source": "<original - your system ident>"
}
Response

on SUCESS

  • contactId
  • folderId
  • contact.externalId

Function progress

  • Person is filled? => contact is "Person contact" (and the person is representative of the company), otherwise it's "Company contact" (either company or person surname is required)
Company contact
  • Check whether company is existing (company name matches some record in DB) // see: https://help.atollon.com/books/backend-development/page/modcontact#bkmrk-%C2%A0
  • If company does not exist, create new contact (company)
  • Contact info and address is stored with company contact
  • With company contact id, check whether contact has the desired contact folder. Desired contact folder is folder with FPATypeCategory (see list below)c. If the lead folder does not exist, it is created.
  • If contactFolderCategory is not filled-in, the contact folder is not created.
  • contactGroup - find the contact group with the same name. If the contact group does not exist, create it. Assign the contact to the group
Person contact
  • Check whether person is existing (based on e-mail, mobile / if these are not filled-in, the person is created anyway). E-mail and mobile is stored with person contact
  • Contact info and address is stored with person contact
  • With person contact id, check whether contact has the desired contact folder. Desired contact folder is folder with FPATypeCategory of the client, lead, supplier, partner, etc. folder types. If the lead folder does not exist, it is created.
  • If contactFolderCategory is not filled-in, the contact folder is not created.
  • contactGroup - find the contact group with the same name. If the contact group does not exist, create it. Assign the contact to the group
  • employer - if company oldId is found in companyPersonRelation, make binding, otherwise if companyName is filled-in in companyPersonRelation, company based on it's name or create new company contact and create binding

After the request is imported successfully, change the TIF status to "2".

Creating contact folder (client, supplier, etc.)

Contact folders is main building block in contact relations (ATOLLON's context).

Some useful context categories for contact folders used:

Client com.atollon.project.fpatypecategory.client
Supplier com.atollon.project.fpatypecategory.supplier
Lead (potential client) com.atollon.leads.fpatypecategory.lead
Partner com.atollon.project.fpatypecategory.partner

Product

https://<HOST>/crab/crawler/product?instance=<instance_name>

POST data in JSON format:

{
    "name": "<Product name>",
    "refId": "<Product code>",
    "description": "<Product description>",
    "typeName": "<Product typee = Product, Service, Technology ...>",
    "defaultQuantity": 1.0000,
    "unitPrice": 4990.00,
    "unitPriceCurrencyName": "<CZK, USD, etc.>",
    "statusName": "<Product status = Active, Inactive>",
    "unitsName": "<Product units = ks, md, hrs>",
    "vatRateName": "<15 %, 21%, etc.>",
    "openingBalanceQty": 0.0000,
    "openingBalanceDate": "<2022-09-09T10:10>" // <now> datetime is default, if not provided,
    "externalId": [
       {
        "system": "<system1>",
        "id": "<ABCD-EFGH-ijkl-...>""
       }, {
        "system": "<sytem2>",
        "id": "<ABCD-EFGH-ijkl-...>""
       }
     ]
}
Response

on SUCCESS

  • productId
  • productName
  • productRefid
  • product.externalId
Function progress
  • Find product based on it's externalId OR code + product name, if this does not match, create product
  • If existing product is found, values are updated, ie openingBalanceQty

Billing

To export service activities that include billing items, get the following resource:

Request

GET https://<HOST>/crab/crawler/billing?billingStatus=ToBeInvoiced&instance=<instance_name>

Response
[{
	"activity": {
		"id": "0123000",
		"name": "<Activity name>",
		"refId": "<Activity REF ID>",
		"statusName": "<Activity custom status name>",
		"description": "<Activity notes>",
		"created": "<2022-09-01T00:00>",
		"modified": "<2022-09-14T10:00>"
	},
	"project": {
		"id": "<project id>",
		"name": "<Project name>",
		"refId": "<Project REF ID>",
		"statusName": "<Activity custom status name>",
		"description": "<Activity notes>",
		"created": "<2022-09-01T00:00>",
		"modified": "<2022-09-14T10:00>"
	},
	"folder": {
		"name": "<Folder name>",
		"refId": "<Folder REF ID>"
	},
	"contact": {
		"person": {
			"firstName": "<name>",
			"lastName": "<surname>"
		},
		"company": {
			"companyName": "<company name>"
		},
		"externalId": [{
			"system": "<system1>",
			"id": "<Contact old id>"
		}, {
			"system": "<sytem2>",
			"id": "<Contact old id>"
		}],
		"regNo": "<registered number of business>",
		"vatNo": "<VAT number>"
	},
	"billingItems": [{
        "id": "123456",
        "productName": "<Product name1>",
		"productRefid": "<Product code>",
		"name": "<Billing item text>",
		"description": "<Billing item description>",
		"quantity": 1.0000,
		"unitPrice": 1000.00,
		"currency": "<EUR, CZK, ...>",
		"billingDate": "<2022-09-14T10:00>",
        "billingStatus": "ToBeInvoiced",
		"externalId": [{
			"system": "<system1>",
			"id": "<Product old id>"
		}, {
			"system": "<sytem2>",
			"id": "<Product old id>"
		}]
	}, {
        "id": "123457",
		"productName": "<Product name2>",
		"productRefid": "<Product code>",
		"name": "<Billing item text>",
		"description": "<Billing item description>",
		"quantity": 1.0000,
		"unitPrice": 1000.00,
		"currency": "<EUR, CZK, ...>",
		"billingDate": "<2022-09-14T10:00>",
        "billingStatus": "ToBeInvoiced",
		"externalId": [{
			"system": "<system1>",
			"id": "<Product old id>"
		}, {
			"system": "<sytem2>",
			"id": "<Product old id>"
		}]
	}],
	"documents": [{
		"name": "<Document name>",
		"id": "123"
	}, {
		"name": "<Document name2>",
		"id": "456"

	}]
}]

Download documents

GET https://<HOST>/crab/crawler/download_document?docId=123123&instance=<instance_name>

You get file in response.

Update billing status of billing items

Run after you have processed the billing items from activity.

You can change status of each of the billing items. If billing items are marked as Invoiced, you can change either activity or project status. Activity status will be changed only if there are no remaining billing items to be invoiced.

Request

PUT https://<HOST>/crab/crawler/billing?instance=<instance_name>

DATA:

[{
  	"activity": {
		"id": "0123000",
		"statusName": "<Activity custom status name>"
	},
	"project": {
		"id": "<project id>",
		"statusName": "<Project custom status name>"
	},
	"billingItems": [{
		"id": "123456",
		"billingStatus": "Billed"
	}, {
		"id": "123457",
		"billingStatus": "Cancelled"
	}]
}]

Billing states:

0
SalesItems
1
Pending
2
ForApproval
3
ToBeInvoiced
4
Billed
5
ApprovedByClient
6
Postponed
7
Cancelled

Project

Request

POST https://<HOST>/crab/crawler/project?instance=<instance_name>

{
	"project": {
		"id": "<project id>",
		"name": "<Project name>",
		"refId": "<Project REF ID>",
		"statusName": "<Activity custom status name>",
		"description": "<Activity notes>",
		"created": "<2022-09-01T00:00>",
		"modified": "<2022-09-14T10:00>",
		"category": "anyProjectCategory"

	},
	"folder": {
		"name": "<Folder name>",
		"refId": "<Folder REF ID>",
        "category": "anyFolderCategory"

	},
	"contact": {
		"person": {
			"firstName": "<name>",
			"lastName": "<surname>"
		},
		"company": {
			"companyName": "<company name>"
		},
		"externalId": [{
			"system": "<system1>",
			"id": "<Contact old id>"
		}, {
			"system": "<sytem2>",
			"id": "<Contact old id>"
		}],
		"regNo": "<registered number of business>",
		"vatNo": "<VAT number>"
	},
	"technologyItems": [{
        "id": "123456",
        "productName": "<Product name1>",
		"productRefid": "<Product code>",
		"name": "<Technology item text>",
		"description": "<Technology item description>",
		"quantity": 1.0000,
		"unitPrice": 1000.00,
		"currency": "<EUR, CZK, ...>",
		"billingDate": "<2022-09-14T10:00>",
		"externalId": [{
			"system": "<system1>",
			"id": "<Product old id>"
		}, {
			"system": "<sytem2>",
			"id": "<Product old id>"
		}]
	}, {
        "id": "123457",
		"productName": "<Product name2>",
		"productRefid": "<Product code>",
		"name": "<Technology item text>",
		"description": "<Technology item description>",
		"quantity": 1.0000,
		"unitPrice": 1000.00,
		"currency": "<EUR, CZK, ...>",
		"billingDate": "<2022-09-14T10:00>",
		"externalId": [{
			"system": "<system1>",
			"id": "<Product old id>"
		}, {
			"system": "<sytem2>",
			"id": "<Product old id>"
		}]
	}]
}

Internal Procedure

  • Based on given contact external id, find existing contact, if no contact is found, say ERR
  • Based on folder.category, find whether folder for given contact is found, if not, create new contact folder
  • Create new project into given category
  • Load new technologyItems into the new project (technology items are projectItems with type = 3)