json/v2.0/invoice.json in sk_api_schema-0.10.6 vs json/v2.0/invoice.json in sk_api_schema-0.11.0
- old
+ new
@@ -1,18 +1,26 @@
-{ "type":"object",
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type":"object",
"title": "invoice",
- "name": "invoice",
"description": "An invoice",
"properties":{
"id":{
"description":"Unique identifier - UUID",
"identity":true,
- "readonly":true,
+ "readOnly":true,
"type":"string",
"maxLength": 22,
"minLength": 22
},
+ "company_id":{
+ "description":"Company",
+ "readOnly":true,
+ "type":"string",
+ "maxLength": 22,
+ "minLength":22
+ },
"number":{
"description": "Unique number assigned by SK invoice number schema. Auto-assigned when invoice is opened. Required unless doc status is draft.",
"type":"string",
"maxLength": 50
},
@@ -56,16 +64,16 @@
"maxLength": 255
},
"notes_before":{
"description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.",
"type":"string",
- "format":"text"
+ "format":"string"
},
"notes_after":{
"description": "Notes shown after the line items. Can contain information about payments, bank account or a thank-you message. SK placeholders can be used.",
"type":"string",
- "format":"text"
+ "format":"string"
},
"tag_list":{
"description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
"type":"string"
},
@@ -80,23 +88,23 @@
"maxLength": 3,
"minLength": 3
},
"exchange_rate":{
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). If the rate is empty we use the exchange rate on the document date or today if doc.date is empty. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday). If you open the doc at a later time make sure to manually refresh the rate, as we dont change it. ",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"gross_total_exchanged":{
"description": "Exchanged gross total, in your company currency.",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"archived_pdf":{
"description": "Archived PDF version of the document. Is created when an document is printed and archived. A document can have multiple archived versions. This only returns the most recent one. ",
- "readonly":true,
+ "readOnly":true,
"type":"object",
- "properties":{"$ref":"./attachment.json#properties"}
+ "$ref":"./attachment.json#"
},
"sepa_mandate_id":{
"description": "SEPA mandate identifier needed in direct debit transactions. This is a unique id given by you to the customer beforehand.",
"type":"string",
"maxLength": 35
@@ -109,122 +117,115 @@
"sepa_debit_sequence_type":{
"description": "SEPA direct debit sequence type. Check with you bank how they handle FRST(first) and FNAL(final) types. When exporting SEPA debit to your bank the type defaults to OOF if blank.",
"type":"string",
"enum":["FRST","OOFF","RCUR","FNAL"]
},
- "client":{
- "description": "DEPRECATED: use contact",
- "readonly":true,
- "type":"object",
- "properties":{"$ref":"./client.json#properties"}
- },
- "client_id":{
- "description": "DEPRECATED: use contact_id",
- "type":"string",
- "maxLength": 22,
- "minLength":22
- },
"contact":{
"description": "The contact for the document. Use contact_id field to set a contact.",
- "readonly":true,
+ "readOnly":true,
"type":"object",
- "properties":{"$ref":"./contact.json#properties"}
+ "$ref":"./contact.json#"
},
"contact_id":{
"description": "The contact uuid. When assigning a contact its language, currency, address_field (due days, cash discount) values are used for the document if those doc-fields are not set.",
"type":"string",
"maxLength": 22,
"minLength":22
},
"team_id":{
"description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
- "readonly" :true,
+ "readOnly" :true,
"type":"string",
"maxLength": 22,
"minLength":22
},
- "line_items":{
- "description": "DEPRECATED use items",
- "type":"array",
- "properties":{"$ref":"./line_item.json#properties"}
- },
"items":{
- "description": "Items for the document. Access items of all types including divider and sub_total items. GOTCHAs when using items instead of line_items: You MUST set the type field(CamelCasesItem class name) on each item. You cannot use both, the line_items array is stronger for backward compat.",
+ "description": "Items for the document, including divider and sub_total items. You MUST set the type field(CamelCasedItem class name) on each item on creation.",
"type":"array",
- "default": "any",
"minItems": 0,
- "items": [{ "$ref": "./line_item.json#properties"},
- { "$ref": "./divider_item.json#properties"},
- { "$ref": "./sub_total_item.json#properties"}]
+ "items": {
+ "type" : "object",
+ "anyOf" : [
+ {
+ "title": "line_item",
+ "$ref": "./line_item.json#"
+ },
+ {
+ "title": "divider_item",
+ "$ref": "./divider_item.json#"
+ },
+ {
+ "title": "sub_total_item",
+ "$ref": "./sub_total_item.json#"
+ }
+ ]
+ }
},
"created_at":{
"description": "Date the object was created in SK. Never changes afterwards.",
"format":"date-time",
- "readonly":true,
+ "readOnly":true,
"type":"string"
},
"updated_at":{
"description": "Date the object was edited in SK.",
"format":"date-time",
- "readonly":true,
+ "readOnly":true,
"type":"string"
},
"lock_version":{
"description": "Auto-incremented to prevent concurrent updates. First save wins and increments version. ",
+ "readOnly":true,
"type":"integer"
},
- "price_total":{
- "description": "DEPRECATED use net_total_base",
- "readonly":true,
- "type":"number"
- },
- "price_tax":{
- "description": "DEPRECATED: use tax_total",
- "readonly":true,
- "type":"number"
- },
"gross_total":{
"description": "Gross total of all line items, 2 decimals places in document currency.",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"tax_total":{
"description": "Tax total, 2 decimals places",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"net_total":{
"description": "Net total, 2 decimals places",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"net_total_base":{
"description": "Net total, 6 decimal places incl. discount",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"cost_total":{
"description": "Cost total of all line items, 2 decimals places in document currency.",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"gross_margin_total":{
"description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"gross_margin_pct":{
"description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
- "readonly":true,
+ "readOnly":true,
"type":"number"
},
"recurring_id":{
"description":"Recurring document ID, if the invoice was created from a recurring.",
- "readonly":true,
+ "readOnly":true,
"type":"string",
"maxLength": 22,
"minLength": 22
+ },
+ "tax_exemption_id":{
+ "description": "ID of a tax exemption. When set all item taxes are omitted.",
+ "type":"string",
+ "maxLength": 22,
+ "minLength":22
}
},
"links":[
{ "rel": "self",
"href": "invoices/{id}"
@@ -277,15 +278,10 @@
"filter[languages]":{
"title" : "Languages",
"description": "A list of language codes, comma separated",
"type" : "string"
},
- "filter[client_ids]":{
- "title" : "Clients",
- "description": "DEPRECATED use contact_ids",
- "type" : "string"
- },
"filter[contact_ids]":{
"title" : "Contacts",
"description": "Find objects belonging to a single or a list of contacts, use ids comma separated.",
"type" : "string"
},
@@ -347,56 +343,30 @@
"type":"boolean"
}
}
},
{ "rel": "attachments",
- "href": "invoices/{id}/attachments"
+ "href": "attachments?filter[related_object_ids]={id}"
},
{ "rel": "payments",
- "href": "invoices/{id}/payments"
+ "href": "payments?filter[related_object_ids]={id}"
},
- { "rel": "payment_reminders",
- "href": "invoices/{id}/payment_reminders"
- },
{ "rel": "comments",
- "href": "invoices/{id}/comments"
+ "href": "comments?filter[related_object_ids]={id}"
},
{ "rel": "emails",
- "href": "invoices/{id}/emails"
+ "href": "emails?filter[related_object_ids]={id}"
},
- { "rel": "emails create",
- "href": "invoices/{id}/emails",
- "method": "POST",
- "properties" : {
- "template_id":{
- "title" : "Template",
- "description": "UUID of an email template to use. If present template fields like subject, body, attachments are used for the current email.",
- "type":"string",
- "maxLength": 22,
- "minLength":22
- },
- "send":{
- "title" : "Send email",
- "description": "Schedule email for sending. Omit this parameter or set value to 0 or false(String or Integer) to keep email as draft."
- },
- "archived_pdf":{
- "title" : "Attach archived pdf",
- "description": "Adds the archived pdf from the related resource(if it has one)."
- }
- }
+ { "rel": "payment_reminders",
+ "href": "invoices/{id}/payment_reminders"
},
- { "rel": "payment create",
- "href": "invoices/{id}/payments",
- "method": "POST"
- },
{ "rel": "print",
"href": "invoices/{id}/print",
"method": "POST",
"properties" : {
"template_id" : {
"title" : "PDF template used for printing",
- "description": "UUID of a pdf template used to print the document. MUST be present",
- "required":true
+ "description": "UUID of a pdf template used to print the document. MUST be present"
},
"base64" : {
"title" : "Return the created pdf base64 encoded",
"description": "If set(any val) the new pdf is returned inside the attachment JSON within 'base64' key. Ommit to save traffic."
}