API - Koszty

Punkt dostępowy

Punkt dostępowy znajduje się pod adresem: https://app.firmino.pl/app/services/rest/api/cost-documents/

Metody

  • add – dodawanie nowego dokumentu
  • get – pobieranie danych dokumentu (wymagany id)
  • find – pobieranie listy dokumentów
  • update – aktualizowanie danych dokumentu (wymagany id)
  • delete – usuwanie dokumentu (wymagany id)
  • init – inicjalizowanie pustego dokumentu (zwraca dostępny numer porządkowy i domyślne ustawienia)
  • payoff – spłacanie dokumentu (wymagany id)

Pola

ParametrOpisUwagiTyp danych
idIdentyfikatorbraklong
externalDocumentNazwa dokumentu zewnętrznegoWymagany przy dodawaniu dokumentustring
documentDateData wystawienia dokumentu (domyślnie aktualna data)brakstring(yyyy-mm-dd)
purchaseDateData sprzedaży (domyślnie aktualna data)brakstring(yyyy-mm-dd)
costOpis zdarzenia gospodarczegobrakstring
costGroupGrupa kosztowabrakstring
priceTypeDokument liczony od Netto lub Brutto (domyślnie "net")

Dostępne:
  • net - netto
  • gross - brutto

brakstring
documentStateStatus dokumentu

Dostępne:
  • unpaid- niezapłacony
  • partpaid - częściowo zapłacony
  • paid - zapłacony

Tylko do odczytustring
vatCountedManuallyInformacja czy stawki vat mają być przeliczone przez system(domyślne, false), czy wprowadzone przez użytkownika(true)brakboolean
quotaVatsStawki vat wraz z wartościami ceny netto, ceny vat oraz ceny bruttoTrzeba podać stawkę Vat oraz cenę netto lub bruttoobject

Pozostałe pola

Przykładowe zapytania

https://app.firmino.pl/app/services/rest/api/cost-documents/add

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/add -d '{"externalDocument": "Nazwa dokumentu", "customer":{"id":4636900}}'

Żądanie (JSON):

{
    "externalDocument": "Nazwa dokumentu",
    "customer" : {
        "id": 4636900
        }
}

Odpowiedź (JSON):

		{
			"success": true,
			"response": {
				"id": 10730,
				"externalDocument": "Nazwa dokumentu",
				"documentDate": "2022-08-25",
				"purchaseDate": "2022-08-25",
				"cost": null,
				"costGroup": null,
				"priceType": "net",
				"documentState": "paid",
				"customer": {
					"id": 4636900,
					"fullName": "KONTRAHENT TESTOWY",
					"shortName": "KONTRAHENT",
					"countryCode": "PL",
					"locality": "Zielona Góra",
					"tin": "1111111111",
					"regon": null,
					"street": "Testowa",
					"houseNo": "2",
					"flatNo": "1",
					"postCode": "65-140",
					"post": "Zielona Góra",
					"phone": null,
					"email": null,
					"bankAccount": null,
					"fax": null,
					"website": null,
					"note": null
				},
				"currency": {
					"code": "PLN",
					"rate": "1.000000",
					"date": null,
					"table": null
				},
				"payment": {
					"method": "transfer",
					"paymentDate": null,
					"termDate": "2022-09-08",
					"total": "0.00",
					"paid": "0.00",
					"ramain": "0.00"
				},
				"vatCountedManually": false,
				"quotaVats": []
			}
		}

https://app.firmino.pl/app/services/rest/api/cost-documents/add

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/add -d '{"externalDocument": "Nazwa dokumentu", "customer":{"id":4636900}, "quotaVats": [{"vatRate": "23", "valueNet": "100.00"}]}'

Żądanie (JSON):

		{
			"externalDocument": "Nazwa dokumentu",
			"customer" : {
				"id": 4636900
			},
			"quotaVats": [
				{
					"vatRate": "23",
					"valueNet": "100.00"
				}
		 ]
	}

