sk_api_schema 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,8 +1,26 @@
1
- # Changelog for SalesKing API Schema
1
+ # SalesKing API Changelog
2
2
 
3
- A more detailed view of the changes can be found in the {commit messages}[https://github.com/salesking/sk_api_schema/commits/]
3
+ See [commit messages](https://github.com/salesking/sk_api_schema/commits/) for details.
4
+ Also signup to our [Developer Newsletter](http://www.salesking.eu/dev/newsletter/) to stay up-to-date !!!
4
5
 
5
- 2013-01
6
+ ##2013-01
7
+
8
+ Contacts/Client changes
9
+ * New contact resource sporting client, lead, supplier contact types
10
+ * mark contact as employee, getting number, organisation, vat/tax number from his parent
11
+ * nested contacts
12
+ * add contact, contact_id to all documents
13
+ * add parent_id to contact, for contact nesting
14
+ * remove client_id from param sort_by for doc list views (it makes no sense to sort by a UUID)
15
+ * export_template, email_template.kind uses contact instead of client
16
+
17
+ DEPRECATED removed ~ 08.2013 prior notice via [Developer Newsletter](http://www.salesking.eu/dev/newsletter/)
18
+ * client resource
19
+ * document.client, document.client_id => doc.contact, doc.contact_id
20
+ * documents?filter\[client_ids] => filter\[contact_ids]
21
+ * oAuth scope for api/clients
22
+
23
+ Others
6
24
  * add external_ref for line item
7
25
  * email "send" parameter can be set to false or 0 to prevent sending
8
26
  * email "from_addr" is not required
@@ -11,21 +29,21 @@ A more detailed view of the changes can be found in the {commit messages}[https:
11
29
  * add filter\[tags] to products, mark price as required
12
30
  * add name-key to all objects containing the lowercased_underscored-name, PLEASE start using it instead of the title-field, which will be changed to its CamelCasedObjectName
13
31
 
14
- 2012-12
32
+ ##2012-12
15
33
  * add search filter to pdf_template, email_template
16
34
  * filter clients by ids - search for a list of comma separated uuids
17
35
 
18
- 2012-11
36
+ ##2012-11
19
37
  * add currency fields for documents, client, company and payment
20
38
  * add PDF template resource
21
39
  * drop 'method' from payment in favour of payment_method
22
40
 
23
- 2012-07
41
+ ##2012-07
24
42
  * maxLength for all string properties with limits
25
43
  * add "format":"text" to plain-text fields
26
44
  * search products by number
27
45
 
28
- 2012-06
46
+ ##2012-06
29
47
  * line item discount can be negative
30
48
  * tax and discount values with up to four decimal places
31
49
  * add payments link to invoice, credit_note
@@ -33,35 +51,35 @@ A more detailed view of the changes can be found in the {commit messages}[https:
33
51
  * Deprecate payment.method in favour of payment.payment_method bcs 'method' is a keyword in programming
34
52
  * test with travis-ci.org
35
53
 
36
- 2012-05
54
+ ##2012-05
37
55
  * fix date type definitions
38
56
  * add empty links sections for address, line_item
39
57
  * add payment_method to order
40
58
  * deprecate gross_total for payment reminder
41
59
 
42
- 2012-01
60
+ ##2012-01
43
61
  * add notes field for client
44
62
 
45
- 2012-05
63
+ ##2012-05
46
64
 
47
65
  * add missing payment method to order
48
66
  * fix date & date-time type definitions
49
67
  * add empty links section to address, line item
50
68
 
51
- 2011-10
69
+ ##2011-10
52
70
  * added created_at search filter to clients and documents
53
71
  * added creator(user) search filter to clients and documents
54
72
 
55
- 2011-9
73
+ ##2011-9
56
74
  * search documents by number
57
75
  * maxLength information for client and address properties
58
76
  * allow tags edit, destroy
59
77
 
60
- 2011-7
78
+ ##2011-7
61
79
  * allow new documents with status closed
62
80
  * auto-set number+date for new open/closed documents
63
81
 
64
- 2011-6
82
+ ##2011-6
65
83
  * added language field to document, client, email-template
66
84
  * added filter\[languages] for documents and clients, to search by one or more languages
67
85
  * added filter\[client_ids] to documents, to search by one or multiple clients
@@ -69,10 +87,10 @@ A more detailed view of the changes can be found in the {commit messages}[https:
69
87
  * changed _delete property to _destroy for address, line_item
70
88
  * removed client_id requirement for documents
71
89
 
72
- 2011-05
90
+ ##2011-05
73
91
  * new hash_clean method for ruby schema reader class
74
92
 
75
- 2011-04
93
+ ##2011-04
76
94
  * added tags
77
95
  * added documents
78
96
  * reduced default objects in list to 10, max is 100
@@ -80,11 +98,11 @@ A more detailed view of the changes can be found in the {commit messages}[https:
80
98
  * added created_at & number filtering to client
81
99
  * added _delete field to line_item & address, to be able to destroy them since both are transfered within their parent object
82
100
 
83
- 2011-03
101
+ ##2011-03
84
102
  * added subscriptions
85
103
  * added memoizing to ruby schema reader
86
104
 
87
- 2011-02
105
+ ##2011-02
88
106
  * added moneybookers, premium_sms to payment methods
89
107
  * added auth_permission
90
108
  * added external_ref to documents
@@ -92,5 +110,5 @@ A more detailed view of the changes can be found in the {commit messages}[https:
92
110
  * added recurring
93
111
  * added source param to copy documents
94
112
 
95
- 2010-11 - 2011-01
113
+ ##2010-11 - 2011-01
96
114
  * initial version
data/README.rdoc CHANGED
@@ -6,7 +6,7 @@ Our API (objects,resources) is described with JSON Schema (http://json-schema.or
6
6
  Each Object has its own description, with those top-level keys:
7
7
 
8
8
  {
9
- "name": "client", // object type
9
+ "type": "contact", // object type
10
10
  "properties": { .. }, // field descriptions
11
11
  "links": [ .. ] // CRUD actions, relationships to other resources
12
12
  }
@@ -21,9 +21,11 @@ Other languages should take advantage of the raw json files.
21
21
 
22
22
  == Tutorial & Docs
23
23
 
24
- * {API Browser visualized JSON Schema}[http://sk-api-browser.heroku.com/]
25
- * {API Intro}[http://dev.blog.salesking.eu/api/]
24
+ * {API Browser}[http://sk-api-browser.heroku.com/]
25
+ * {API Intro}[http://www.salesking.eu/dev/api/]
26
26
  * {Ruby SDK - API Client}[https://github.com/salesking/sk_sdk]
27
+ * {PHP SDK - API Client}[https://github.com/salesking/salesking_php_sdk]
28
+ * {Python SDK - API Client}[https://github.com/salesking/salesking_python_sdk]
27
29
 
28
30
  == Object Basic's
29
31
 
@@ -32,13 +34,13 @@ Primary object types in SK are:
32
34
  * Contacts
33
35
  * Products
34
36
 
35
- Secondary objects are always tied to a primary(related) object
37
+ Secondary objects, tied to a primary(related) object
36
38
  * Attachments
37
39
  * Comments
38
40
  * Messages
39
41
  * Tags
40
42
 
41
- The third kind are supportive objects
43
+ Supportive objects
42
44
  * Company
43
45
  * Users
44
46
  * Exports
@@ -53,8 +55,8 @@ of each schema.
53
55
  # GET invoices tagged with hosting and important
54
56
  /invoices?filter[tags]=important,hosting
55
57
 
56
- # GET orders for given client ids
57
- /orders?filter[client_ids]=:client_id,:client_id
58
+ # GET orders for given contact ids
59
+ /orders?filter[contact_ids]=:contact_id,:contact_id
58
60
 
59
61
  # GET products second page with 100 in list, only id+name
60
62
  /products?per_page=100&page=2&fields=id,name
@@ -62,11 +64,11 @@ of each schema.
62
64
  # all comments for an invoice
63
65
  /invoices/:id/comments
64
66
 
65
- # all documents of a client
66
- /clients/:id/documents
67
+ # all documents of a contact
68
+ /contacts/:id/documents
67
69
 
68
- # all invoices of a client
69
- /clients/:id/invoices
70
+ # all invoices of a contact
71
+ /contacts/:id/contact
70
72
 
71
73
  == Field types & formats
72
74
 
@@ -114,11 +116,11 @@ changes(breaking backwards compatibility), the version number will remain.
114
116
 
115
117
  You can see the current schema at:
116
118
  my.salesking.eu/api/schema
117
- my.salesking.eu/api/clients/schema
119
+ my.salesking.eu/api/contacts/schema
118
120
 
119
121
  The schema main version(NOT the gem version) can be set with the "v" url parameter
120
122
  in any call, but is pretty useless as long as we are in v1.0
121
- my.salesking.eu/api/clients?v='1.0'
123
+ my.salesking.eu/api/contacts?v='1.0'
122
124
 
123
125
  The gem has its own version number. A new gem version indicates a change, but
124
126
  we first try it on our staging environment before any live instances are
@@ -133,9 +135,9 @@ To see the current gem version use:
133
135
  By default the API returns an object with all available properties(fields). You
134
136
  can limit those by passing comma-separated string(or array) in the fields
135
137
  parameter:
136
- my.salesking.eu/api/clients?fields=id,organisation
138
+ my.salesking.eu/api/contacts?fields=id,organisation
137
139
 
138
- my.salesking.eu/api/clients?fields[]=id&fields[]=organisation
140
+ my.salesking.eu/api/contacts?fields[]=id&fields[]=organisation
139
141
 
140
142
  Please try to only request the fields you really need, to save computing power!
141
143
 
@@ -30,7 +30,7 @@
30
30
  "format": "uri"
31
31
  },
32
32
  "related_object_type":{
33
- "description": "Object type of the attachment parent. Is the camelcased base class name: Document for invoice, credit_note,.., Contact for client",
33
+ "description": "Object type of the attachment parent. Is the camelcased base class name: Document for invoice, credit_note, contact, ..",
34
34
  "required":true,
35
35
  "type":"string"
36
36
  },
@@ -112,7 +112,8 @@
112
112
  "sort":{
113
113
  "title" : "Sort",
114
114
  "enum":["ASC","DESC"],
115
- "description": "Sort the results in ASC or DESC"
115
+ "description": "Sort the results in ASC or DESC",
116
+ "type": "string"
116
117
  }
117
118
  }
118
119
  },
@@ -63,7 +63,8 @@
63
63
  "sort":{
64
64
  "title" : "Sort",
65
65
  "enum":["ASC","DESC"],
66
- "description": "Sort the results in ASC or DESC"
66
+ "description": "Sort the results in ASC or DESC",
67
+ "type": "string"
67
68
  }
68
69
  }
69
70
  },
@@ -1,7 +1,7 @@
1
1
  {"type":"object",
2
2
  "title": "client",
3
3
  "name": "client",
4
- "description": "A client as seen by SalesKing",
4
+ "description": "A client as seen by SalesKing. This resource is DEPRECATED please use contacts instead with type-field set 'Client'",
5
5
  "properties":{
6
6
  "id":{
7
7
  "description":"Unique identifier - UUID",
@@ -17,7 +17,7 @@
17
17
  "type":"string"
18
18
  },
19
19
  "related_object_type":{
20
- "description": "Object type of the comments parent. Is the camelcased base class name: Document for invoice, credit_note,.., Contact for client",
20
+ "description": "Object type of the comments parent. Is the camelcased base class name: Document for invoice, credit_note, contact",
21
21
  "required":true,
22
22
  "type":"string"
23
23
  },
@@ -90,7 +90,8 @@
90
90
  "sort":{
91
91
  "title" : "Sort",
92
92
  "enum":["ASC","DESC"],
93
- "description": "Sort the results in ASC or DESC"
93
+ "description": "Sort the results in ASC or DESC",
94
+ "type": "string"
94
95
  }
95
96
  }
96
97
  },
@@ -0,0 +1,357 @@
1
+ {"type":"object",
2
+ "title": "contact",
3
+ "name": "contact",
4
+ "description": "A contact can be a lead, client or supplier, depending on its type field. Use the filter[type] parameter to show only contacts of a kind. Use this resource instead of clients, as they are deprecated and dropped in the future.",
5
+ "properties":{
6
+ "id":{
7
+ "description":"Unique identifier - UUID",
8
+ "identity":true,
9
+ "readonly":true,
10
+ "type":"string",
11
+ "maxLength": 22,
12
+ "minLength":22
13
+ },
14
+ "parent_id":{
15
+ "description": "ID of a parent contact.",
16
+ "type":"string",
17
+ "maxLength": 22,
18
+ "minLength":22
19
+ },
20
+ "type":{
21
+ "description": "Type of contact",
22
+ "enum":["Client", "Lead", "Supplier"],
23
+ "required" : true,
24
+ "type":"string",
25
+ "maxLength": 50
26
+ },
27
+ "is_employee":{
28
+ "description": "An employee gets number, organisation, tax and vat_number from its parent. If you set any of these, they are overwritten. When changing a parent-contact the fields on his direct child-employees are updated too.",
29
+ "type": "boolean",
30
+ "default": false
31
+ },
32
+ "number":{
33
+ "description": "Unique number, auto-created by SK for new contacts(client, supplier) without number.",
34
+ "type":"string",
35
+ "maxLength": 50
36
+ },
37
+ "organisation":{
38
+ "description": "Name of a company. This or lastname must be present",
39
+ "required" : true,
40
+ "type":"string",
41
+ "maxLength": 100
42
+ },
43
+ "last_name":{
44
+ "description": "Last name of a person. At least this or the organisation field must be filled for new records",
45
+ "type":"string",
46
+ "maxLength": 50
47
+ },
48
+ "first_name":{
49
+ "description": "First name of a person.",
50
+ "type":"string",
51
+ "maxLength": 50
52
+ },
53
+ "gender":{
54
+ "description": "Can be empty for a company. Is used in salutation",
55
+ "enum":["male", "female"],
56
+ "type":"string"
57
+ },
58
+ "notes":{
59
+ "description": "Notes for a contact. For day to day information you should use comments instead.",
60
+ "type":"string",
61
+ "format": "text"
62
+ },
63
+ "position":{
64
+ "description": "Position of a person in a company.",
65
+ "type":"string",
66
+ "maxLength": 50
67
+ },
68
+ "title":{
69
+ "description": "Academical title of a person e.g. Dr., Prof",
70
+ "type":"string",
71
+ "maxLength": 50
72
+ },
73
+ "tax_number":{
74
+ "description": "Tax number, normally applies to a private person",
75
+ "type":"string",
76
+ "maxLength": 30
77
+ },
78
+ "vat_number":{
79
+ "description": "VAT number, for a company or person paying value added taxes.",
80
+ "type":"string",
81
+ "maxLength": 30
82
+ },
83
+ "email":{
84
+ "description": "Email address of the contact.",
85
+ "type":"string",
86
+ "maxLength": 100
87
+ },
88
+ "url":{
89
+ "description": "An url associated with the person, e.g its company website.",
90
+ "type":"string",
91
+ "maxLength": 255
92
+ },
93
+ "birthday":{
94
+ "format":"date",
95
+ "type":"string"
96
+ },
97
+ "tag_list":{
98
+ "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
99
+ "type":"string"
100
+ },
101
+ "created_at":{
102
+ "description": "Date the record was created in SK. Never changes afterwards.",
103
+ "format":"date-time",
104
+ "readonly":true,
105
+ "type":"string"
106
+ },
107
+ "updated_at":{
108
+ "description": "Last date when the record was edited.",
109
+ "format":"date-time",
110
+ "readonly":true,
111
+ "type":"string"
112
+ },
113
+ "language":{
114
+ "description": "Should be a valid language short-code: de-DE, fr, en-GB; like defined in your account language menu. When the client is emailed, a localized version of a multi-language template(email, pdf) will be used if available. The language will also be set for new documents.",
115
+ "type":"string",
116
+ "maxLength": 10
117
+ },
118
+ "currency":{
119
+ "description": "Currency code as defined by the ISO 4217 standard(3-letter UPCASE: EUR, USD). If set the currency is taken for new documents.",
120
+ "type":"string",
121
+ "maxLength": 3,
122
+ "minLength": 3
123
+ },
124
+ "payment_method":{
125
+ "description": "Default payment method for used for new documemts",
126
+ "enum":["cash","bank_transfer","credit_card","paypal","direct_debit","cheque", "moneybookers", "premium_sms"],
127
+ "type":"string"
128
+ },
129
+ "bank_name":{
130
+ "description": "Bank name",
131
+ "type":"string",
132
+ "maxLength": 70
133
+ },
134
+ "bank_number":{
135
+ "description": "Bank number",
136
+ "type":"string",
137
+ "maxLength": 35
138
+ },
139
+ "bank_account_number":{
140
+ "description": "Bank account number.",
141
+ "type":"string",
142
+ "maxLength": 35
143
+ },
144
+ "bank_iban":{
145
+ "description": "IBAN Number of the bank account. Is validated",
146
+ "type":"string",
147
+ "maxLength": 35
148
+ },
149
+ "bank_swift":{
150
+ "description": "SWIFT BIC- Bank Identifier Code",
151
+ "type":"string",
152
+ "maxLength": 11
153
+ },
154
+ "bank_owner":{
155
+ "description": "Bank account owner",
156
+ "type":"string",
157
+ "maxLength": 70
158
+ },
159
+ "phone_fax":{
160
+ "description": "Fax number",
161
+ "type":"string",
162
+ "maxLength": 30
163
+ },
164
+ "phone_office":{
165
+ "description": "Office phone number",
166
+ "type":"string",
167
+ "maxLength": 30
168
+ },
169
+ "phone_home":{
170
+ "description": "Private phone number",
171
+ "type":"string",
172
+ "maxLength": 30
173
+ },
174
+ "phone_mobile":{
175
+ "description": "Mobile phone number",
176
+ "type":"string",
177
+ "maxLength": 30
178
+ },
179
+ "lock_version":{
180
+ "description": "Increased on every edit, so SK can detect/prevent a concurrent edit by another user. First save wins.",
181
+ "type":"integer"
182
+ },
183
+ "cash_discount":{
184
+ "description": "Default cash discount for new invoices.",
185
+ "type":"number"
186
+ },
187
+ "due_days":{
188
+ "description": "Default due days for new invoices.",
189
+ "type":"integer"
190
+ },
191
+ "address_field":{
192
+ "description": "Returns the address field used on new docs. Consist of Organisation name and default(first) address",
193
+ "readonly":true,
194
+ "type":"string"
195
+ },
196
+ "addresses":{
197
+ "description": "A client can have many addresses, sorted by date descending(new first). Default address is the most recent one.",
198
+ "type":"array",
199
+ "properties" : {"$ref":"./address.json#properties"}
200
+ },
201
+ "team_id":{
202
+ "description": "A team uuid. If set only the team and its parent teams can see the record.",
203
+ "type":"string",
204
+ "maxLength": 22,
205
+ "minLength":22
206
+ },
207
+ "lead_source":{
208
+ "description": "Lead source describing where a contact came from e.g. a campaign name, website, facebook, URL",
209
+ "type":"string",
210
+ "maxLength": 255
211
+ },
212
+ "lead_ref":{
213
+ "description": "Lead reference e.g. a tracking id, web-url",
214
+ "type":"string",
215
+ "maxLength": 255
216
+ },
217
+ "converted_at":{
218
+ "description": "Date the contact converted from lead to client or any other contact type (supplier)",
219
+ "format":"date-time",
220
+ "type":"string"
221
+ }
222
+ },
223
+ "links":[
224
+ { "rel": "self",
225
+ "href": "contacts/{id}"
226
+ },
227
+ { "rel": "instances",
228
+ "href": "contacts",
229
+ "properties" : {
230
+ "page":{
231
+ "title" : "Page",
232
+ "description": "In paginated results set the page to look for",
233
+ "type":"number"
234
+ },
235
+ "per_page":{
236
+ "title" : "Per page",
237
+ "description": "Results per page. Default is 10, max is 100",
238
+ "type":"number"
239
+ },
240
+ "filter[q]":{
241
+ "title" : "Search",
242
+ "description": "Wildcard search in first, last_name, organisation, email, number",
243
+ "type":"string"
244
+ },
245
+ "filter[tags]":{
246
+ "title" : "Tags",
247
+ "description": "Filter by a space delimited list of tags",
248
+ "type":"string"
249
+ },
250
+ "filter[ids]":{
251
+ "title" : "Contacts",
252
+ "description": "A single or a list of contacts uuids, comma separated",
253
+ "type" : "string"
254
+ },
255
+ "filter[created_at_from]":{
256
+ "title" : "From date",
257
+ "description": "Objects with a creation date after the date, including given datetime. ISO 8601 format YYY-MM-DDThh:mm:ss+z",
258
+ "format" : "date-time",
259
+ "type" : "string"
260
+ },
261
+ "filter[created_at_to]":{
262
+ "title" : "To date",
263
+ "description": "Objects with a creation date before the date, including given datetime. ISO 8601 format YYY-MM-DDThh:mm:ss+z",
264
+ "format" : "date-time",
265
+ "type" : "string"
266
+ },
267
+ "filter[birthday_from]":{
268
+ "title" : "From birthday date",
269
+ "description": "Contacts with a birthday after and on the date. Leave the birthday-to date blank to only search on this day.",
270
+ "format" : "date",
271
+ "type" : "string"
272
+ },
273
+ "filter[birthday_to]":{
274
+ "title" : "To birthday date",
275
+ "description": "Contacts with a birthday date before and on the date.",
276
+ "format" : "date",
277
+ "type" : "string"
278
+ },
279
+ "filter[creator_ids]":{
280
+ "title" : "Creator",
281
+ "description": "Objects created by the given users uuids, comma separated",
282
+ "type" : "string"
283
+ },
284
+ "filter[number]":{
285
+ "title" : "By number",
286
+ "description": "Search by number where the number is matched from the start: number%",
287
+ "type" : "string"
288
+ },
289
+ "filter[languages]":{
290
+ "title" : "Languages",
291
+ "description": "A single or a list of language codes, comma separated",
292
+ "type" : "string"
293
+ },
294
+ "filter[type]":{
295
+ "title" : "Type",
296
+ "description": "Type of the contact: ",
297
+ "enum":["Client", "Lead", "Supplier"],
298
+ "type" : "string"
299
+ },
300
+ "sort_by":{
301
+ "title" : "Sort by",
302
+ "description": "Sort the results by the given field => number",
303
+ "enum":["organisation", "number","email","first_name","last_name", "created_at", "updated_at"],
304
+ "type": "string"
305
+ },
306
+ "sort":{
307
+ "title" : "Sort",
308
+ "enum":["ASC","DESC"],
309
+ "description": "Sort the results in ASC or DESC",
310
+ "type": "string"
311
+ }
312
+ }
313
+ },
314
+ { "rel": "destroy",
315
+ "href": "contacts/{id}",
316
+ "method": "DELETE"
317
+ },
318
+ { "rel": "update",
319
+ "href": "contacts/{id}",
320
+ "method": "PUT"
321
+ },
322
+ { "rel": "create",
323
+ "href": "contacts",
324
+ "method": "POST"
325
+ },
326
+ { "rel": "documents",
327
+ "href": "contacts/{id}/documents"
328
+ },
329
+ { "rel": "attachments",
330
+ "href": "contacts/{id}/attachments"
331
+ },
332
+ { "rel": "invoices",
333
+ "href": "contacts/{id}/invoices"
334
+ },
335
+ { "rel": "estimates",
336
+ "href": "contacts/{id}/estimates"
337
+ },
338
+ { "rel": "orders",
339
+ "href": "contacts/{id}/orders"
340
+ },
341
+ { "rel": "credit_notes",
342
+ "href": "contacts/{id}/credit_notes"
343
+ },
344
+ { "rel": "recurrings",
345
+ "href": "contacts/{id}/recurrings"
346
+ },
347
+ { "rel": "payment_reminders",
348
+ "href": "contacts/{id}/payment_reminders"
349
+ },
350
+ { "rel": "comments",
351
+ "href": "contacts/{id}/comments"
352
+ },
353
+ { "rel": "emails",
354
+ "href": "contacts/{id}/emails"
355
+ }
356
+ ]
357
+ }