NAV
Ruby Python

Diffo Profit API Reference dokumentation vDeveloper Version 1

TBA

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Authentication

Post authentication

To authenticate, use this code:

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

body = {
  'grant-type' => 'password',
  'username' => '<username>',
  'password' => '<password>',
  'client_id' => 'diffo_api_client',
}

result = RestClient.post '{{IdentityServer}}/connect/token',
  params: {
  }, headers: headers,
  payload: body

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

body = {
  'grant-type': 'password',
  'username': '<username>',
  'password': '<password>',
  'client_id': 'diffo_api_client',
}

r = requests.post('{{IdentityServer}}/connect/token', headers = headers, data = body)

print(r.json())

POST {{IdentityServer}}/connect/token Post authentication information and receive access_token to be used in api endpoints

Well known endpoints

Parameters

Name In Type Required Description
grant_type payload string true "password"
username payload string true username to login
password payload string true password to login
client_id payload string true "diffo_api_client"

Example responses

200 Response

{
    "access_token": "eyJhbGciOiJ...",
    "expires_in": 3600,
    "token_type": "Bearer",
    "scope": "diffoprofitapi openid profile"
}

Responses

Status Meaning Description Schema
200 OK Success inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous AuthenticationDto true none none
» access_token string true none Token used to authenticate yourself to api server
» expires integer(int32) true none
» token_type string true none
» scope string true none Scope available to access token

How to use token

When using api endpoints, add access_token to headers as follows

Header Type Required Restrictions Value
Authorization string true none "Bearer {{access_token}}"

Calculations

Get Calculations

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Calculations',
  params: {
  }, headers: headers

p JSON.parse(result)
import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Calculations', headers = headers)

print(r.json())

Example responses 200 Response

[
{
    "id": 0,
    "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
    "name": "string",
    "timeBasedCost": 0,
    "distanceBasedCost": 0,
    "revenue": 0,
    "revenuePeriod": 0,
    "totalCost": 0,
    "profit": 0,
    "profitMargin": 0,
    "units": [
      {
        "unit": "km",
        "unitsPerYear": 0,
        "totalCostPerUnit": 0,
        "combinationCost": {
          "perYear": 0,
          "perUnit": 0,
          "percentage": 0
        }
      }
    ],
    "investmentDetails": {
      "category": 0,
      "vehicleClass": 0,
      "name": "string",
      "fuelCost": 0,
      "maintenanceCost": 0,
      "tyresCost": 0,
      "fuelConsumption": 0,
      "countOfTyres": 0,
      "distancePerYear": 0,
      "interestRate": 0,
      "investmentDeductions": 0,
      "vehicleTax": 0,
      "residualValue": 0,
      "insuranceAllRisk": 0,
      "insuranceVehicle": 0
    },
    "profitCalculation": {
      "variableCosts": {
        "fuelCost": 0,
        "maintenanceCost": 0,
        "tyresCost": 0,
        "wage": 0,
        "dailyAllowance": 0,
        "exportCost": 0,
        "totalCost": 0,
        "grossProfit": 0
      },
      "fixedCosts": {
        "capital": 0,
        "vehicleTax": 0,
        "insuranceVehicle": 0,
        "insuranceAllRisk": 0,
        "totalCost": 0
      }
    }
  }
]

GET /api/Calculations This endpoint retrieves all calculations.

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Restrictions Description
anonymous CalculationDto none none
» id integer(int32) none none
» organisationId string(uuid)¦null none none
» name string¦null none none
» timeBasedCost number(double) none none
» distanceBasedCost number(double) none none
» revenue number(double) none none
» revenuePeriod RevenuePeriodEnum(int32) none none
» totalCost number(double) none none
» profit number(double) none none
» profitMargin number(double) none none
» units UnitDto¦null none none
»» unit string¦null none none
»» unitsPerYear number(double) none none
»» totalCostPerUnit number(double) none none
»» combinationCost CombinationCostDto none none
»»» perYear number(double) none none
»»» perUnit number(double) none none
»»» percentage number(double) none none
» investmentDetails InvestmentDetailsDto none none
»» category InvestmentCategory(int32) none none
»» vehicleClass VehicleClassEnum(int32) none none
»» name string¦null none none
»» fuelCost number(double) none none
»» maintenanceCost number(double) none none
»» tyresCost number(double) none none
»» fuelConsumption number(double) none none
»» countOfTyres integer(int32) none none
»» distancePerYear number(double) none none
»» interestRate number(double) none none
»» investmentDeductions number(double) none none
»» vehicleTax number(double) none none
»» residualValue number(double) none none
»» insuranceAllRisk number(double) none none
»» insuranceVehicle number(double) none none
» profitCalculation ProfitCalculationDto none none
»» variableCosts VariableCostsDto none none
»»» fuelCost number(double) none none
»»» maintenanceCost number(double) none none
»»» tyresCost number(double) none none
»»» wage number(double) none none
»»» dailyAllowance number(double) none none
»»» exportCost number(double) none none
»»» totalCost number(double) none none
»»» grossProfit number(double) none none
»» fixedCosts FixedCostsDto none none
»»» capital number(double) none none
»»» vehicleTax number(double) none none
»»» insuranceVehicle number(double) none none
»»» insuranceAllRisk number(double) none none
»»» totalCost number(double) none none

Tasks

Get Tasks

Code samples

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Tasks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Tasks', headers = headers)

print(r.json())

GET /api/Tasks

Get tasks in batches by organisation. Additional parameters apply filters to tasks returned

Parameters