Odpowiedź (JSON):

		{
			"success": true,
			"response": {
				"id": 10731,
				"externalDocument": "Nazwa dokumentu",
				"documentDate": "2022-08-25",
				"purchaseDate": "2022-08-25",
				"cost": null,
				"costGroup": null,
				"priceType": "net",
				"documentState": "unpaid",
				"customer": {
					"id": 4636900,
					"fullName": "KONTRAHENT TESTOWY",
					"shortName": "KONTRAHENT",
					"countryCode": "PL",
					"locality": "Zielona Góra",
					"tin": "1111111111",
					"regon": null,
					"street": "Testowa",
					"houseNo": "2",
					"flatNo": "1",
					"postCode": "65-140",
					"post": "Zielona Góra",
					"phone": null,
					"email": null,
					"bankAccount": null,
					"fax": null,
					"website": null,
					"note": null
				},
				"currency": {
					"code": "PLN",
					"rate": "1.000000",
					"date": null,
					"table": null
				},
				"payment": {
					"method": "transfer",
					"paymentDate": null,
					"termDate": "2022-09-08",
					"total": "123.00",
					"paid": "0.00",
					"ramain": "123.00"
				},
				"vatCountedManually": false,
				"quotaVats": [
					{
						"id": 10410,
						"vatRate": "23",
						"valueNet": "100.00",
						"valueVat": "23.00",
						"valueGross": "123.00"
					}
				]
			}
		}

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/add -d '{"customer":{"id":4636900}}'

Żądanie (JSON):

	{
		"customer" : {
			"id": 4195100
		}
	}

Odpowiedź (JSON):

	{
		"success": false,
		"response": "Brak wymaganych wartości"
	}

https://app.firmino.pl/app/services/rest/api/cost-documents/get/{id}

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/get/10731

Odpowiedź (JSON):

		{
			"success": true,
			"response": {
				"id": 10731,
				"externalDocument": "Nazwa dokumentu",
				"documentDate": "2022-08-25",
				"purchaseDate": "2022-08-25",
				"cost": null,
				"costGroup": null,
				"priceType": "net",
				"documentState": "unpaid",
				"customer": {
					"id": 4636900,
					"fullName": "KONTRAHENT TESTOWY",
					"shortName": "KONTRAHENT",
					"countryCode": "PL",
					"locality": "Zielona Góra",
					"tin": "1111111111",
					"regon": null,
					"street": "Testowa",
					"houseNo": "2",
					"flatNo": "1",
					"postCode": "65-140",
					"post": "Zielona Góra",
					"phone": null,
					"email": null,
					"bankAccount": null,
					"fax": null,
					"website": null,
					"note": null
				},
				"currency": {
					"code": "PLN",
					"rate": "1.000000",
					"date": null,
					"table": null
				},
				"payment": {
					"method": "transfer",
					"paymentDate": null,
					"termDate": "2022-09-08",
					"total": "123.00",
					"paid": "0.00",
					"ramain": "123.00"
				},
				"vatCountedManually": false,
				"quotaVats": [
					{
						"id": 10410,
						"vatRate": "23",
						"valueNet": "100.00",
						"valueVat": "23.00",
						"valueGross": "123.00"
					}
				]
			}
		}

https://app.firmino.pl/app/services/rest/api/cost-documents/find

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/find -d '{}'

Żądanie (JSON):

		{}

