Skip to content

API Doc

yavuzgok edited this page Nov 29, 2018 · 22 revisions
Table of Contents

Swagger
Authentication
Pipelines
Stages
Deals
Activities
Persons

Swagger

Start backend with below command:

./mvnw -P dev,swagger

Browse http://localhost:8080/swagger-ui.html to see documentation.

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://localhost:8080/api/pipelines/1" \
	-H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"

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

Get

curl -X GET "http://localhost:8080/api/pipelines" -H "Authorization: Beare <your_token>"

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

Post

curl -X POST "http://localhost:8080/api/pipelines" \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
        -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA" \
        -d '{"name": "new_pipeline"}'

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

Delete


curl -X DELETE "http://localhost:8080/api/pipelines/19" \ 
        -H "Authorization: <your_token>"

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

Stages

Get One

curl -X GET "http://localhost:8080/api/stages/10" \
         -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"
{
  "id" : 10,
  "name" : "Incoming",
  "pipelineId" : 1,
  "color" : null
}

Get

curl -X GET "http://localhost:8080/api/stages" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"

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

Post

curl -X POST "http://localhost:8080/api/stages" \
        -H "Accept: application/json" \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA" \
        -d '{"name": "new_stage"}'
{
  "id" : 100,
  "name" : "new_stage",
  "pipelineId" : null,
  "color" : null

Delete


curl -X DELETE "http://localhost:8080/api/stages/100" \
        -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"

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

Deals

Get Deal

curl -X GET "http://localhost:8080/api/deals/101" \
> -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"
{
  "id" : 101,
  "title" : "id luctus nec molestie sed justo",
  "priority" : 2,
  "stage" : {
    "id" : 11,
    "name" : "Qualified",
    "pipelineId" : 1,
    "color" : null
  },
  "pipeline" : {
    "id" : 1,
    "name" : "Pre-Sales Pipeline",
    "order" : 1
  },
  "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://localhost:8080/api/deals?q=pipeline_id:1%20AND%20stage_id:11&page=0&size=2&sort=priority,asc" \
       -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"
[ {
  "id" : 101,
  "title" : "id luctus nec molestie sed justo",
  "priority" : 2,
  "stage" : {
    "id" : 11,
    "name" : "Qualified",
    "pipelineId" : 1,
    "color" : null
  },
  "pipeline" : {
    "id" : 1,
    "name" : "Pre-Sales Pipeline",
    "order" : 1
  },
  "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,
    "color" : null
  },
  "pipeline" : {
    "id" : 1,
    "name" : "Pre-Sales Pipeline",
    "order" : 1
  },
  "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"
  }
} ]

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://localhost:8080/api/activities?q=activity_type:EMAIL%20AND%20is_done:true&page=0&size=2&sort=id,asc" \
      -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJiZnVybW9uZ2VyMEB4aW5odWFuZXQuY29tIiwiYXV0aCI6IlJPTEVfTUFOQUdFUiIsImFjY291bnQiOjEsImV4cCI6MTU0MzUyMTI1Mn0.esymg6voBWXcaupgHeFxiKQsg9BH8VUujC54kAuVT_bBAqJ1fEqLt4JDB7CvOjvQBa6gwMRWowmNwxD4Sr10UA"
[ {
  "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,
      "color" : null
    },
    "pipeline" : {
      "id" : 1,
      "name" : "Pre-Sales Pipeline",
      "order" : 1
    },
    "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,
      "color" : null
    },
    "pipeline" : {
      "id" : 2,
      "name" : "Sales Pipeline",
      "order" : 2
    },
    "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
} ]

Persons

Clone this wiki locally