Clients API Documentation

clients-api-service

Overview

Version information

Version : 0.0.1 [v.1]

Tags

  • ClientsController

Access

  • Base URL: https://public-api.crunch.co.uk/v1/clients

Paths

Create new customer

Up
post /

Consumes

This API call consumes the following media types via the Content-Type request header:
  • application/json

Request body

body CustomerDto (optional)
Body Parameter

Security

oauth2-authorisation-code
Type: oauth2 Scopes: create:all

Return type

Example data

Content-Type: application/json
{
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

New customer was created CustomerDto

Delete a customer

Up
delete /{customerId}

Path parameters

customerId (required)
Path Parameter — format: int64

Security

oauth2-authorisation-code
Type: oauth2 Scopes: delete:all

Return type

Example data

Content-Type: application/json
{
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Customer successfully deleted CustomerDto

400

Bad request or customer is not deletable

404

Customer could not be found for client

500

Internal issue occurred whilst deleting customer

Get all Clients for the current user in a single list

Up
get /list

Security

oauth2-authorisation-code
Type: oauth2 Scopes: read:all

Return type

array[CustomerDto]

Example data

Content-Type: application/json
[ {
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
}, {
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Customers are successfully returned

Deprecated! Please use /list instead.

Up
get /clients/list

Security

oauth2-authorisation-code
Type: oauth2 Scopes: read:all

Return type

array[CustomerDto]

Example data

Content-Type: application/json
[ {
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
}, {
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Customers are successfully returned

Get all Clients for the current user in a paged format

Up
get /clients
The default sorting criterion is companyName,asc.

Query parameters

page (optional)
Query Parameter — The index of the page to retrieve, based at 0. format: int32
size (optional)
Query Parameter — Number of records returned per page. Maximum value allowed is 200. default: 20 format: int32
sort (optional)
Query Parameter — Sorting criteria by a given <code>field</code>. format: <field>[,asc|desc]

Security

oauth2-authorisation-code
Type: oauth2 Scopes: read:all

Return type

Example data

Content-Type: application/json
{
  "number" : 5,
  "size" : 1,
  "last" : true,
  "numberOfElements" : 9,
  "totalPages" : 0,
  "pageable" : {
    "paged" : true,
    "pageNumber" : 7,
    "offset" : 5,
    "pageSize" : 2,
    "unpaged" : true
  },
  "sort" : {
    "unsorted" : true,
    "sorted" : true,
    "empty" : true
  },
  "content" : [ {
    "note" : {
      "id" : 1,
      "text" : "text"
    },
    "paymentTermsDays" : 6,
    "name" : "name",
    "id" : 0,
    "billingAddress" : {
      "country" : "country",
      "line4" : "line4",
      "postCode" : "postCode",
      "line3" : "line3",
      "line2" : "line2",
      "line1" : "line1"
    },
    "email" : "email"
  }, {
    "note" : {
      "id" : 1,
      "text" : "text"
    },
    "paymentTermsDays" : 6,
    "name" : "name",
    "id" : 0,
    "billingAddress" : {
      "country" : "country",
      "line4" : "line4",
      "postCode" : "postCode",
      "line3" : "line3",
      "line2" : "line2",
      "line1" : "line1"
    },
    "email" : "email"
  } ],
  "first" : true,
  "totalElements" : 6,
  "empty" : true
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Clients are successfully returned PageCustomerDto

Get all customer details for a customer

Up
get /{id}

Path parameters

id (required)
Path Parameter — format: int64

Security

oauth2-authorisation-code
Type: oauth2 Scopes: read:all

Return type

Example data

Content-Type: application/json
{
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Customer details found and successfully returned CustomerDto

500

An issue getting the Customer details occurred

404

Customer details not found

Create new customer

Up
put /{id}

Path parameters

id (required)
Path Parameter — format: int64

Consumes

This API call consumes the following media types via the Content-Type request header:
  • application/json

Request body

body CustomerDto (optional)
Body Parameter

Security

oauth2-authorisation-code
Type: oauth2 Scopes: update:all

Return type

Example data

Content-Type: application/json
{
  "note" : {
    "id" : 1,
    "text" : "text"
  },
  "paymentTermsDays" : 6,
  "name" : "name",
  "id" : 0,
  "billingAddress" : {
    "country" : "country",
    "line4" : "line4",
    "postCode" : "postCode",
    "line3" : "line3",
    "line2" : "line2",
    "line1" : "line1"
  },
  "email" : "email"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Customer details successfully updated CustomerDto

500

An issue updating the Customer details occurred

404

Customer details not found

Models

[ Jump to Methods ]

Table of Contents

  1. AddressDto
  2. CustomerDto
  3. NoteDto
  4. PageCustomerDto
  5. Pageable
  6. Sort

AddressDto Up

line1
line2
line3 (optional)
line4 (optional)
postCode (optional)
country

CustomerDto Up

id (optional)
Long format: int64
name (optional)
email (optional)
paymentTermsDays (optional)
Integer format: int32
billingAddress (optional)
note (optional)

NoteDto Up

id (optional)
Long format: int64
text (optional)

PageCustomerDto Up

totalPages (optional)
Integer format: int32
totalElements (optional)
Long format: int64
size (optional)
Integer format: int32
content (optional)
number (optional)
Integer format: int32
sort (optional)
last (optional)
pageable (optional)
numberOfElements (optional)
Integer format: int32
first (optional)
empty (optional)

Pageable Up

offset (optional)
Long format: int64
sort (optional)
paged (optional)
unpaged (optional)
pageSize (optional)
Integer format: int32
pageNumber (optional)
Integer format: int32

Sort Up

empty (optional)
sorted (optional)
unsorted (optional)