Odpowiedź (JSON):

		{
			"success": true,
			"response": {
				"params": {
					"total": 4,
					"page": 1,
					"size": 15,
					"sortField": null,
					"sortOrder": null,
					"text": null,
					"filters": null
				},
				"list": [
					{
						"id": 3352,
						"ordinalNumber": 4,
						"externalName": "Nazwa dokumentu1",
						"documentDate": "2022-07-29",
						"eventDescription": "Pozostałe wydatki",
						"idCustomer": 4195100,
						"customerName": "KONTRAHENT TESTOWY",
						"documentState": 3,
						"currencyCode": "PLN",
						"paymentTotal": "0.00",
						"paymentPaid": "0.00",
						"paymentRemain": "0.00"
					},
					{
						"id": 3341,
						"ordinalNumber": 3,
						"externalName": "Nazwa dokumentu2",
						"documentDate": "2022-07-25",
						"eventDescription": "Pozostałe wydatki",
						"idCustomer": 4195100,
						"customerName": "KONTRAHENT TESTOWY",
						"documentState": 1,
						"currencyCode": "PLN",
						"paymentTotal": "123.00",
						"paymentPaid": "0.00",
						"paymentRemain": "123.00"
					},
					{
						"id": 3330,
						"ordinalNumber": 2,
						"externalName": "Nazwa dokumentu3",
						"documentDate": "2019-06-13",
						"eventDescription": "Pozostałe wydatki",
						"idCustomer": 4195100,
						"customerName": "KONTRAHENT TESTOWY",
						"documentState": 3,
						"currencyCode": "PLN",
						"paymentTotal": "0.00",
						"paymentPaid": "0.00",
						"paymentRemain": "0.00"
					},
					{
						"id": 3310,
						"ordinalNumber": 1,
						"externalName": "Nazwa dokumentu4",
						"documentDate": "2021-07-21",
						"eventDescription": "Pozostałe wydatki",
						"idCustomer": 4195100,
						"customerName": "KONTRAHENT TESTOWY",
						"documentState": 1,
						"currencyCode": "PLN",
						"paymentTotal": "985.00",
						"paymentPaid": "0.00",
						"paymentRemain": "985.00"
					}
				]
			}
		}

https://app.firmino.pl/app/services/rest/api/cost-documents/find

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/find -d '{"page":1,"size":10,"text":"","filters":[{"name":"year","value":2022}]}'

Żądanie (JSON):

		{
			"page" : 1,
			"size" : 10,
			"text" : "",
			"filters":
				[ 
					{
						"name": "year",
						"value": 2022
					}
				]
		}

Odpowiedź (JSON):

		{
			"success": true,
			"response": {
				"params": {
					"total": 2,
					"page": 1,
					"size": 15,
					"sortField": null,
					"sortOrder": null,
					"text": null,
					"filters": [
						{
							"name": "year",
							"value": "2022"
						}
					]
				},
				"list": [
					{
						"id": 3352,
						"ordinalNumber": 4,
						"externalName": "Nazwa dokumentu1",
						"documentDate": "2022-07-29",
						"eventDescription": "Pozostałe wydatki",
						"idCustomer": 4195100,
						"customerName": "KONTRAHENT TESTOWY",
						"documentState": 3,
						"currencyCode": "PLN",
						"paymentTotal": "0.00",
						"paymentPaid": "0.00",
						"paymentRemain": "0.00"
					},
					{
						"id": 3341,
						"ordinalNumber": 3,
						"externalName": "Nazwa dokumentu2",
						"documentDate": "2022-07-25",
						"eventDescription": "Pozostałe wydatki",
						"idCustomer": 4195100,
						"customerName": "KONTRAHENT TESTOWY",
						"documentState": 1,
						"currencyCode": "PLN",
						"paymentTotal": "123.00",
						"paymentPaid": "0.00",
						"paymentRemain": "123.00"
					}
					]
			}
		}

https://app.firmino.pl/app/services/rest/api/cost-documents/update

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/update -d '{"id":3341, "externalDocument": "Zmiana nazwy", "documentDate":"2022-02-15","saleDate":"2022-02-15","salePlace":"Warszawa","priceType":"gross","customer":{"fullName":"KONTRAHENT NOWY","shortName":"EDYTOWANY","countryCode":"PL","locality":"Poznań","postCode":"60-001","note":"edytowany"},"currency":{"code":"EUR"},"payment":{"method":"cash","termDate":"2022-02-22"}, "quotaVats":[{"vatRate": "8", "valueNet": "100.00"}]}'

