Skip to content

API Doc

yavuzgok edited this page Dec 30, 2018 · 22 revisions
Table of Contents

Sample Authenticated Request

First make authenticate request, get token, use token all preceding requests.

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/authenticate" \
       -H "Accept: application/json" \
       -H "Content-Type: application/json" \
       -d '{ "password": "test", "username": "bfurmonger0@xinhuanet.com"}'

{
  "id": 10,
  "login": "bfurmonger0@xinhuanet.com",
  "firstName": "Bartie",
  "lastName": "Furmonger",
  "imageUrl": "",
  "activated": true,
  "langKey": "en",
  "createdBy": null,
  "createdDate": null,
  "lastModifiedBy": null,
  "lastModifiedDate": null,
  "authorities": [
    {
      "name": "ROLE_MANAGER"
    }
  ],
  "teamId": null,
  "jwt": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzU0NjMyN30.9SfJvkJAIb0-KgPmkXI0Hahcjpmp3zmIOIVOtTcY6uw1tYuJU-fvCEzeZGg-lbYtf23c1MxOoy6PDdo2-jCzEg",
  "teamLead": true
}


curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/pipelines/1" \
      -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzU0NjMyN30.9SfJvkJAIb0-KgPmkXI0Hahcjpmp3zmIOIVOtTcY6uw1tYuJU-fvCEzeZGg-lbYtf23c1MxOoy6PDdo2-jCzEg"

{
  "id" : 1,
  "name" : "Pre-Sales Pipeline"
}

Authentication

Leadlet provides basic authentication.

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/authenticate" \
      -H "Accept: application/json" \
      -H "Content-Type: application/json" \
      -d '{ "password": "test", "username": "bfurmonger0@xinhuanet.com"}'

{
  "id" : 10,
  "login" : "bfurmonger0@xinhuanet.com",
  "firstName" : "Bartie",
  "lastName" : "Furmonger",
  "imageUrl" : "",
  "activated" : true,
  "langKey" : "en",
  "createdBy" : null,
  "createdDate" : null,
  "lastModifiedBy" : null,
  "lastModifiedDate" : null,
  "authorities" : [ {
    "name" : "ROLE_MANAGER"
  } ],
  "jwt" : "<your_token>"
}

Pagination

Requests that return multiple items will be paginated to 20 items by default. You can specify further pages with the ?page parameter. For some resources, you can also set a custom page size up to 100 with the ?size parameter.

curl 'https://api.github.com/user/repos?page=2&size=100'

Pipelines

Get One

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/pipelines/1" \
      -H "Authorization: Bearer <your_token>"

{
  "id" : 1,
  "name" : "Pre-Sales Pipeline"
}

Get

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/pipelines" -H "Authorization: Beare <your_token>"

[ {
  "id" : 1,
  "name" : "Pre-Sales Pipeline"
}, {
  "id" : 2,
  "name" : "Sales Pipeline"
} ]

Post

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/pipelines" \
      -H "Accept: application/json" \
      -H "Content-Type: application/json" \
        -H "Authorization: Bearer <your_token>" \
        -d '{"name": "new_pipeline"}'

{
  "id" : 19,
  "name" : "new_pipeline"
}

Delete


curl -X DELETE "http://ns344214.ip-188-165-194.eu:8080/api/pipelines/19" \ 
        -H "Authorization: <your_token>"

{
  "id" : 19,
  "name" : null
}

Stages

Get One

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/stages/10" \
         -H "Authorization: Bearer <your_token>"
{
  "id" : 10,
  "name" : "Incoming",
  "pipelineId" : 1
}

Get

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/stages" -H "Authorization: Bearer <your_token>"

[ {
  "id" : 10,
  "name" : "Incoming",
  "pipelineId" : 1
}, {
  "id" : 11,
  "name" : "Qualified",
  "pipelineId" : 1
}, {
  "id" : 12,
  "name" : "Quote",
  "pipelineId" : 1
},
...
]

Post

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/stages" \
        -H "Accept: application/json" \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer <your_token>" \
        -d '{"name": "new_stage"}'
{
  "id" : 100,
  "name" : "new_stage",
  "pipelineId" : null
}

Delete


curl -X DELETE "http://ns344214.ip-188-165-194.eu:8080/api/stages/100" \
        -H "Authorization: Bearer <your_token>"

{
  "id" : 100,
  "name" : null,
  "pipelineId" : null
}

Deals