Name In Type Required Description
userid query string false Returns by user id. Nullifies other filters
offset query integer(int32) false Amount of tasks cursor skips
size query integer(int32) false Amount of tasks returned
startTime query string false ISO 8601 formated start time for task filter
endTime query string false ISO 8601 formated end time for task filter. Will not function wihtout start time
status query string false done/upcoming filters tasks based on if they are scheduled for future
vehicle query string false Search term for vehicle registry number
customer query string false Search term for customer id

Example responses

200 Response

{"data":[{"id":0,"uId":"string","orgId":"string","registerNumber":"string","customerId":"string","startTime":"string","endTime":"string","totalTime":0,"startKm":0,"endKm":0,"totalDistance":0,"price":0,"estimatedCost":0,"costDist":0,"costHour":0,"totalCosts":0,"profit":0,"profitPercent":0,"calculationId":0,"calculationName":"string","timeStamp":"string","created":"2019-08-24T14:15:22Z","modified":"2019-08-24T14:15:22Z","retrieved":"2019-08-24T14:15:22Z","isExternal":true}],"offset":0,"size":0,"max":0}
{
  "data": [
    {
      "id": 0,
      "uId": "string",
      "orgId": "string",
      "registerNumber": "string",
      "customerId": "string",
      "startTime": "string",
      "endTime": "string",
      "totalTime": 0,
      "startKm": 0,
      "endKm": 0,
      "totalDistance": 0,
      "price": 0,
      "estimatedCost": 0,
      "costDist": 0,
      "costHour": 0,
      "totalCosts": 0,
      "profit": 0,
      "profitPercent": 0,
      "calculationId": 0,
      "calculationName": "string",
      "timeStamp": "string",
      "created": "2019-08-24T14:15:22Z",
      "modified": "2019-08-24T14:15:22Z",
      "retrieved": "2019-08-24T14:15:22Z",
      "isExternal": true
    }
  ],
  "offset": 0,
  "size": 0,
  "max": 0
}

Responses

Status Meaning Description Schema
200 OK Success PaginationDto<[TaskItemDto]>

Get Task by Id

Code samples

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Tasks/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Tasks/{id}', headers = headers)

print(r.json())

GET /api/Tasks/{id} This endpoint retrieves task based on id

Parameters

Name In Type Required Description
id path integer(int32) true none

Example responses

200 Response

[
  {
    "id": 0,
    "uId": "string",
    "orgId": "string",
    "registerNumber": "string",
    "customerId": "string",
    "startTime": "string",
    "endTime": "string",
    "totalTime": 0,
    "startKm": 0,
    "endKm": 0,
    "totalDistance": 0,
    "price": 0,
    "estimatedCost": 0,
    "costDist": 0,
    "costHour": 0,
    "totalCosts": 0,
    "profit": 0,
    "profitPercent": 0,
    "calculationId": 0,
    "calculationName": "string",
    "timeStamp": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Restrictions Description
anonymous TaskItemDto none none
» id integer(int32)¦null none none
» uId string(uuid)¦null none none
» orgId string(uuid)¦null none none
» registerNumber string¦null none none
» customerId string¦null none none
» startTime string¦null none none
» endTime string¦null none none
» totalTime number(double) none none
» startKm number(double) none none
» endKm number(double) none none
» totalDistance number(double) none none
» price number(double) none none
» estimatedCost number(double) none none
» costDist number(double) none none
» costHour number(double) none none
» totalCosts number(double) none none
» profit number(double) none none
» profitPercent number(double) none none
» calculationId integer(int32) none none
» calculationName string¦null none none
» timeStamp string¦null none none

Post new task item

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain'
}

result = RestClient.post '/api/Tasks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain'
}

r = requests.post('/api/Tasks', headers = headers)

print(r.json())

Body parameter

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "registerNumber": "string",
  "customerId": "string",
  "startTime": "string",
  "endTime": "string",
  "totalTime": 0,
  "startKm": 0,
  "endKm": 0,
  "totalDistance": 0,
  "price": 0,
  "estimatedCost": 0,
  "costDist": 0,
  "costHour": 0,
  "totalCosts": 0,
  "profit": 0,
  "profitPercent": 0,
  "calculationId": 0,
  "calculationName": "string",
  "timeStamp": "string"
}

Example responses

200 Response

{
  TaskItem
}

POST /api/Tasks This endpoint creates a new task

Parameters

Name In Type Required Description
body body TaskItemDto true id not required on post

Responses

Status Meaning Description Schema
200 OK Success TaskItemDto

Update an existing task with PUT based on id

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json'
}

result = RestClient.put '/api/Tasks/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json'
}

r = requests.put('/api/Tasks/{id}', headers = headers)

print(r.json())

Body parameter

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "registerNumber": "string",
  "customerId": "string",
  "startTime": "string",
  "endTime": "string",
  "totalTime": 0,
  "startKm": 0,
  "endKm": 0,
  "totalDistance": 0,
  "price": 0,
  "estimatedCost": 0,
  "costDist": 0,
  "costHour": 0,
  "totalCosts": 0,
  "profit": 0,
  "profitPercent": 0,
  "calculationId": 0,
  "calculationName": "string",
  "timeStamp": "string"
}

PUT /api/Tasks/{id} This endpoint updates existing task

Parameters

Name In Type Required Description
id path integer(int32) true none
body body TaskItemDto true none

Responses

Status Meaning Description Schema
200 OK Success None

Delete Task based on id

Code samples

require 'rest-client'
require 'json'

