Costs

To create a cost on a case it can be done through API call or through the core webpage. The API endpoints are the same in both cases. There are 3 major types of costs: “regular” cost, project cost and standard costs. The webpage support all of these 3 types, however the API (and its permission was done with only “regular” and project costs in mind).

If user is an API user it needs one of following permissions:

  1. “Case costs API” for “regular” case costs
  2. “Project Case costs API” for project costs

For API usage please use the API endpoint accordingly to their case (regular case, project step, project unit):

Regular case

Get case costs:

GET flow/api/Conditions/Cases/{caseId}/Costs/{type}

Create case costs:

POST flow/api/Conditions/Properties/{caseId}/Costs/{type}

Update existing cost:

PATCH flow/api/Conditions/Properties/{caseId}/Costs/{costId}/{type}

Delete cost:

DELETE flow/api/Conditions/Properties/{caseId}/Costs/{costId}

Parameters

  • caseId: The id of the case to which you want to add the invoice
  • costId: Id of the cost that you want to update or delete
  • type: “Seller” or “Buyer”

Project step

Get case costs. Only “Buyer” type is supported here. This will fetch “regular” costs from the case. For project costs the project get costs endpoint must be used.

GET flow/api/Conditions/Cases/{caseId}/Costs/Buyer

Get project costs. This will project costs. These can also be though of as seller costs of the project.

GET flow/api/Conditions/Projects/{caseId}/Costs

Create case costs. If “Buyer” cost type is used then a regular cost is created. But it “Seller” cost type is used than a project cost is created:

POST flow/api/Conditions/Properties/{caseId}/Costs/{type}

Update existing cost:

PATCH flow/api/Conditions/Properties/{caseId}/Costs/{costId}/{type}

Delete cost. If “Buyer” cost type is used, the API will search for regular cost and delete it. But if “Seller” cost type is used the API will search for project cost and delete it. So special care needs to be used when using this API endpoint because regular and project cost are in different tables, so they can share the same id. So if special attention is not made to the cost type, wrong cost can be easily deleted:

DELETE flow/api/Conditions/Projects/{caseId}/Costs/{costId}/Type/{type}

Parameters

  • caseId: The id of the case to which you want to add the invoice
  • costId: Id of the cost that you want to update or delete
  • type: “Seller” or “Buyer”

Project unit

Get case costs:

GET flow/api/Conditions/Cases/{caseId}/Costs/{type}

Create case costs:

POST flow/api/Conditions/Properties/{caseId}/Costs/{type}

Update existing cost:

PATCH flow/api/Conditions/Properties/{caseId}/Costs/{type}

Delete cost:

DELETE flow//api/Conditions/Properties/{caseId}/Costs/{costId}

Parameters

  • caseId: The id of the case to which you want to add the invoice
  • costId: Id of the cost that you want to update or delete
  • type: “Seller” or “Buyer”