Get Deal

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/deals/101" \
> -H "Authorization: Bearer <your_token>"
{
  "id" : 101,
  "title" : "id luctus nec molestie sed justo",
  "priority" : 2,
  "stage" : {
    "id" : 11,
    "name" : "Qualified",
    "pipelineId" : 1
  },
  "pipeline" : {
    "id" : 1,
    "name" : "Pre-Sales Pipeline"
  },
  "person" : {
    "id" : 126,
    "name" : "Susanne",
    "address" : "Grigoriev",
    "title" : "sgrigorievq@themeforest.net",
    "phones" : [ ],
    "email" : "sgrigorievq@about.me"
  },
  "agent" : {
    "id" : 11,
    "login" : "hpendered1@sakura.ne.jp",
    "firstName" : "Hyacinthe",
    "lastName" : "Pendered",
    "imageUrl" : "",
    "activated" : true,
    "langKey" : "en",
    "createdBy" : null,
    "createdDate" : null,
    "lastModifiedBy" : null,
    "lastModifiedDate" : null,
    "authorities" : [ {
      "name" : "ROLE_MANAGER"
    } ],
    "teamId" : 31,
    "teamLead" : true
  },
  "createdDate" : "2018-11-20T19:20:48Z",
  "lastModifiedDate" : null,
  "possibleCloseDate" : null,
  "dealValue" : {
    "currency" : null,
    "potentialValue" : 11.25
  },
  "dealSource" : {
    "id" : 2,
    "name" : "Google"
  },
  "dealChannel" : {
    "id" : 1,
    "name" : "Social Media Agent"
  },
  "products" : [ {
    "id" : 1,
    "name" : "ortodontik tedavisi",
    "price" : 6000.0,
    "description" : "dislerdeki bozukluklar giderilir"
  } ],
  "activityStatus" : "EXPIRED",
  "dealStatus" : "NOT_SET",
  "lostReason" : {
    "id" : 1,
    "name" : "high price"
  }
}

Get Deals

Deals endpoint supports query parameter q, we expect q in lucene query format. Here is the list of queryable fields:

  • id
  • created_date
  • pipeline_id
  • stage_id
  • priority
  • source
  • channel
  • products
  • app_account_id
  • dealStatus
  • lostReason
curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/deals?q=pipeline_id:1%20AND%20stage_id:11&page=0&size=2&sort=priority,asc" \
       -H "Authorization: Bearer <your_token>"
[ {
  "id" : 101,
  "title" : "id luctus nec molestie sed justo",
  "priority" : 2,
  "stage" : {
    "id" : 11,
    "name" : "Qualified",
    "pipelineId" : 1
  },
  "pipeline" : {
    "id" : 1,
    "name" : "Pre-Sales Pipeline"
  },
  "person" : {
    "id" : 126,
    "name" : "Susanne",
    "address" : "Grigoriev",
    "title" : "sgrigorievq@themeforest.net",
    "phones" : [ ],
    "email" : "sgrigorievq@about.me"
  },
  "agent" : {
    "id" : 11,
    "login" : "hpendered1@sakura.ne.jp",
    "firstName" : "Hyacinthe",
    "lastName" : "Pendered",
    "imageUrl" : "",
    "activated" : true,
    "langKey" : "en",
    "createdBy" : null,
    "createdDate" : null,
    "lastModifiedBy" : null,
    "lastModifiedDate" : null,
    "authorities" : [ {
      "name" : "ROLE_MANAGER"
    } ],
    "teamId" : 31,
    "teamLead" : true
  },
  "createdDate" : "2018-11-20T19:20:48Z",
  "lastModifiedDate" : null,
  "possibleCloseDate" : null,
  "dealValue" : {
    "currency" : null,
    "potentialValue" : 11.25
  },
  "dealSource" : {
    "id" : 2,
    "name" : "Google"
  },
  "dealChannel" : {
    "id" : 1,
    "name" : "Social Media Agent"
  },
  "products" : [ {
    "id" : 1,
    "name" : "ortodontik tedavisi",
    "price" : 6000.0,
    "description" : "dislerdeki bozukluklar giderilir"
  } ],
  "activityStatus" : "EXPIRED",
  "dealStatus" : "NOT_SET",
  "lostReason" : {
    "id" : 1,
    "name" : "high price"
  }
}, {
  "id" : 111,
  "title" : "maecenas rhoncus aliquam lacus",
  "priority" : 12,
  "stage" : {
    "id" : 11,
    "name" : "Qualified",
    "pipelineId" : 1
  },
  "pipeline" : {
    "id" : 1,
    "name" : "Pre-Sales Pipeline"
  },
  "person" : {
    "id" : 182,
    "name" : "Karrie",
    "address" : "Zollner",
    "title" : "kzollner2a@economist.com",
    "phones" : [ ],
    "email" : "kzollner2a@wikia.com"
  },
  "agent" : {
    "id" : 10,
    "login" : "bfurmonger0@xinhuanet.com",
    "firstName" : "Bartie",
    "lastName" : "Furmonger",
    "imageUrl" : "",
    "activated" : true,
    "langKey" : "en",
    "createdBy" : null,
    "createdDate" : null,
    "lastModifiedBy" : null,
    "lastModifiedDate" : null,
    "authorities" : [ {
      "name" : "ROLE_MANAGER"
    } ],
    "teamId" : 12,
    "teamLead" : true
  },
  "createdDate" : "2018-11-20T19:20:48Z",
  "lastModifiedDate" : null,
  "possibleCloseDate" : null,
  "dealValue" : {
    "currency" : null,
    "potentialValue" : 95.44
  },
  "dealSource" : {
    "id" : 6,
    "name" : "Eksi Sozluk"
  },
  "dealChannel" : {
    "id" : 2,
    "name" : "Landing Page"
  },
  "products" : [ ],
  "activityStatus" : "IN_FUTURE",
  "dealStatus" : "NOT_SET",
  "lostReason" : {
    "id" : 1,
    "name" : "high price"
  }
} ]