Żądanie (JSON):

		{
			"id" : 3382,
            "externalDocument": "Zmieniona nazwa",
			"documentDate": "2022-02-15",
			"purchaseDate": "2022-02-15",
			"priceType": "gross",
			"customer": {
				"fullName": "KONTRAHENT NOWY",
				"shortName": "EDYTOWANY",
				"countryCode": "PL",
				"locality": "Poznań",
				"postCode": "60-001",
				"note": "edytowany"
			},
			"currency": {
				"code": "EUR"
			},
			"quotaVats": [
				{
					"vatRate": "8",
					"valueNet": "100.00"
				}
			]
		}

Odpowiedź (JSON)

	{
		"success": true,
		"response": {
			"id": 3382,
			"externalDocument": "Zmieniona nazwa",
			"documentDate": "2022-02-15",
			"cost": "Pozostałe wydatki",
			"costGroup": null,
			"purchaseDate": "2022-02-15",
			"priceType": "gross",
			"documentState": "unpaid",
			"customer": {
				"id": 4635700,
				"fullName": "KONTRAHENT NOWY",
				"shortName": "EDYTOWANY",
				"countryCode": "PL",
				"locality": "Poznań",
				"tin": null,
				"regon": null,
				"street": null,
				"houseNo": null,
				"flatNo": null,
				"postCode": "60-001",
				"post": "Poznań",
				"phone": null,
				"email": null,
				"bankAccount": null,
				"fax": null,
				"website": null,
				"note": "edytowany"
			},
			"currency": {
				"code": "EUR",
				"rate": "4.509100",
				"date": null,
				"table": null
			},
			"payment": {
				"method": "transfer",
				"paymentDate": null,
				"termDate": "2022-08-22",
				"total": "123.00",
				"paid": "0.00",
				"ramain": "123.00"
			},
			"quotaVats": [
				{
					"vatRate": "8",
					"valueNet": "100.00",
					"valueVat": "8.00",
					"valueGross": "108.00"
				}
			]
		}
	}

https://app.firmino.pl/app/services/rest/api/income-documents/delete/{id}

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/delete/3382

Odpowiedź (JSON):

	{
		"success": true,
		"response": "Usunięto dokument"
	}

https://app.firmino.pl/app/services/rest/api/cost-documents/init

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/init -d '{"documentDate":"2022-08-08"}'

Żądanie (JSON):

		{
			"documentDate" : "2022-08-08"
		}

Odpowiedź (JSON)

		{
			"success": true,
			"response": {
				"id": null,
				"externalDocument": null,
				"documentDate": "2022-08-08",
				"cost": "Pozostałe wydatki",
				"costGroup": null,
				"purchaseDate": "2022-08-08",
				"priceType": "net",
				"documentState": "unpaid",
				"customer": {
					"id": null,
					"fullName": null,
					"shortName": null,
					"countryCode": "PL",
					"locality": null,
					"tin": null,
					"regon": null,
					"street": null,
					"houseNo": null,
					"flatNo": null,
					"postCode": null,
					"post": null,
					"phone": null,
					"email": null,
					"bankAccount": null,
					"fax": null,
					"website": null,
					"note": null
				},
				"currency": {
					"code": "PLN",
					"rate": "1.000000",
					"date": null,
					"table": null
				},
				"payment": {
					"method": "transfer",
					"paymentDate": null,
					"termDate": "2022-08-22",
					"total": "0",
					"paid": "0.00",
					"ramain": "0.00"
				},
				"vatCountedManually": false,
				"quotaVats": []
			}
		}

https://app.firmino.pl/app/services/rest/api/cost-documents/payoff/{id}

Przykład CURL:

curl -POST --user login:haslo -H "Content-type: application/json" https://app.firmino.pl/app/services/rest/api/cost-documents/payoff/3371

Odpowiedź (JSON)

		{
			"success": true,
			"response": "Dokument został spłacony"
		}