Create a new Credit Note
1 min
code examples curl request post \\ \ url https //developer digitail io/api/v1/credit notes \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "clinic id" 1, "customer id" 1, "amount" 100, "reason" "reason for creditnote", "date" "2021 01 30t08 30 00z" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "clinic id" 1, "customer id" 1, "amount" 100, "reason" "reason for creditnote", "date" "2021 01 30t08 30 00z" }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //developer digitail io/api/v1/credit notes", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //developer digitail io/api/v1/credit notes") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "clinic id" 1, "customer id" 1, "amount" 100, "reason" "reason for creditnote", "date" "2021 01 30t08 30 00z" }) response = https request(request) puts response read body import requests import json url = "https //developer digitail io/api/v1/credit notes" payload = json dumps({ "clinic id" 1, "customer id" 1, "amount" 100, "reason" "reason for creditnote", "date" "2021 01 30t08 30 00z" }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // successful operation { "data" { "id" 1, "clinic id" 1, "vet id" 1, "sale id" 1, "customer id" 1, "status" "opened", "type" "product return", "series" "dgt", "number" "1", "tax amount" "250 00", "subtotal" "250 00", "total" "250 00", "description" "short description", "made at" "2021 01 30t08 30 00z", "voided at" "2021 01 30t08 30 00z", "created at" "2022 07 18t08 58 36 000000z", "updated at" "2022 07 18t08 58 36 000000z" } }