result = RestClient.delete '/api/Tasks/{id}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.delete('/api/Tasks/{id}')

print(r.json())

DELETE /api/Tasks/{id}

Parameters

Name In Type Required Description
id path integer(int32) true none

Responses

Status Meaning Description Schema
200 OK Success None

Invoices

Get all invoices

Code samples

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Invoices',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Invoices', headers = headers)

print(r.json())

GET /api/Invoices This endpoint gets all invoices belonging to task

Parameters

Name In Type Required Description
taskid query integer(int32) false get all invoices of given task id

Example responses

200 Response

[
  {
    "id": 0,
    "uId": "string",
    "orgId": "string",
    "taskId": 0,
    "source": "string",
    "target": "string",
    "customerId": "string",
    "product": "string",
    "amount": 0,
    "unit": 0,
    "price": 0,
    "alv": 0,
    "sale": 0,
    "total": 0,
    "delivered": "string",
    "created": "string",
    "vehicle": {
      "id": 0,
      "name": "string",
      "registerNumber": "string"
    },
    "description": "string",
    "timeStamp": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Restrictions Description
anonymous InvoiceDto none none
» id integer(int32)¦null none none
» uId string(uuid)¦null none none
» orgId string(uuid)¦null none none
» taskId integer(int32) none none
» source string¦null none none
» target string¦null none none
» customerId string¦null none none
» product string¦null none none
» amount integer(int32) none none
» unit integer(int32) none none
» price number(double) none none
» alv number(double) none none
» sale number(double) none none
» total number(double) none none
» delivered string¦null none none
» created string¦null none none
» vehicle VehicleDto none none
»» id integer(int32)¦null none none
»» name string¦null none none
»» registerNumber string¦null none none
» description string¦null none none
» timeStamp string¦null none none

Get Invoice by Id

Code samples

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Invoices/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Invoices/{id}', headers = headers)

print(r.json())

GET /api/Invoices/{id} This endpoint gets invoice based on id

Parameters

Name In Type Required Description
id path integer(int32) true none

Example responses

200 Response

[
  {
    "id": 0,
    "uId": "string",
    "orgId": "string",
    "taskId": 0,
    "source": "string",
    "target": "string",
    "customerId": "string",
    "product": "string",
    "amount": 0,
    "unit": 0,
    "price": 0,
    "alv": 0,
    "sale": 0,
    "total": 0,
    "delivered": "string",
    "created": "string",
    "vehicle": {
      "id": 0,
      "name": "string",
      "registerNumber": "string"
    },
    "description": "string",
    "timeStamp": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Restrictions Description
anonymous InvoiceDto none none
» id integer(int32)¦null none none
» uId string(uuid)¦null none none
» orgId string(uuid)¦null none none
» taskId integer(int32) none none
» source string¦null none none
» target string¦null none none
» customerId string¦null none none
» product string¦null none none
» amount integer(int32) none none
» unit integer(int32) none none
» price number(double) none none
» alv number(double) none none
» sale number(double) none none
» total number(double) none none
» delivered string¦null none none
» created string¦null none none
» vehicle VehicleDto none none
»» id integer(int32)¦null none none
»» name string¦null none none
»» registerNumber string¦null none none
» description string¦null none none
» timeStamp string¦null none none

Post new Invoice item

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain'
}

result = RestClient.post '/api/Invoices',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain'
}

r = requests.post('/api/Invoices', headers = headers)

print(r.json())

POST /api/Invoices This endpoint creates new invoice

Body parameter

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "taskId": 0,
  "source": "string",
  "target": "string",
  "customerId": "string",
  "product": "string",
  "amount": 0,
  "unit": 0,
  "price": 0,
  "alv": 0,
  "sale": 0,
  "total": 0,
  "delivered": "string",
  "created": "string",
  "vehicle": {
    "id": 0,
    "name": "string",
    "registerNumber": "string"
  },
  "description": "string",
  "timeStamp": "string",
  "created": "2019-08-24T14:15:22Z",
  "modified": "2019-08-24T14:15:22Z",
  "retrieved": "2019-08-24T14:15:22Z",
  "isExternal": true,
  "orderNumber": "string",
  "orderPosition": "string",
  "shippingListNumber": "string",
  "cargoNumber": "string"
}

Parameters

Name In Type Required Description
body body InvoiceDto true Invoice model
» id body integer(int32)¦null false Identifier set by server
» uId body string¦null false User id set by server
» orgId body string¦null false Organisation id set by server
» taskId body integer(int32) false Id connecting invoice to task
» source body string¦null false none
» target body string¦null false none
» customerId body string¦null false Unique identifier for customer
» product body string¦null false Product name
» amount body integer(int32) false Amount of units
» unit body number(double) false Size of unit
» price body number(double) false Price of unit
» alv body number(double) false Vat percentage
» sale body number(double) false Sale percentage
» total body number(double) true Total cost of invoice
» delivered body string¦null false none
» date string¦null false false ISO 8601 formated date string
» vehicle body VehicleDto false Vehicle model in diffo system
»» id body integer(int32)¦null false Vehicle identifier
»» name body string¦null false Name of vehicle
»» registerNumber body string¦null true Vehicle registry number
» description body string¦null false none
» timeStamp body string¦null false Added by server
» created body string(date-time) false Added by server
» modified body string(date-time) false Added by server
» retrieved body string(date-time) false Added by server
» isExternal body boolean false Added by server
» orderNumber body string¦null false none
» orderPosition body string¦null false none
» shippingListNumber body string¦null false none
» cargoNumber body string¦null false none

Example responses

200 Response

{
  InvoiceDto
}

Responses

Status Meaning Description Schema
200 OK Success InvoiceDto

Post multiple new invoices

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain'
}