### Post

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/deals" \

    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0NjI2MDk4OX0.ce6fzyITQ-SNENorzdnCrG89zN7ftoY210EQppTybV9wbsf7-8f022V5Dx2-Tbz7wOM20fiC7yokKatsr7x3Zw" \
    -d '{ "title" : "demo deal", "priority" : 2, "stage" : { "id" : 11, "name" : "Qualified", "pipelineId" : 1 }, "pipeline" : { "id" : 1, "name" : "Pre-Sales Pipeline" }, "person" : { "id" : 126, "name" : "Susanne", "address" : "Grigoriev", "title" : "sgrigorievq@themeforest.net", "phones" : [ ], "email" : "sgrigorievq@about.me" }, "agent" : { "id" : 11, "login" : "hpendered1@sakura.ne.jp", "firstName" : "Hyacinthe", "lastName" : "Pendered", "imageUrl" : "", "activated" : true, "langKey" : "en", "createdBy" : null, "createdDate" : null, "lastModifiedBy" : null, "lastModifiedDate" : null, "authorities" : [ { "name" : "ROLE_MANAGER" } ], "teamId" : 31, "teamLead" : true }, "createdDate" : "2018-11-20T19:20:48Z", "lastModifiedDate" : null, "possibleCloseDate" : null, "dealValue" : { "currency" : null, "potentialValue" : 11.25 }, "dealSource" : { "id" : 2, "name" : "Google" }, "dealChannel" : { "id" : 1, "name" : "Social Media Agent" }, "products" : [ { "id" : 1, "name" : "ortodontik tedavisi", "price" : 6000.0, "description" : "dislerdeki bozukluklar giderilir" } ], "activityStatus" : "EXPIRED", "dealStatus" : "NOT_SET", "lostReason" : { "id" : 1, "name" : "high price" } }'