result = RestClient.post '/api/Invoices/batch',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain'
}

r = requests.post('/api/Invoices/batch', headers = headers)

print(r.json())

POST /api/Invoices/batch Post multiple invoices. Notice that the response header does not include created invoices if more than 200 invoices are created.

Body parameter

[
  {    
    "uId": "string",
    "orgId": "string",
    "taskId": 0,
    "source": "string",
    "target": "string",
    "customerId": "string",
    "product": "string",
    "amount": 0,
    "unit": 0,
    "price": 0,
    "alv": 0,
    "sale": 0,
    "total": 0,
    "delivered": "string",
    "date": "string",
    "vehicle": {
      "id": 0,
      "name": "string",
      "registerNumber": "string"
    },
    "description": "string",
    "timeStamp": "string",
    "created": "2019-08-24T14:15:22Z",
    "modified": "2019-08-24T14:15:22Z",
    "retrieved": "2019-08-24T14:15:22Z",
    "isExternal": true,
    "orderNumber": "string",
    "orderPosition": "string",
    "shippingListNumber": "string",
    "cargoNumber": "string"
  }
]

Parameters

Name In Type Required Description
body body InvoiceDto true id not required on post

Example responses

200 Response

[{"id":0,"uId":"string","orgId":"string","taskId":0,"source":"string","target":"string","customerId":"string","product":"string","amount":0,"unit":0,"price":0,"alv":0,"sale":0,"total":0,"delivered":"string","date":"string","vehicle":{"id":0,"name":"string","registerNumber":"string"},"description":"string","timeStamp":"string","created":"2019-08-24T14:15:22Z","modified":"2019-08-24T14:15:22Z","retrieved":"2019-08-24T14:15:22Z","isExternal":true,"orderNumber":"string","orderPosition":"string","shippingListNumber":"string","cargoNumber":"string"}]
[
  {
    "id": 0,
    "uId": "string",
    "orgId": "string",
    "taskId": 0,
    "source": "string",
    "target": "string",
    "customerId": "string",
    "product": "string",
    "amount": 0,
    "unit": 0,
    "price": 0,
    "alv": 0,
    "sale": 0,
    "total": 0,
    "delivered": "string",
    "date": "string",
    "vehicle": {
      "id": 0,
      "name": "string",
      "registerNumber": "string"
    },
    "description": "string",
    "timeStamp": "string",
    "created": "2019-08-24T14:15:22Z",
    "modified": "2019-08-24T14:15:22Z",
    "retrieved": "2019-08-24T14:15:22Z",
    "isExternal": true,
    "orderNumber": "string",
    "orderPosition": "string",
    "shippingListNumber": "string",
    "cargoNumber": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [InvoiceDto] false none none
» id integer(int32)¦null false none none
» uId string¦null false none none
» orgId string¦null false none none
» taskId integer(int32) false none none
» source string¦null false none none
» target string¦null false none none
» customerId string¦null false none none
» product string¦null false none none
» amount integer(int32) false none none
» unit number(double) false none none
» price number(double) false none none
» alv number(double) false none none
» sale number(double) false none none
» total number(double) false none none
» delivered string¦null false none ISO 8601 formated start time for task filter
» date string¦null false none none
» vehicle VehicleDto false none none
»» id integer(int32)¦null false none none
»» name string¦null false none none
»» registerNumber string¦null false none none
» description string¦null false none none
» timeStamp string¦null false none none
» created string(date-time) false none none
» modified string(date-time) false none none
» retrieved string(date-time) false none none
» isExternal boolean false none none
» orderNumber string¦null false none none
» orderPosition string¦null false none none
» shippingListNumber string¦null false none none
» cargoNumber string¦null false none none

Update an existing invoice with PUT based on id

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json'
}

result = RestClient.put '/api/Invoices/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json'
}

r = requests.put('/api/Invoices/{id}', headers = headers)

print(r.json())

PUT /api/Invoices/{id} This endpoint updates invoices

Body parameter

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "taskId": 0,
  "source": "string",
  "target": "string",
  "customerId": "string",
  "product": "string",
  "amount": 0,
  "unit": 0,
  "price": 0,
  "alv": 0,
  "sale": 0,
  "total": 0,
  "delivered": "string",
  "created": "string",
  "vehicle": {
    "id": 0,
    "name": "string",
    "registerNumber": "string"
  },
  "description": "string",
  "timeStamp": "string",
  "created": "2019-08-24T14:15:22Z",
  "modified": "2019-08-24T14:15:22Z",
  "retrieved": "2019-08-24T14:15:22Z",
  "isExternal": true,
  "orderNumber": "string",
  "orderPosition": "string",
  "shippingListNumber": "string",
  "cargoNumber": "string"
}

Parameters

Name In Type Required Description
id path integer(int32) true none
body body InvoiceDto true none
» id body integer(int32)¦null true Invoice identifier
» uId body string¦null false User id set by server
» orgId body string¦null false Organisation id set by server
» taskId body integer(int32) false Id connecting invoice to task
» source body string¦null false none
» target body string¦null false none
» customerId body string¦null false Unique identifier for customer
» product body string¦null false Product name
» amount body integer(int32) false Amount of units
» unit body number(double) false Size of unit
» price body number(double) false Price of unit
» alv body number(double) false Vat percentage
» sale body number(double) false Sale percentage
» total body number(double) true Total cost of invoice
» delivered body string¦null false none
» date string¦null false false ISO 8601 formated date string
» vehicle body VehicleDto false Vehicle model in diffo system
»» id body integer(int32)¦null false Vehicle identifier
»» name body string¦null false Name of vehicle
»» registerNumber body string¦null true Vehicle registry number
» description body string¦null false none
» timeStamp body string¦null false Added by server
» created body string(date-time) false Added by server
» modified body string(date-time) false Added by server
» retrieved body string(date-time) false Added by server
» isExternal body boolean false Added by server
» orderNumber body string¦null false none
» orderPosition body string¦null false none
» shippingListNumber body string¦null false none
» cargoNumber body string¦null false none

Responses

Status Meaning Description Schema
200 OK Success None

Delete Invoice based on id

Code samples

require 'rest-client'
require 'json'

result = RestClient.delete '/api/Invoices/{id}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.delete('/api/Invoices/{id}')

print(r.json())

DELETE /api/Invoices/{id}

Parameters

Name In Type Required Description
id path integer(int32) true none

Responses

Status Meaning Description Schema
200 OK Success None

Vehicles

Post new vehicle

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain'
}

result = RestClient.post '/api/Vehicle',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain'
}

r = requests.post('/api/Vehicle', headers = headers)

print(r.json())

POST /api/Vehicle

Body parameter

{
  "id": 0,
  "registerNumber": "string",
  "calculationId": 0,
  "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
  "vehicleClass": 0,
  "emissionRate": 0,
  "contract": true,
  "costPerDistance": 0,
  "costPerTime": 0,
  "defaultIncome": 0,
  "incomeType": 0,
  "isActive": true
}

Parameters

Name In Type Required Description
body body VehiclePostDto true none

Example responses

200 Response

{"id":0,"registerNumber":"string","calculationId":0,"organisationId":"c9b3f279-e3b5-4204-ad99-646257417f98","vehicleClass":0,"emissionRate":0,"contract":true,"costPerDistance":0,"costPerTime":0,"defaultIncome":0,"incomeType":0,"isActive":true}
{
  "id": 0,
  "registerNumber": "string",
  "calculationId": 0,
  "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
  "vehicleClass": 0,
  "emissionRate": 0,
  "contract": true,
  "costPerDistance": 0,
  "costPerTime": 0,
  "defaultIncome": 0,
  "incomeType": 0,
  "isActive": true
}

Responses

Status Meaning Description Schema
200 OK Success VehiclePostDto

Get all Vehicles of my organisation

Code samples

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Vehicle',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Vehicle', headers = headers)

print(r.json())

GET /api/Vehicle

Parameters

Name In Type Required Description
orgId query string false Admin only

Example responses

200 Response

[{"id":0,"registerNumber":"string","calculationId":0,"organisationId":"c9b3f279-e3b5-4204-ad99-646257417f98","vehicleClass":0,"emissionRate":0,"contract":true,"costPerDistance":0,"costPerTime":0,"defaultIncome":0,"incomeType":0,"isActive":true}]
[
  {
    "id": 0,
    "registerNumber": "string",
    "calculationId": 0,
    "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
    "vehicleClass": 0,
    "emissionRate": 0,
    "contract": true,
    "costPerDistance": 0,
    "costPerTime": 0,
    "defaultIncome": 0,
    "incomeType": 0,
    "isActive": true
  }
]

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Restrictions Description
anonymous [VehiclePostDto] none none
» id integer(int32) none none
» registerNumber string¦null none none
» calculationId integer(int32) none none
» organisationId string(uuid) none none
» vehicleClass VehicleClassEnum(int32) none none
» emissionRate number(double) none g/km
» contract boolean none none
» costPerDistance number(double) none Used for contracted vehicles
» costPerTime number(double) none Used for contracted vehicles
» defaultIncome number(double) none Income used in new tasks
» incomeType IncomeTypes(int32) none none
» isActive boolean none none

Enumerated Values

Property Value
vehicleClass 0
vehicleClass 1
vehicleClass 2
vehicleClass 3
vehicleClass 4
vehicleClass 5
vehicleClass 6
vehicleClass 7
vehicleClass 8
vehicleClass 9
incomeType 0
incomeType 1
incomeType 2
incomeType 3

Post multiple new Vehicles

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'text/plain'
}

result = RestClient.post '/api/Vehicle/batch',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'text/plain'
}

r = requests.post('/api/Vehicle/batch', headers = headers)

print(r.json())

POST /api/Vehicle/batch

Body parameter

[
  {
    "id": 0,
    "registerNumber": "string",
    "calculationId": 0,
    "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
    "vehicleClass": 0,
    "emissionRate": 0,
    "contract": true,
    "costPerDistance": 0,
    "costPerTime": 0,
    "defaultIncome": 0,
    "incomeType": 0,
    "isActive": true
  }
]

Parameters

Name In Type Required Description
body body VehiclePostDto true none

Example responses

200 Response

[{"id":0,"registerNumber":"string","calculationId":0,"organisationId":"c9b3f279-e3b5-4204-ad99-646257417f98","vehicleClass":0,"emissionRate":0,"contract":true,"costPerDistance":0,"costPerTime":0,"defaultIncome":0,"incomeType":0,"isActive":true}]
[
  {
    "id": 0,
    "registerNumber": "string",
    "calculationId": 0,
    "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
    "vehicleClass": 0,
    "emissionRate": 0,
    "contract": true,
    "costPerDistance": 0,
    "costPerTime": 0,
    "defaultIncome": 0,
    "incomeType": 0,
    "isActive": true
  }
]