{ "id" : 1000, "title" : "demo deal", "priority" : 2, "stage" : { "id" : 11, "name" : "Qualified", "pipelineId" : 1 }, "pipeline" : { "id" : 1, "name" : "Pre-Sales Pipeline" }, "contact" : null, "agent" : { "id" : 11, "login" : "hpendered1@sakura.ne.jp", "firstName" : "Hyacinthe", "lastName" : "Pendered", "imageUrl" : "", "activated" : true, "langKey" : "en", "createdBy" : null, "createdDate" : null, "lastModifiedBy" : null, "lastModifiedDate" : null, "authorities" : [ { "name" : "ROLE_MANAGER" } ] }, "createdDate" : "2018-12-30T12:56:44Z", "lastModifiedDate" : "2018-12-30T12:56:44Z", "possibleCloseDate" : null, "dealValue" : { "currency" : null, "potentialValue" : 11.25 }, "dealSource" : { "id" : 2, "name" : "Google" }, "dealChannel" : { "id" : 1, "name" : "Social Media Agent" }, "products" : [ { "id" : 1, "name" : "ortodontik tedavisi", "price" : 6000.0, "description" : "dislerdeki bozukluklar giderilir" } ], "nearestActivityDate" : null, "dealStatus" : "NOT_SET", "lostReason" : { "id" : 1, "name" : "high price" }


## Activities
### Get
Activities endpoint supports query parameter `q`, we expect `q` in lucene query format. 
Here is the list of queryable fields:
* id
* created_date
* start_date
* activity_type
* title
* is_done
* person_id
* deal_id
* agent_id
* app_account_id

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/activities?q=activity_type:EMAIL%20AND%20is_done:true&page=0&size=2&sort=id,asc"
-H "Authorization: Bearer <your_token>" [ { "id" : 177, "title" : "lectus aliquam sit amet", "memo" : "diam cras pellentesque", "start" : "2018-01-02T23:00:00Z", "end" : "2018-01-06T23:00:00Z", "type" : null, "deal" : { "id" : 112, "title" : "eget congue eget", "priority" : 13, "stage" : { "id" : 14, "name" : "X", "pipelineId" : 1 }, "pipeline" : { "id" : 1, "name" : "Pre-Sales Pipeline" }, "person" : { "id" : 122, "name" : "Verna", "address" : "Dewbury", "title" : "vdewburym@dmoz.org", "phones" : [ ], "email" : "vdewburym@msn.com" }, "agent" : { "id" : 14, "login" : "czavattari4@spotify.com", "firstName" : "Carry", "lastName" : "Zavattari", "imageUrl" : "", "activated" : true, "langKey" : "en", "createdBy" : null, "createdDate" : null, "lastModifiedBy" : null, "lastModifiedDate" : null, "authorities" : [ { "name" : "ROLE_MANAGER" } ], "teamId" : 24, "teamLead" : true }, "createdDate" : "2018-11-20T19:20:48Z", "lastModifiedDate" : null, "possibleCloseDate" : null, "dealValue" : { "currency" : null, "potentialValue" : 57.69 }, "dealSource" : { "id" : 7, "name" : "Onedio" }, "dealChannel" : { "id" : 2, "name" : "Landing Page" }, "products" : [ ], "activityStatus" : "IN_FUTURE", "dealStatus" : "NOT_SET", "lostReason" : { "id" : 1, "name" : "high price" } }, "person" : { "id" : 172, "name" : "Jasmin", "address" : "Blaydon", "title" : "jblaydon20@e-recht24.de", "phones" : [ ], "email" : "jblaydon20@php.net" }, "agent" : { "id" : 13, "login" : "sdrewes3@cdc.gov", "firstName" : "Sioux", "lastName" : "Drewes", "imageUrl" : "", "activated" : true, "langKey" : "en", "createdBy" : null, "createdDate" : null, "lastModifiedBy" : null, "lastModifiedDate" : null, "authorities" : [ { "name" : "ROLE_MANAGER" } ], "teamId" : 11, "teamLead" : true }, "location" : null, "done" : true, "closedDate" : null }, { "id" : 185, "title" : "cubilia curae nulla dapibus", "memo" : "donec diam neque vestibulum", "start" : "2018-01-03T23:00:00Z", "end" : "2018-01-09T23:00:00Z", "type" : null, "deal" : { "id" : 174, "title" : "leo odio porttitor id consequat in", "priority" : 75, "stage" : { "id" : 18, "name" : "Closure2", "pipelineId" : 2 }, "pipeline" : { "id" : 2, "name" : "Sales Pipeline" }, "person" : { "id" : 195, "name" : "Maxine", "address" : "Secker", "title" : "msecker2n@webnode.com", "phones" : [ ], "email" : "msecker2n@house.gov" }, "agent" : { "id" : 11, "login" : "hpendered1@sakura.ne.jp", "firstName" : "Hyacinthe", "lastName" : "Pendered", "imageUrl" : "", "activated" : true, "langKey" : "en", "createdBy" : null, "createdDate" : null, "lastModifiedBy" : null, "lastModifiedDate" : null, "authorities" : [ { "name" : "ROLE_MANAGER" } ], "teamId" : 31, "teamLead" : true }, "createdDate" : "2018-11-20T19:20:48Z", "lastModifiedDate" : null, "possibleCloseDate" : null, "dealValue" : { "currency" : null, "potentialValue" : 81.62 }, "dealSource" : null, "dealChannel" : null, "products" : [ ], "activityStatus" : "TODAY", "dealStatus" : "NOT_SET", "lostReason" : { "id" : 1, "name" : "high price" } }, "person" : { "id" : 145, "name" : "Marje", "address" : "Kilty", "title" : "mkilty19@rediff.com", "phones" : [ ], "email" : "mkilty19@51.la" }, "agent" : { "id" : 14, "login" : "czavattari4@spotify.com", "firstName" : "Carry", "lastName" : "Zavattari", "imageUrl" : "", "activated" : true, "langKey" : "en", "createdBy" : null, "createdDate" : null, "lastModifiedBy" : null, "lastModifiedDate" : null, "authorities" : [ { "name" : "ROLE_MANAGER" } ], "teamId" : 24, "teamLead" : true }, "location" : null, "done" : true, "closedDate" : null } ]


## Contacts
### Get One

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/contacts/100"
-H "Authorization: Bearer " { "id" : 100, "name" : "Julis", "address" : "Bucklan", "login" : "jbucklan0@blogtalkradio.com", "gender" : "M", "phones" : [ ], "email" : "jbucklan0@huffingtonpost.com" }


### Get 
Contacts get endpoint does not support query parameters yet.

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/contacts"
-H "Authorization: Bearer " [ { "id" : 100, "name" : "Julis", "address" : "Bucklan", "login" : "jbucklan0@blogtalkradio.com", "gender" : "M", "phones" : [ ], "email" : "jbucklan0@huffingtonpost.com" }, { "id" : 101, "name" : "Ruy", "address" : "Sivess", "login" : "rsivess1@ezinearticles.com", "gender" : "M", "phones" : [ ], "email" : "rsivess1@macromedia.com" }, { "id" : 102, "name" : "Lynett", "address" : "Caldron", "login" : "lcaldron2@live.com", "gender" : "M", "phones" : [ ], "email" : "lcaldron2@acquirethisname.com" }, ... ]


### Post

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/contacts"
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Bearer "
-d '{ "name" : "Elon Musk", "address" : "Mars", "login" : "emusk@gmail.com", "gender" : "M", "email" : "emusk@acquirethisname.com"}' { "id" : 1000, "name" : "Elon Musk", "address" : "Mars", "login" : "emusk@gmail.com", "gender" : "M", "phones" : [ ], "email" : "emusk@acquirethisname.com" }

### Delete

curl -X DELETE "http://ns344214.ip-188-165-194.eu:8080/api/contacts/1000"
-H "Authorization: Bearer "

[ 1000 ]


## Products
### Get One

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/products/1" \

  -H "Authorization: Bearer <token>"

{ "id" : 1, "name" : "ortodontik tedavisi", "price" : 6000.0, "description" : "dislerdeki bozukluklar giderilir" }


### Get 
Contacts get endpoint does not support query parameters yet.

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/products" \

  -H "Authorization: Bearer <token>"

[ { "id" : 1, "name" : "ortodontik tedavisi", "price" : 6000.0, "description" : "dislerdeki bozukluklar giderilir" }, { "id" : 2, "name" : "internet paketi", "price" : 80.0, "description" : "ayda 80tl ye internet paketi" }, { "id" : 3, "name" : "kiralık minik daireler", "price" : 2500.0, "description" : "bekarlar icin" }, { "id" : 4, "name" : "dis implanti", "price" : 6000.0, "description" : "eksik disler giderilir" } ]


### Post

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/products"
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Bearer "
-d '{"name" : "test products", "price" : 6000.0, "description" : "lorem ipsum" }' { "id" : 5, "name" : "test products", "price" : 6000.0, "description" : "lorem ipsum" }

### Delete

curl -X DELETE "http://ns344214.ip-188-165-194.eu:8080/api/products/5"
-H "Authorization: Bearer "

{ "id" : 5, "name" : null, "price" : null, "description" : null }


## Notes
### Get One

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/notes/1" \

 -H "Authorization: Bearer <token>"

{ "id" : 1, "content" : "nonummy integer non velit donec", "contactId" : 111, "dealId" : null }


### Get 
Contacts get endpoint does not support query parameters yet.

curl -X GET "http://ns344214.ip-188-165-194.eu:8080/api/notes" \

 -H "Authorization: Bearer <token>"

[ { "id" : 1, "content" : "nonummy integer non velit donec", "contactId" : 111, "dealId" : null }, { "id" : 2, "content" : "ante nulla", "contactId" : 160, "dealId" : null }, { "id" : 3, "content" : "sit amet eleifend pede", "contactId" : 175, "dealId" : null }, { "id" : 4, "content" : "morbi sem mauris laoreet ut", "contactId" : 115, "dealId" : null }, ... ]


### Post

curl -X POST "http://ns344214.ip-188-165-194.eu:8080/api/notes"
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Bearer "
-d '{"content" : "lorem ipsum", "contactId" : 113}' { "id" : 3002, "content" : "lorem ipsum", "contactId" : 113, "dealId" : null }

### Delete

curl -X DELETE "http://ns344214.ip-188-165-194.eu:8080/api/notes/3002"
-H "Authorization: Bearer " { "id" : 3002, "content" : null, "contactId" : null, "dealId" : null }

Clone this wiki locally