Responses

Status Meaning Description Schema
200 OK Success Inline

Response Schema

Status Code 200

Name Type Restrictions Description
anonymous [VehiclePostDto] none none
» id integer(int32) none none
» registerNumber string¦null none none
» calculationId integer(int32) none none
» organisationId string(uuid) none none
» vehicleClass VehicleClassEnum(int32) none none
» emissionRate number(double) none none
» contract boolean none none
» costPerDistance number(double) none Used for contracted vehicles
» costPerTime number(double) none Used for contracted vehicles
» defaultIncome number(double) none Income used in new tasks
» incomeType IncomeTypes(int32) none none
» isActive boolean none none

Enumerated Values

Property Value
vehicleClass 0
vehicleClass 1
vehicleClass 2
vehicleClass 3
vehicleClass 4
vehicleClass 5
vehicleClass 6
vehicleClass 7
vehicleClass 8
vehicleClass 9
incomeType 0
incomeType 1
incomeType 2
incomeType 3

Get one Vehicle by its id

Code samples

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'text/plain'
}

result = RestClient.get '/api/Vehicle/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'text/plain'
}

r = requests.get('/api/Vehicle/{id}', headers = headers)

print(r.json())

GET /api/Vehicle/{id}

Parameters

Name In Type Required Description
id path integer(int32) true none

Example responses

200 Response

{"id":0,"registerNumber":"string","calculationId":0,"organisationId":"c9b3f279-e3b5-4204-ad99-646257417f98","vehicleClass":0,"emissionRate":0,"contract":true,"costPerDistance":0,"costPerTime":0,"defaultIncome":0,"incomeType":0,"isActive":true}
{
  "id": 0,
  "registerNumber": "string",
  "calculationId": 0,
  "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
  "vehicleClass": 0,
  "emissionRate": 0,
  "contract": true,
  "costPerDistance": 0,
  "costPerTime": 0,
  "defaultIncome": 0,
  "incomeType": 0,
  "isActive": true
}

Responses

Status Meaning Description Schema
200 OK Success VehiclePostDto

update Vehicle

Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json'
}

result = RestClient.put '/api/Vehicle/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json'
}

r = requests.put('/api/Vehicle/{id}', headers = headers)

print(r.json())

PUT /api/Vehicle/{id}

Body parameter

{
  "id": 0,
  "registerNumber": "string",
  "calculationId": 0,
  "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
  "vehicleClass": 0,
  "emissionRate": 0,
  "contract": true,
  "costPerDistance": 0,
  "costPerTime": 0,
  "defaultIncome": 0,
  "incomeType": 0,
  "isActive": true
}

Parameters

Name In Type Required Description
id path integer(int32) true none
body body VehiclePostDto true none

Responses

Status Meaning Description Schema
200 OK Success None

Delete Vehicle

Code samples

require 'rest-client'
require 'json'

result = RestClient.delete '/api/Vehicle/{id}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.delete('/api/Vehicle/{id}')

print(r.json())

DELETE /api/Vehicle/{id}

Parameters

Name In Type Required Description
id path integer(int32) true none

Responses

Status Meaning Description Schema
200 OK Success None

Schemas

AuthenticationDto

{
    "access_token": "eyJhbGciOiJ...",
    "expires_in": 3600,
    "token_type": "Bearer",
    "scope": "diffoprofitapi openid profile"
}

Properties

Name Type Required Restrictions Description
access_token string true none Token used to authenticate yourself to api server
expires integer(int32) true none
token_type string true none
scope string true none Scope available to access token

CalculationDto

{
  "id": 0,
  "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
  "name": "string",
  "timeBasedCost": 0,
  "distanceBasedCost": 0,
  "revenue": 0,
  "revenuePeriod": 0,
  "totalCost": 0,
  "profit": 0,
  "profitMargin": 0,
  "units": [
    {
      "unit": "string",
      "unitsPerYear": 0,
      "totalCostPerUnit": 0,
      "combinationCost": {
        "perYear": 0,
        "perUnit": 0,
        "percentage": 0
      }
    }
  ],
  "investmentDetails": {
    "category": 0,
    "vehicleClass": 0,
    "name": "string",
    "fuelCost": 0,
    "maintenanceCost": 0,
    "tyresCost": 0,
    "fuelConsumption": 0,
    "countOfTyres": 0,
    "distancePerYear": 0,
    "interestRate": 0,
    "investmentDeductions": 0,
    "vehicleTax": 0,
    "residualValue": 0,
    "insuranceAllRisk": 0,
    "insuranceVehicle": 0
  },
  "profitCalculation": {
    "variableCosts": {
      "fuelCost": 0,
      "maintenanceCost": 0,
      "tyresCost": 0,
      "wage": 0,
      "dailyAllowance": 0,
      "exportCost": 0,
      "totalCost": 0,
      "grossProfit": 0
    },
    "fixedCosts": {
      "capital": 0,
      "vehicleTax": 0,
      "insuranceVehicle": 0,
      "insuranceAllRisk": 0,
      "totalCost": 0
    }
  }
}

Properties

Name Type Required Restrictions Description
id integer(int32) true none none
organisationId string(uuid)¦null false none none
name string¦null false none none
timeBasedCost number(double) false none none
distanceBasedCost number(double) false none none
revenue number(double) false none none
revenuePeriod RevenuePeriodEnum false none none
totalCost number(double) false none none
profit number(double) false none none
profitMargin number(double) false none none
units UnitDto¦null false none none
investmentDetails InvestmentDetailsDto false none none
profitCalculation ProfitCalculationDto false none none

UnitDto

{
  "unit": "string",
  "unitsPerYear": 0,
  "totalCostPerUnit": 0,
  "combinationCost": {
    "perYear": 0,
    "perUnit": 0,
    "percentage": 0
  }
}

Properties

Name Type Required Restrictions Description
unit string¦null false none none
unitsPerYear number(double) false none none
totalCostPerUnit number(double) false none none
combinationCost CombinationCostDto false none none

VehiclePostDto

{
  "id": 0,
  "registerNumber": "string",
  "calculationId": 0,
  "organisationId": "c9b3f279-e3b5-4204-ad99-646257417f98",
  "vehicleClass": 0,
  "emissionRate": 0,
  "contract": true,
  "costPerDistance": 0,
  "costPerTime": 0,
  "defaultIncome": 0,
  "incomeType": 0,
  "isActive": true
}

Properties

Name Type Required Restrictions Description
id integer(int32) false none none
registerNumber string¦null true none none
calculationId integer(int32) false none none
organisationId string(uuid) false none none
vehicleClass VehicleClassEnum false none none
emissionRate number(double) false none g/km
contract boolean false none none
costPerDistance number(double) false none Used for contracted vehicles
costPerTime number(double) false none Used for contracted vehicles
defaultIncome number(double) false none Income used in new tasks
incomeType IncomeTypes false none none
isActive boolean false none none

InvoiceDto

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "taskId": 0,
  "source": "string",
  "target": "string",
  "customerId": "string",
  "product": "string",
  "amount": 0,
  "unit": 0,
  "price": 0,
  "alv": 0,
  "sale": 0,
  "total": 0,
  "delivered": "string",
  "date": "string",
  "vehicle": {
    "id": 0,
    "name": "string",
    "registerNumber": "string"
  },
  "description": "string",
  "timeStamp": "string",
  "created": "2019-08-24T14:15:22Z",
  "modified": "2019-08-24T14:15:22Z",
  "retrieved": "2019-08-24T14:15:22Z",
  "isExternal": true,
  "orderNumber": "string",
  "orderPosition": "string",
  "shippingListNumber": "string",
  "cargoNumber": "string"
}

Properties

Name Type Required Restrictions Description
id integer(int32)¦null false none none
uId string¦null false none none
orgId string¦null false none none
taskId integer(int32) false none none
source string¦null false none none
target string¦null false none none
customerId string¦null false none none
product string¦null false none none
amount integer(int32) false none none
unit number(double) false none none
price number(double) false none none
alv number(double) false none none
sale number(double) false none none
total number(double) false none none
delivered string¦null false none none
date string¦null false none none
vehicle VehicleDto false none none
description string¦null false none none
timeStamp string¦null false none none
created string(date-time) false none none
modified string(date-time) false none none
retrieved string(date-time) false none none
isExternal boolean false none none
orderNumber string¦null false none none
orderPosition string¦null false none none
shippingListNumber string¦null false none none
cargoNumber string¦null false none none

CombinationCostDto

{
  "perYear": 0,
  "perUnit": 0,
  "percentage": 0
}

Properties

Name Type Required Restrictions Description
perYear number(double) false none none
perUnit number(double) false none none
percentage number(double) false none none

InvestmentDetailsDto

{
  "category": 0,
  "vehicleClass": 0,
  "name": "string",
  "fuelCost": 0,
  "maintenanceCost": 0,
  "tyresCost": 0,
  "fuelConsumption": 0,
  "countOfTyres": 0,
  "distancePerYear": 0,
  "interestRate": 0,
  "investmentDeductions": 0,
  "vehicleTax": 0,
  "residualValue": 0,
  "insuranceAllRisk": 0,
  "insuranceVehicle": 0
}

Properties

Name Type Required Restrictions Description
category InvestmentCategory false none none
vehicleClass VehicleClassEnum false none none
name string¦null false none none
fuelCost number(double) false none none
maintenanceCost number(double) false none none
tyresCost number(double) false none none
fuelConsumption number(double) false none none
countOfTyres integer(int32) false none none
distancePerYear number(double) false none none
interestRate number(double) false none none
investmentDeductions number(double) false none none
vehicleTax number(double) false none none
residualValue number(double) false none none
insuranceAllRisk number(double) false none none
insuranceVehicle number(double) false none none

ProfitCalculationDto

{
  "variableCosts": {
    "fuelCost": 0,
    "maintenanceCost": 0,
    "tyresCost": 0,
    "wage": 0,
    "dailyAllowance": 0,
    "exportCost": 0,
    "totalCost": 0,
    "grossProfit": 0
  },
  "fixedCosts": {
    "capital": 0,
    "vehicleTax": 0,
    "insuranceVehicle": 0,
    "insuranceAllRisk": 0,
    "totalCost": 0
  }
}

Properties

Name Type Required Restrictions Description
variableCosts VariableCostsDto false none none
fixedCosts FixedCostsDto false none none

VariableCostsDto

{
  "fuelCost": 0,
  "maintenanceCost": 0,
  "tyresCost": 0,
  "wage": 0,
  "dailyAllowance": 0,
  "exportCost": 0,
  "totalCost": 0,
  "grossProfit": 0
}

Properties

Name Type Required Restrictions Description
fuelCost number(double) false none none
maintenanceCost number(double) false none none
tyresCost number(double) false none none
wage number(double) false none none
dailyAllowance number(double) false none none
exportCost number(double) false none none
totalCost number(double) false none none
grossProfit number(double) false none none

FixedCostsDto

{
  "capital": 0,
  "vehicleTax": 0,
  "insuranceVehicle": 0,
  "insuranceAllRisk": 0,
  "totalCost": 0
}

Properties

Name Type Required Restrictions Description
capital number(double) false none none
vehicleTax number(double) false none none
insuranceVehicle number(double) false none none
insuranceAllRisk number(double) false none none
totalCost number(double) false none none

TaskItemDto

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "registerNumber": "string",
  "customerId": "string",
  "startTime": "string",
  "endTime": "string",
  "totalTime": 0,
  "startKm": 0,
  "endKm": 0,
  "totalDistance": 0,
  "price": 0,
  "estimatedCost": 0,
  "costDist": 0,
  "costHour": 0,
  "totalCosts": 0,
  "profit": 0,
  "profitPercent": 0,
  "calculationId": 0,
  "calculationName": "string",
  "timeStamp": "string",
  "created": "2019-08-24T14:15:22Z",
  "modified": "2019-08-24T14:15:22Z",
  "retrieved": "2019-08-24T14:15:22Z",
  "isExternal": true
}

Properties

Name Type Required Restrictions Description
id integer(int32)¦null true none none
uId string¦null false none none
orgId string¦null false none none
registerNumber string¦null false none none
customerId string¦null false none none
startTime string¦null false none none
endTime string¦null false none none
totalTime number(double) false none none
startKm number(double) false none none
endKm number(double) false none none
totalDistance number(double) false none none
price number(double) false none none
estimatedCost number(double) false none none
costDist number(double) false none none
costHour number(double) false none none
totalCosts number(double) false none none
profit number(double) false none none
profitPercent number(double) false none none
calculationId integer(int32) false none none
calculationName string¦null false none none
timeStamp string¦null false none none
created string(date-time) false none none
modified string(date-time) false none none
retrieved string(date-time) false none none
isExternal boolean false none none

PaginationDto<[TaskItemDto]>

{
  "data": [
    {
      "id": 0,
      "uId": "string",
      "orgId": "string",
      "registerNumber": "string",
      "customerId": "string",
      "startTime": "string",
      "endTime": "string",
      "totalTime": 0,
      "startKm": 0,
      "endKm": 0,
      "totalDistance": 0,
      "price": 0,
      "estimatedCost": 0,
      "costDist": 0,
      "costHour": 0,
      "totalCosts": 0,
      "profit": 0,
      "profitPercent": 0,
      "calculationId": 0,
      "calculationName": "string",
      "timeStamp": "string",
      "created": "2019-08-24T14:15:22Z",
      "modified": "2019-08-24T14:15:22Z",
      "retrieved": "2019-08-24T14:15:22Z",
      "isExternal": true
    }
  ],
  "offset": 0,
  "size": 0,
  "max": 0
}

Properties

Name Type Required Restrictions Description
data [TaskItemDto]¦null true none none
offset integer(int32) true none Offset used in request
size integer(int32) true none Amount of items returned
max integer(int32) true none Amount of items in database corresponding to query

InvoiceDto

{
  "id": 0,
  "uId": "string",
  "orgId": "string",
  "taskId": 0,
  "source": "string",
  "target": "string",
  "customerId": "string",
  "product": "string",
  "amount": 0,
  "unit": 0,
  "price": 0,
  "alv": 0,
  "sale": 0,
  "total": 0,
  "delivered": "string",
  "created": "string",
  "vehicle": {
    "id": 0,
    "name": "string",
    "registerNumber": "string"
  },
  "description": "string",
  "timeStamp": "string"
}

Properties

Name Type Required Restrictions Description
id integer(int32)¦null true none none
uId string¦null false none none
orgId string¦null false none none
taskId integer(int32) false none none
source string¦null false none none
target string¦null false none none
customerId string¦null false none none
product string¦null false none none
amount integer(int32) false none none
unit integer(double) false none none
price number(double) false none none
alv number(double) false none none
sale number(double) false none none
total number(double) false none none
delivered string¦null false none ISO 8601 formated start time for task filter
created string¦null false none Set by server
vehicle VehicleDto false none none
description string¦null false none none
timeStamp string¦null false none Set by server

VehicleDto

{
  "id": 0,
  "name": "string",
  "registerNumber": "string"
}

Properties

Name Type Required Restrictions Description
id integer(int32)¦null true none none
name string¦null false none none
registerNumber string¦null false none none

RevenuePeriodEnum

Properties

Name Type Required Restrictions Description
anonymous integer(int32) false none none

Enumerated Values

Property Value Description
anonymous 0 Yearly
anonymous 1 Monthly

InvestmentCategory

Properties

Name Type Required Restrictions Description
anonymous integer(int32) false none none

Enumerated Values

Property Value Description
anonymous 0 Vehicle
anonymous 1 Machine

VehicleClassEnum

Properties

Name Type Required Restrictions Description
anonymous integer(int32) false none none

Enumerated Values

Property Value
anonymous 0 unknown
anonymous 1 Car
anonymous 2 Van
anonymous 3 Truck
anonymous 4 Tractor unit
anonymous 5 Semi trailer
anonymous 6 Full trailer
anonymous 7 HCT-combination
anonymous 8 Bus
anonymous 9 Machine

IncomeTypes

0

Properties

Name Type Required Restrictions Description
anonymous integer(int32) false none none

Enumerated Values

Property Value
anonymous 0 Not used
anonymous 1 Hour based
anonymous 2 Distance based
anonymous 3 Task based