diff --git a/data/actions.json b/data/actions.json index 93b0171..e3ee223 100644 --- a/data/actions.json +++ b/data/actions.json @@ -931,6 +931,13 @@ "help_text": "When an Administrator updates the Terms and Conditions.", "subject_types": [] }, + { + "key": "CONFIRMED_AGENCY_EMAIL", + "value": "CONFIRMED_AGENCY_EMAIL", + "msg": "Confirmed Company Email", + "help_text": "When a Company confirms their email address.", + "subject_types": [] + }, { "key": "CREATED_AGENCY", "value": "CREATED_AGENCY", diff --git a/pages/adhoccharges/ad-hoc-charge-object.json b/pages/adhoccharges/ad-hoc-charge-object.json index f2d39ef..845abd1 100644 --- a/pages/adhoccharges/ad-hoc-charge-object.json +++ b/pages/adhoccharges/ad-hoc-charge-object.json @@ -4,7 +4,6 @@ "appointment": null, "category": { "branch_tax_setup": "Default Company Tax (20%)", - "charge_via_branch": true, "contractor_tax_setup": "Default Company Tax (20%)", "contractor_usable": true, "default_charge_amount": "10.00", diff --git a/pages/adhoccharges/ad-hoc-charge-object.yml b/pages/adhoccharges/ad-hoc-charge-object.yml index 77dbe3f..ad6876c 100644 --- a/pages/adhoccharges/ad-hoc-charge-object.yml +++ b/pages/adhoccharges/ad-hoc-charge-object.yml @@ -87,10 +87,6 @@ attributes: name: branch_tax_setup type: string description: Tax setup for the Branch when invoicing. - - - name: charge_via_branch - type: boolean - description: Force Invoices associated with this Tutor to be charged via branch. - name: contractor_tax_setup type: string diff --git a/pages/adhoccharges/create-an-ad-hoc-charge.json b/pages/adhoccharges/create-an-ad-hoc-charge.json index 1b5e43b..858fc44 100644 --- a/pages/adhoccharges/create-an-ad-hoc-charge.json +++ b/pages/adhoccharges/create-an-ad-hoc-charge.json @@ -4,7 +4,6 @@ "appointment": null, "category": { "branch_tax_setup": "Default Company Tax (20%)", - "charge_via_branch": true, "contractor_tax_setup": "Default Company Tax (20%)", "contractor_usable": true, "default_charge_amount": "10.00", diff --git a/pages/adhoccharges/get-an-ad-hoc-charge.json b/pages/adhoccharges/get-an-ad-hoc-charge.json index f2d39ef..845abd1 100644 --- a/pages/adhoccharges/get-an-ad-hoc-charge.json +++ b/pages/adhoccharges/get-an-ad-hoc-charge.json @@ -4,7 +4,6 @@ "appointment": null, "category": { "branch_tax_setup": "Default Company Tax (20%)", - "charge_via_branch": true, "contractor_tax_setup": "Default Company Tax (20%)", "contractor_usable": true, "default_charge_amount": "10.00", diff --git a/pages/adhoccharges/update-an-ad-hoc-charge.json b/pages/adhoccharges/update-an-ad-hoc-charge.json index 1b5e43b..858fc44 100644 --- a/pages/adhoccharges/update-an-ad-hoc-charge.json +++ b/pages/adhoccharges/update-an-ad-hoc-charge.json @@ -4,7 +4,6 @@ "appointment": null, "category": { "branch_tax_setup": "Default Company Tax (20%)", - "charge_via_branch": true, "contractor_tax_setup": "Default Company Tax (20%)", "contractor_usable": true, "default_charge_amount": "10.00", diff --git a/pages/agents/agent-object.json b/pages/agents/agent-object-v1.json similarity index 100% rename from pages/agents/agent-object.json rename to pages/agents/agent-object-v1.json diff --git a/pages/agents/agent-object-v1.md b/pages/agents/agent-object-v1.md new file mode 100644 index 0000000..b86ae60 --- /dev/null +++ b/pages/agents/agent-object-v1.md @@ -0,0 +1,4 @@ +### Agent Object (Version 1 - Will be deprecated 3rd July 2025) + +Agent objects, Affiliates in TutorCruncher, includes basic user information including fields that are only linked to the Agent Role. +It includes details about affiliated Clients, `clients`, and their `commission_rate`. diff --git a/pages/agents/agent-object.yml b/pages/agents/agent-object-v1.yml similarity index 95% rename from pages/agents/agent-object.yml rename to pages/agents/agent-object-v1.yml index 8f6fd41..c48d2b8 100644 --- a/pages/agents/agent-object.yml +++ b/pages/agents/agent-object-v1.yml @@ -130,23 +130,23 @@ attributes: filters: - - name: created__gte + name: user__created__gte type: string description: Filter by the date and time the Agent was created. - - name: created__lte + name: user__created__lte type: string description: Filter by the date and time the Agent was created. - - name: first_name + name: user__first_name type: string description: Filter by the Agent's first name. - - name: last_name + name: user__last_name type: string description: Filter by the Agent's last name. - - name: email + name: user__email type: string description: Filter by the Agent's email address. - @@ -164,4 +164,4 @@ filters: - name: labels type: integer - description: Filter by the Agent's labels. + description: Filter by the Agent's labels (id). diff --git a/pages/agents/agent-object-v2.json b/pages/agents/agent-object-v2.json new file mode 100644 index 0000000..0f9bbca --- /dev/null +++ b/pages/agents/agent-object-v2.json @@ -0,0 +1,24 @@ +{ + "id": 65, + "title": null, + "first_name": "Billy", + "last_name": "Holiday", + "email": "billy_holiday@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London" + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [] +} diff --git a/pages/agents/agent-object.md b/pages/agents/agent-object-v2.md similarity index 88% rename from pages/agents/agent-object.md rename to pages/agents/agent-object-v2.md index e11a823..31b019b 100644 --- a/pages/agents/agent-object.md +++ b/pages/agents/agent-object-v2.md @@ -1,4 +1,4 @@ -### Agent Object +### Agent Object (Version 2) Agent objects, Affiliates in TutorCruncher, includes basic user information including fields that are only linked to the Agent Role. It includes details about affiliated Clients, `clients`, and their `commission_rate`. diff --git a/pages/agents/agent-object-v2.yml b/pages/agents/agent-object-v2.yml new file mode 100644 index 0000000..5641254 --- /dev/null +++ b/pages/agents/agent-object-v2.yml @@ -0,0 +1,162 @@ +attributes: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: The user's first name. + - + name: last_name + type: string + description: The user's last name. + - + name: email + type: string + description: The user's email address. + - + name: mobile + type: string + description: The user's mobile number. + - + name: phone + type: string + description: The user's phone number. + - + name: street + type: string + description: The user's street address. + - + name: state + type: string + description: This field is only needed for US users. This value will use the state's 2-letter code. + - + name: town + type: string + description: The user's town on address. + - + name: country + type: integer + description: | + User's country, value is an `id` of the country stored in TutorCruncher. These country ids can be found + by doing an options request at this endpoints base URL. + - + name: postcode + type: string + description: The user's postcode on address. + - + name: latitude + type: decimal + description: The user's addresses latitude. + - + name: longitude + type: decimal + description: The user's addresses longitude. + - + name: date_created + type: string + description: The date and time the user was created. + - + name: timezone + type: string + description: The user's timezone, accepted values are timezone database values. + - + name: commission_rate + type: string + description: Percentage of the Agent's commission rate. + - + name: clients + type: array + description: An array of Clients which the Agent is related to. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: User's first name. + - + name: last_name + type: string + description: User's last name. + - + name: email + type: string + description: User's email address. + - + name: url + type: string + description: URL to the Agent's object. + - + name: last_updated + type: string + description: The date and time the Agent was last updated. + - + name: calendar_colour + type: string + description: Use hex values, like `#fff000`, or use CSS Named colours. + - + name: labels + type: array + description: An array of the Agent's labels. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: name + type: string + description: Name of the label. + - + name: machine_name + type: string + description: Unique slugified name of the label. + - + name: extra_attrs + type: array + description: | + Custom fields for this object. + + Updated with payload shape: `'extra_attrs': {'custom_field_machine_name_1': 'value_1', 'custom_field_machine_name_2': 'value_2'}` + +filters: + - + name: user__created__gte + type: string + description: Filter by the date and time the Agent was created. + - + name: user__created__lte + type: string + description: Filter by the date and time the Agent was created. + - + name: user__first_name + type: string + description: Filter by the Agent's first name. + - + name: user__last_name + type: string + description: Filter by the Agent's last name. + - + name: user__email + type: string + description: Filter by the Agent's email address. + - + name: status + type: string + description: Filter by the Agent's status. + - + name: distance_address + type: string + description: Filter by the address. + - + name: distance_radius + type: integer + description: Filter by the radius of the address. This is used in conjunction with the `address` filter. + - + name: labels + type: integer + description: Filter by the Agent's labels (id). diff --git a/pages/agents/agents.yml b/pages/agents/agents.yml index a2013e1..8dfd5cc 100644 --- a/pages/agents/agents.yml +++ b/pages/agents/agents.yml @@ -1,10 +1,17 @@ sections: - - title: Agent Object - id: agent-object - description: /agents/agent-object.md - attributes: /agents/agent-object.yml - response: /agents/agent-object.json + title: Agent Object (Version 1) + id: agent-object-v1 + description: /agents/agent-object-v1.md + attributes: /agents/agent-object-v1.yml + response: /agents/agent-object-v1.json + response_title: OBJECT + - + title: Agent Object (Version 2) + id: agent-object-v2 + description: /agents/agent-object-v2.md + attributes: /agents/agent-object-v2.yml + response: /agents/agent-object-v2.json response_title: OBJECT - title: List all Agents diff --git a/pages/agents/create-an-agent.json b/pages/agents/create-an-agent.json index b267407..14f38a1 100644 --- a/pages/agents/create-an-agent.json +++ b/pages/agents/create-an-agent.json @@ -1,37 +1,32 @@ { - "status": "success", - "role": { - "id": 65, - "user": { - "title": null, - "first_name": "Billy", - "last_name": "Holiday", - "email": "billy_holiday@example.com", - "mobile": "07123 456 789", - "phone": "0208 123 4567", - "street": "8 Albert Road", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "E80 1FA", - "latitude": "51.5373258999999990", - "longitude": "-0.1496343000000000", - "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" - }, - "commission_rate": null, - "clients": [], - "last_updated": "2020-03-16T12:23:39.056867Z", - "calendar_colour": "Brown", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "user-dob", - "name": "Date of birth" - } - ] - } + "id": 65, + "title": null, + "first_name": "Billy", + "last_name": "Holiday", + "email": "billy_holiday@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London", + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] } diff --git a/pages/agents/create-an-agent.py b/pages/agents/create-an-agent.py index caa6e7d..13d40d4 100644 --- a/pages/agents/create-an-agent.py +++ b/pages/agents/create-an-agent.py @@ -2,21 +2,17 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'first_name': 'Billy', - 'last_name': 'Bob', - 'email': 'billy_bob@example.com', - 'mobile': '07123456789', - 'phone': '02081234567', - 'street': '177 South Lambeth Road', - 'state': None, - 'town': 'London', - 'country': 183, - 'postcode': 'SW8 1XP', - 'latitude': '51.5549', - 'longitude': '-0.1084', - 'timezone': 'Europe/London', - }, + 'first_name': 'Billy', + 'last_name': 'Bob', + 'email': 'billy_bob@example.com', + 'mobile': '07123456789', + 'phone': '02081234567', + 'street': '177 South Lambeth Road', + 'state': None, + 'town': 'London', + 'country': 183, + 'postcode': 'SW8 1XP', + 'timezone': 'Europe/London', 'commission_rate': 10.1, 'calendar_colour': 'LimeGreen', 'extra_attrs': {'user_dob': '1993-06-23'}, diff --git a/pages/agents/delete-an-agent.json b/pages/agents/delete-an-agent.json new file mode 100644 index 0000000..4606544 --- /dev/null +++ b/pages/agents/delete-an-agent.json @@ -0,0 +1 @@ +{"message": "Successfully deleted role 65: Billy Holiday"} \ No newline at end of file diff --git a/pages/agents/delete-an-agent.md b/pages/agents/delete-an-agent.md new file mode 100644 index 0000000..5aef0a6 --- /dev/null +++ b/pages/agents/delete-an-agent.md @@ -0,0 +1,4 @@ +### Delete an Agent + +Deletes an existing agent. You only need to specify the unique +`id` of the Agent to get the correct details. This will put the agent in the trash but will not permanently delete them. diff --git a/pages/agents/delete-an-agent.py b/pages/agents/delete-an-agent.py new file mode 100644 index 0000000..fc5e0bf --- /dev/null +++ b/pages/agents/delete-an-agent.py @@ -0,0 +1,5 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +r = requests.delete('https://secure.tutorcruncher.com/api/agents/', headers=headers) +pprint.pprint(r.json()) diff --git a/pages/agents/get-an-agent.json b/pages/agents/get-an-agent.json index b740d93..e55c178 100644 --- a/pages/agents/get-an-agent.json +++ b/pages/agents/get-an-agent.json @@ -1,22 +1,20 @@ { "id": 65, - "user": { - "title": null, - "first_name": "Billy", - "last_name": "Holiday", - "email": "billy_holiday@example.com", - "mobile": "07123 456 789", - "phone": "0208 123 4567", - "street": "8 Albert Road", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "E80 1FA", - "latitude": "51.5373258999999990", - "longitude": "-0.1496343000000000", - "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" - }, + "title": null, + "first_name": "Billy", + "last_name": "Holiday", + "email": "billy_holiday@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London", "commission_rate": null, "clients": [], "last_updated": "2020-03-16T12:23:39.056867Z", diff --git a/pages/agents/label-add-to-an-agent.json b/pages/agents/label-add-to-an-agent.json index 475ff91..0fd8b91 100644 --- a/pages/agents/label-add-to-an-agent.json +++ b/pages/agents/label-add-to-an-agent.json @@ -1,22 +1,20 @@ { "id": 65, - "user": { - "title": null, - "first_name": "Billy", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": "07123 456 789", - "phone": "0208 123 4567", - "street": "8 Albert Road", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "E80 1FA", - "latitude": "51.5373258999999990", - "longitude": "-0.1496343000000000", - "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" - }, + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London", "commission_rate": null, "clients": [], "last_updated": "2020-03-16T12:23:39.056867Z", diff --git a/pages/agents/label-add-to-an-agent.md b/pages/agents/label-add-to-an-agent.md index 437ecbe..f1e0bed 100644 --- a/pages/agents/label-add-to-an-agent.md +++ b/pages/agents/label-add-to-an-agent.md @@ -2,4 +2,4 @@ For more information on Labels, see the [Labels](#label-object) section. Bear in mind that if the Label has been set up to email admins when added to an object, adding a Label through the API will trigger the email. -If you add a Label that has already been added to an object, the Label will not be added again and you will get a normal `200` response. +If you add a Label that has already been added to an object, the Label will not be added again, and you will get a normal `200` response. diff --git a/pages/agents/label-remove-from-an-agent.json b/pages/agents/label-remove-from-an-agent.json index 8983f8d..36a7b29 100644 --- a/pages/agents/label-remove-from-an-agent.json +++ b/pages/agents/label-remove-from-an-agent.json @@ -1,22 +1,20 @@ { "id": 65, - "user": { - "title": null, - "first_name": "Billy", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": "07123 456 789", - "phone": "0208 123 4567", - "street": "8 Albert Road", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "E80 1FA", - "latitude": "51.5373258999999990", - "longitude": "-0.1496343000000000", - "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" - }, + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London", "commission_rate": null, "clients": [], "last_updated": "2020-03-16T12:23:39.056867Z", diff --git a/pages/agents/update-an-agent.json b/pages/agents/update-an-agent.json index b455818..36a7b29 100644 --- a/pages/agents/update-an-agent.json +++ b/pages/agents/update-an-agent.json @@ -1,37 +1,32 @@ { - "status": "success", - "role": { - "id": 65, - "user": { - "title": null, - "first_name": "Billy", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": "07123 456 789", - "phone": "0208 123 4567", - "street": "8 Albert Road", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "E80 1FA", - "latitude": "51.5373258999999990", - "longitude": "-0.1496343000000000", - "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" - }, - "commission_rate": null, - "clients": [], - "last_updated": "2020-03-16T12:23:39.056867Z", - "calendar_colour": "Brown", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "user-dob", - "name": "Date of birth" - } - ] - } + "id": 65, + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London", + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] } diff --git a/pages/agents/update-an-agent.md b/pages/agents/update-an-agent.md index 6061439..10caff5 100644 --- a/pages/agents/update-an-agent.md +++ b/pages/agents/update-an-agent.md @@ -1,6 +1,6 @@ ### Update an Agent -Update an Agent object by supplying the email address as the unique identifier. You must also supply required fields +Update an Agent object by supplying the ID as the unique identifier in the url. You must also supply required fields like `last_name` even if they are not being updated. You only need to post information that you want to change and not the whole Agent object. diff --git a/pages/agents/update-an-agent.py b/pages/agents/update-an-agent.py index 2cdb8b8..7ca4cba 100644 --- a/pages/agents/update-an-agent.py +++ b/pages/agents/update-an-agent.py @@ -2,13 +2,11 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'email': 'billy_bob@example.com', - 'last_name': 'Bob2', - # ... - }, + 'email': 'billy_bob@example.com', + 'last_name': 'Bob2', + # ... 'extra_attrs': {'user_dob': '1993-06-23'}, # ... } -r = requests.post('https://secure.tutorcruncher.com/api/agents/', json=data, headers=headers) +r = requests.post('https://secure.tutorcruncher.com/api/agents//', json=data, headers=headers) pprint.pprint(r.json()) diff --git a/pages/ahc-categories/ad-hoc-charge-category-object.json b/pages/ahc-categories/ad-hoc-charge-category-object.json index 65c2195..b4324a6 100644 --- a/pages/ahc-categories/ad-hoc-charge-category-object.json +++ b/pages/ahc-categories/ad-hoc-charge-category-object.json @@ -1,6 +1,5 @@ { "branch_tax_setup": "Default Company Tax (20%)", - "charge_via_branch": true, "contractor_tax_setup": "Default Company Tax (20%)", "contractor_usable": true, "default_charge_amount": "10.00", diff --git a/pages/ahc-categories/ad-hoc-charge-category-object.yml b/pages/ahc-categories/ad-hoc-charge-category-object.yml index 497f1a7..b4f1bd0 100644 --- a/pages/ahc-categories/ad-hoc-charge-category-object.yml +++ b/pages/ahc-categories/ad-hoc-charge-category-object.yml @@ -11,10 +11,6 @@ attributes: name: branch_tax_setup type: string description: Tax setup for the Branch when invoicing. - - - name: charge_via_branch - type: boolean - description: Force Invoices associated with this Tutor to be charged via branch. - name: contractor_tax_setup type: string diff --git a/pages/ahc-categories/list-all-ad-hoc-charge-categories.json b/pages/ahc-categories/list-all-ad-hoc-charge-categories.json index f1ff83c..d91d998 100644 --- a/pages/ahc-categories/list-all-ad-hoc-charge-categories.json +++ b/pages/ahc-categories/list-all-ad-hoc-charge-categories.json @@ -5,7 +5,6 @@ "results": [ { "branch_tax_setup": "Default Company Tax (20%)", - "charge_via_branch": true, "contractor_tax_setup": "Default Company Tax (20%)", "contractor_usable": true, "default_charge_amount": "10.00", diff --git a/pages/api.yml b/pages/api.yml index 7912580..a074e87 100644 --- a/pages/api.yml +++ b/pages/api.yml @@ -28,10 +28,10 @@ info_sections: title: Pagination id: pagination layout: /pagination/pagination.yml -# - -# title: Filters -# id: filters -# layout: /filters/filters.yml + - + title: Versioning + id: versioning + layout: /versioning/versioning.yml endpoint_sections: - diff --git a/pages/clients/client-object.json b/pages/clients/client-object-v1.json similarity index 98% rename from pages/clients/client-object.json rename to pages/clients/client-object-v1.json index 7a8f15b..306a771 100644 --- a/pages/clients/client-object.json +++ b/pages/clients/client-object-v1.json @@ -28,7 +28,6 @@ "low_balance_reminders", "broadcasts" ], - "charge_via_branch": false, "invoices_count": 4, "payment_pending": "100.50", "auto_charge": true, diff --git a/pages/clients/client-object-v1.md b/pages/clients/client-object-v1.md new file mode 100644 index 0000000..4613da8 --- /dev/null +++ b/pages/clients/client-object-v1.md @@ -0,0 +1,5 @@ +### Client Object (Version 1 - Will be deprecated 3rd July 2025) + +Client objects includes basic user information including fields that are only linked to the +Client Role. For example, `students` where the Client is the `paying_client` of the student. + diff --git a/pages/clients/client-object.yml b/pages/clients/client-object-v1.yml similarity index 96% rename from pages/clients/client-object.yml rename to pages/clients/client-object-v1.yml index c26334b..2283e08 100644 --- a/pages/clients/client-object.yml +++ b/pages/clients/client-object-v1.yml @@ -78,10 +78,6 @@ attributes: name: received_notifications type: array description: An array of the Client's received notifications. choices are `broadcasts`, `apt_reminders`, `low_balance_reminders`, `invoice_reminders`, `pfi_reminders`, `invoices`, `credit_requests` - - - name: charge_via_branch - type: boolean - description: Force Invoices associated with this Tutor to be charged via branch. - name: invoices_count type: integer @@ -223,23 +219,23 @@ attributes: filters: - - name: created__gte + name: user__created__gte type: string description: Filter by the date and time the Client was created. - - name: created__lte + name: user__created__lte type: string description: Filter by the date and time the Client was created. - - name: first_name + name: user__first_name type: string description: Filter by the Client's first name. - - name: last_name + name: user__last_name type: string description: Filter by the Client's last name. - - name: email + name: user__email type: string description: Filter by the Client's email address. - diff --git a/pages/clients/client-object-v2.json b/pages/clients/client-object-v2.json new file mode 100644 index 0000000..1412bc2 --- /dev/null +++ b/pages/clients/client-object-v2.json @@ -0,0 +1,76 @@ +{ + "id": 3, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null + "status": "live", + "is_taxable": true, + "received_notifications": [ + "invoice_reminders", + "invoices", + "apt_reminders", + "pfi_reminders", + "credit-requests", + "low_balance_reminders", + "broadcasts" + ], + "invoices_count": 4, + "payment_pending": "100.50", + "auto_charge": true, + "associated_admin": { + "id": 2, + "first_name": "Diana", + "last_name": "Lafayette", + "email": "diana_lafayette@example.com" + }, + "associated_agent": null, + "pipeline_stage": null, + "paid_recipients": [ + { + "id": 4, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/4/" + }, + { + "id": 6, + "first_name": "Harry", + "last_name": "Hoskins", + "email": "harry_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/6/" + }, + { + "id": 5, + "first_name": "Archie", + "last_name": "Hoskins", + "email": "archie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/5/" + } + ], + "calendar_colour": "ForestGreen", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "", + "type": "Date", + "machine_name": "client-dob", + "name": "Date of birth" + } + ], + "invoice_balance": "-120.00", + "available_balance": "-220.50" +} diff --git a/pages/clients/client-object.md b/pages/clients/client-object-v2.md similarity index 86% rename from pages/clients/client-object.md rename to pages/clients/client-object-v2.md index 28cc57f..c49b038 100644 --- a/pages/clients/client-object.md +++ b/pages/clients/client-object-v2.md @@ -1,4 +1,4 @@ -### Client Object +### Client Object (Version 2) Client objects includes basic user information including fields that are only linked to the Client Role. For example, `students` where the Client is the `paying_client` of the student. diff --git a/pages/clients/client-object-v2.yml b/pages/clients/client-object-v2.yml new file mode 100644 index 0000000..f24d813 --- /dev/null +++ b/pages/clients/client-object-v2.yml @@ -0,0 +1,253 @@ +attributes: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: The user's first name. + - + name: last_name + type: string + description: The user's last name. + - + name: email + type: string + description: The user's email address. + - + name: mobile + type: string + description: The user's mobile number. + - + name: phone + type: string + description: The user's phone number. + - + name: street + type: string + description: The user's street address. + - + name: state + type: string + description: This field is only needed for US users. This value will use the state's 2-letter code. + - + name: town + type: string + description: The user's town on address. + - + name: country + type: integer + description: | + User's country, value is an `id` of the country stored in TutorCruncher. These country ids can be found + by doing an options request at this endpoints base URL. + - + name: postcode + type: string + description: The user's postcode on address. + - + name: latitude + type: decimal + description: The user's addresses latitude. + - + name: longitude + type: decimal + description: The user's addresses longitude. + - + name: date_created + type: string + description: The date and time the user was created. + - + name: timezone + type: string + description: The user's timezone, accepted values are timezone database values. + - + name: status + type: string + description: The Client's status, choices are `prospect`, `live` and `dormant`. + - + name: is_taxable + type: boolean + description: Whether or not tax should be paid on payments from this Client. + - + name: received_notifications + type: array + description: An array of the Client's received notifications. choices are `broadcasts`, `apt_reminders`, `low_balance_reminders`, `invoice_reminders`, `pfi_reminders`, `invoices`, `credit_requests` + - + name: invoices_count + type: integer + description: The number of invoice related to the Client. + - + name: payment_pending + type: string + description: Total amount of pending payments related to the Client. + - + name: auto_charge + type: integer + description: | + Whether the Client will be auto charged or not. Choices are `0` to follow the Branch setting, `10` for the Client + to be auto charged and `20` for the Client not to be auto charged. + - + name: associated_admin + type: object + description: Object of the Client Manager. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: User's first name. + - + name: last_name + type: string + description: User's last name. + - + name: email + type: string + description: User's email address. + - + name: associated_agent + type: object + description: Object of the set agent. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: User's first name. + - + name: last_name + type: string + description: User's last name. + - + name: email + type: string + description: User's email address. + - + name: url + type: string + description: URL to the Agent's object. + - + name: pipeline_stage + type: object + description: PipelineStage of the client if they are a Prosect client. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: name + type: string + description: The name of the PipelineStage + - + name: sort_index + type: integer + description: The sort index of the PipelineStage (describes the order of the PipelineStages). + - + name: paid_recipients + type: array + description: An array of recipients related to the Client. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: User's first name. + - + name: last_name + type: string + description: User's last name. + - + name: email + type: string + description: User's email address. + - + name: url + type: string + description: URL to the Recipient's object. + - + name: calendar_colour + type: string + description: Use hex values, like `#fff000`, or use CSS Named colours. + - + name: labels + type: array + description: An array of the Client's labels. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: name + type: string + description: Name of the label. + - + name: machine_name + type: string + description: Unique slugified name of the label. + - + name: extra_attrs + type: array + description: | + Custom fields for this object. + + Updated with payload shape: `'extra_attrs': {'custom_field_machine_name_1': 'value_1', 'custom_field_machine_name_2': 'value_2'}` + - + name: invoice_balance + type: string + description: The Client's invoice balance. + - + name: available_balance + type: string + description: The Client's available balance. + +filters: + - + name: user__created__gte + type: string + description: Filter by the date and time the Client was created. + - + name: user__created__lte + type: string + description: Filter by the date and time the Client was created. + - + name: user__first_name + type: string + description: Filter by the Client's first name. + - + name: user__last_name + type: string + description: Filter by the Client's last name. + - + name: user__email + type: string + description: Filter by the Client's email address. + - + name: status + type: string + description: Filter by the Client's status. + - + name: distance_address + type: string + description: Filter by the address. + - + name: distance_radius + type: integer + description: Filter by the radius of the address. This is used in conjunction with the `address` filter. + - + name: labels + type: integer + description: Filter by the Client's labels (id). + + diff --git a/pages/clients/clients.yml b/pages/clients/clients.yml index 69d3201..cf54a7a 100644 --- a/pages/clients/clients.yml +++ b/pages/clients/clients.yml @@ -1,10 +1,17 @@ sections: - - title: Client Object - id: client-object - description: /clients/client-object.md - attributes: /clients/client-object.yml - response: /clients/client-object.json + title: Client Object (Version 1) + id: client-object-v1 + description: /clients/client-object-v1.md + attributes: /clients/client-object-v1.yml + response: /clients/client-object-v1.json + response_title: OBJECT + - + title: Client Object (Version 2) + id: client-object-v2 + description: /clients/client-object-v2.md + attributes: /clients/client-object-v2.yml + response: /clients/client-object-v2.json response_title: OBJECT - title: List all Clients diff --git a/pages/clients/create-a-client.json b/pages/clients/create-a-client.json index b64091b..7b8b80a 100644 --- a/pages/clients/create-a-client.json +++ b/pages/clients/create-a-client.json @@ -1,83 +1,77 @@ { - "status": "success", - "role": { - "id": 3, - "user": { - "title": "Mr", - "first_name": "Jamie", + "id": 3, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null, + "status": "live", + "is_taxable": true, + "received_notifications": [ + "invoice_reminders", + "invoices", + "apt_reminders", + "pfi_reminders", + "credit-requests", + "low_balance_reminders", + "broadcasts" + ], + "invoices_count": 4, + "payment_pending": "100.50", + "auto_charge": true, + "associated_admin": { + "id": 2, + "first_name": "Diana", + "last_name": "Lafayette", + "email": "diana_lafayette@example.com" + }, + "associated_agent": null, + "pipeline_stage": null, + "paid_recipients": [ + { + "id": 4, + "first_name": "Arthur", "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "mobile": "0207 1128 953", - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null + "email": "arthur_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/4/" }, - "status": "live", - "is_taxable": true, - "received_notifications": [ - "invoice_reminders", - "invoices", - "apt_reminders", - "pfi_reminders", - "credit-requests", - "low_balance_reminders", - "broadcasts" - ], - "charge_via_branch": false, - "invoices_count": 4, - "payment_pending": "100.50", - "auto_charge": true, - "associated_admin": { - "id": 2, - "first_name": "Diana", - "last_name": "Lafayette", - "email": "diana_lafayette@example.com" + { + "id": 6, + "first_name": "Harry", + "last_name": "Hoskins", + "email": "harry_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/6/" }, - "associated_agent": null, - "pipeline_stage": null, - "paid_recipients": [ - { - "id": 4, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/recipients/4/" - }, - { - "id": 6, - "first_name": "Harry", - "last_name": "Hoskins", - "email": "harry_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/recipients/6/" - }, - { - "id": 5, - "first_name": "Archie", - "last_name": "Hoskins", - "email": "archie_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/recipients/5/" - } - ], - "last_updated": "2020-01-01T13:00:00.000000Z", - "calendar_colour": "ForestGreen", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "client-dob", - "name": "Date of birth" - } - ], - "invoice_balance": "-120.00", - "available_balance": "-220.50" - } + { + "id": 5, + "first_name": "Archie", + "last_name": "Hoskins", + "email": "archie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/5/" + } + ], + "last_updated": "2020-01-01T13:00:00.000000Z", + "calendar_colour": "ForestGreen", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "client-dob", + "name": "Date of birth" + } + ], + "invoice_balance": "-120.00", + "available_balance": "-220.50" } diff --git a/pages/clients/create-a-client.py b/pages/clients/create-a-client.py index 9a6a84b..4166c56 100644 --- a/pages/clients/create-a-client.py +++ b/pages/clients/create-a-client.py @@ -2,21 +2,17 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'first_name': 'Billy', - 'last_name': 'Bob', - 'email': 'billy_bob@example.com', - 'mobile': '07123456789', - 'phone': '02081234567', - 'street': '177 South Lambeth Road', - 'state': None, - 'town': 'London', - 'country': 183, - 'postcode': 'SW8 1XP', - 'latitude': '51.5549', - 'longitude': '-0.1084', - 'timezone': 'Europe/London', - }, + 'first_name': 'Billy', + 'last_name': 'Bob', + 'email': 'billy_bob@example.com', + 'mobile': '07123456789', + 'phone': '02081234567', + 'street': '177 South Lambeth Road', + 'state': None, + 'town': 'London', + 'country': 183, + 'postcode': 'SW8 1XP', + 'timezone': 'Europe/London', 'status': 'live', 'is_taxable': False, 'received_notifications': [ diff --git a/pages/clients/delete-a-client.json b/pages/clients/delete-a-client.json new file mode 100644 index 0000000..b84b6e0 --- /dev/null +++ b/pages/clients/delete-a-client.json @@ -0,0 +1 @@ +{"message": "Successfully deleted role 3: Jamie Hoskins"} \ No newline at end of file diff --git a/pages/clients/delete-a-client.md b/pages/clients/delete-a-client.md new file mode 100644 index 0000000..7fbeb16 --- /dev/null +++ b/pages/clients/delete-a-client.md @@ -0,0 +1,4 @@ +### Delete an Client + +Deletes an existing Client. You only need to specify the unique +`id` of the Client to get the correct details. This will put the agent in the trash but will not permanently delete them. diff --git a/pages/clients/delete-a-client.py b/pages/clients/delete-a-client.py new file mode 100644 index 0000000..8977264 --- /dev/null +++ b/pages/clients/delete-a-client.py @@ -0,0 +1,5 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +r = requests.delete('https://secure.tutorcruncher.com/api/clients/', headers=headers) +pprint.pprint(r.json()) diff --git a/pages/clients/get-a-client.json b/pages/clients/get-a-client.json index f8c633f..cbc284e 100644 --- a/pages/clients/get-a-client.json +++ b/pages/clients/get-a-client.json @@ -1,22 +1,20 @@ { "id": 3, - "user": { - "title": "Mr", - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "mobile": "0207 1128 953", - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null - }, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null, "status": "live", "is_taxable": true, "received_notifications": [ @@ -28,7 +26,6 @@ "low_balance_reminders", "broadcasts" ], - "charge_via_branch": false, "invoices_count": 4, "payment_pending": "100.50", "auto_charge": true, diff --git a/pages/clients/label-add-to-a-client.json b/pages/clients/label-add-to-a-client.json index f8c633f..cbc284e 100644 --- a/pages/clients/label-add-to-a-client.json +++ b/pages/clients/label-add-to-a-client.json @@ -1,22 +1,20 @@ { "id": 3, - "user": { - "title": "Mr", - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "mobile": "0207 1128 953", - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null - }, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null, "status": "live", "is_taxable": true, "received_notifications": [ @@ -28,7 +26,6 @@ "low_balance_reminders", "broadcasts" ], - "charge_via_branch": false, "invoices_count": 4, "payment_pending": "100.50", "auto_charge": true, diff --git a/pages/clients/label-remove-from-a-client.json b/pages/clients/label-remove-from-a-client.json index b016bfa..fc12136 100644 --- a/pages/clients/label-remove-from-a-client.json +++ b/pages/clients/label-remove-from-a-client.json @@ -1,22 +1,20 @@ { "id": 65, - "user": { - "title": null, - "first_name": "Billy", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": "07123 456 789", - "phone": "0208 123 4567", - "street": "8 Albert Road", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "E80 1FA", - "latitude": "51.5373258999999990", - "longitude": "-0.1496343000000000", - "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" - }, + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London" "commission_rate": null, "clients": [], "last_updated": "2020-03-16T12:23:39.056867Z", diff --git a/pages/clients/update-a-client.json b/pages/clients/update-a-client.json index 274aebe..1037afe 100644 --- a/pages/clients/update-a-client.json +++ b/pages/clients/update-a-client.json @@ -1,82 +1,76 @@ { - "status": "success", - "role": { - "id": 3, - "user": { - "title": "Mr", - "first_name": "Jamie", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": "0207 1128 953", - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null + "id": 3, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null, + "status": "live", + "is_taxable": true, + "received_notifications": [ + "invoice_reminders", + "invoices", + "apt_reminders", + "pfi_reminders", + "credit-requests", + "low_balance_reminders", + "broadcasts" + ], + "invoices_count": 4, + "payment_pending": "100.50", + "auto_charge": true, + "associated_admin": { + "id": 2, + "first_name": "Diana", + "last_name": "Lafayette", + "email": "diana_lafayette@example.com" + }, + "associated_agent": null, + "pipeline_stage": null, + "paid_recipients": [ + { + "id": 4, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/4/" }, - "status": "live", - "is_taxable": true, - "received_notifications": [ - "invoice_reminders", - "invoices", - "apt_reminders", - "pfi_reminders", - "credit-requests", - "low_balance_reminders", - "broadcasts" - ], - "charge_via_branch": false, - "invoices_count": 4, - "payment_pending": "100.50", - "auto_charge": true, - "associated_admin": { - "id": 2, - "first_name": "Diana", - "last_name": "Lafayette", - "email": "diana_lafayette@example.com" + { + "id": 6, + "first_name": "Harry", + "last_name": "Hoskins", + "email": "harry_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/6/" }, - "associated_agent": null, - "pipeline_stage": null, - "paid_recipients": [ - { - "id": 4, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/recipients/4/" - }, - { - "id": 6, - "first_name": "Harry", - "last_name": "Hoskins", - "email": "harry_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/recipients/6/" - }, - { - "id": 5, - "first_name": "Archie", - "last_name": "Hoskins", - "email": "archie_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/recipients/5/" - } - ], - "calendar_colour": "ForestGreen", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "client-dob", - "name": "Date of birth" - } - ], - "invoice_balance": "-120.00", - "available_balance": "-220.50" - } + { + "id": 5, + "first_name": "Archie", + "last_name": "Hoskins", + "email": "archie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/5/" + } + ], + "calendar_colour": "ForestGreen", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "client-dob", + "name": "Date of birth" + } + ], + "invoice_balance": "-120.00", + "available_balance": "-220.50" } diff --git a/pages/clients/update-a-client.md b/pages/clients/update-a-client.md index 38c913d..6e5f088 100644 --- a/pages/clients/update-a-client.md +++ b/pages/clients/update-a-client.md @@ -1,6 +1,6 @@ ### Update a Client -Update a Client object by supplying the email address as the unique identifier. You must also supply required fields +Update an Client object by supplying the ID as the unique identifier in the url. You must also supply required fields like `last_name` even if they are not being updated. You only need to post information that you want to change and not the whole Client object. diff --git a/pages/clients/update-a-client.py b/pages/clients/update-a-client.py index a1f0360..b6b144b 100644 --- a/pages/clients/update-a-client.py +++ b/pages/clients/update-a-client.py @@ -2,13 +2,11 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'email': 'billy_bob@example.com', - 'last_name': 'Bob2', - # ... - }, + 'email': 'billy_bob@example.com', + 'last_name': 'Bob2', + # ... 'extra_attrs': {'client_dob': '1993-06-23'}, # ... } -r = requests.post('https://secure.tutorcruncher.com/api/clients/', json=data, headers=headers) +r = requests.post('https://secure.tutorcruncher.com/api/clients//', json=data, headers=headers) pprint.pprint(r.json()) diff --git a/pages/contractors/contractor-object.json b/pages/contractors/contractor-object-v1.json similarity index 97% rename from pages/contractors/contractor-object.json rename to pages/contractors/contractor-object-v1.json index 11af289..c8a256d 100644 --- a/pages/contractors/contractor-object.json +++ b/pages/contractors/contractor-object-v1.json @@ -18,7 +18,6 @@ "timezone": null }, "status": "approved", - "charge_via_branch": false, "default_rate": null, "qualifications": [], "skills": [ diff --git a/pages/contractors/contractor-object-v1.md b/pages/contractors/contractor-object-v1.md new file mode 100644 index 0000000..d4c8c38 --- /dev/null +++ b/pages/contractors/contractor-object-v1.md @@ -0,0 +1,5 @@ +### Contractor Object (Version 1 - Will be deprecated 3rd July 2025) + +Contractor objects, Tutors in TutorCruncher, includes basic user information including fields that are only linked +to the Contractor Role. For example, subjects and qualifications, under `skills`, they have earned. + diff --git a/pages/contractors/contractor-object.yml b/pages/contractors/contractor-object-v1.yml similarity index 96% rename from pages/contractors/contractor-object.yml rename to pages/contractors/contractor-object-v1.yml index 84979de..c7dc307 100644 --- a/pages/contractors/contractor-object.yml +++ b/pages/contractors/contractor-object-v1.yml @@ -70,10 +70,6 @@ attributes: name: status type: string description: The Contractor's status, choices are `pending`, `approved`, `rejected` and `dormant`. - - - name: charge_via_branch - type: boolean - description: Force Invoices associated with this Tutor to be charged via branch. - name: default_rate type: decimal @@ -205,23 +201,23 @@ attributes: filters: - - name: created__gte + name: user__created__gte type: string description: Filter by the date and time the Contractor was created. - - name: created__lte + name: user__created__lte type: string description: Filter by the date and time the Contractor was created. - - name: first_name + name: user__first_name type: string description: Filter by the Contractor's first name. - - name: last_name + name: user__last_name type: string description: Filter by the Contractor's last name. - - name: email + name: user__email type: string description: Filter by the Contractor's email address. - diff --git a/pages/contractors/contractor-object-v2.json b/pages/contractors/contractor-object-v2.json new file mode 100644 index 0000000..736387d --- /dev/null +++ b/pages/contractors/contractor-object-v2.json @@ -0,0 +1,46 @@ +{ + "id": 568433, + "title": null, + "first_name": "James", + "last_name": "Higgins", + "email": "james_higgins@example.com", + "mobile": "07842 485 204", + "phone": null, + "street": "Royal Lane", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "W1T 4AY", + "latitude": "51.5210000000000008", + "longitude": "-0.1370000000000005", + "date_created": "2018-11-22T09:23:55.297608Z", + "timezone": null, + "status": "approved", + "default_rate": null, + "qualifications": [], + "skills": [ + { + "id": 1436, + "subject": "American Studies", + "qual_level": "Key Stage 5" + }, + { + "id": 4082, + "subject": "American Studies", + "qual_level": "A Level" + } + ], + "institutions": [], + "receive_service_notifications": true, + "review_rating": null, + "review_duration": "00:00:00", + "last_updated": "2020-04-06T15:36:16.924625+01:00", + "calendar_colour": "#757575", + "labels": [], + "extra_attrs": [], + "work_done_details": { + "amount_owed": 264.49, + "amount_paid": 175.0, + "total_paid_hours": "05:00:00" + } +} diff --git a/pages/contractors/contractor-object.md b/pages/contractors/contractor-object-v2.md similarity index 86% rename from pages/contractors/contractor-object.md rename to pages/contractors/contractor-object-v2.md index 9aad668..86fa4a0 100644 --- a/pages/contractors/contractor-object.md +++ b/pages/contractors/contractor-object-v2.md @@ -1,4 +1,4 @@ -### Contractor Object +### Contractor Object (Version 2) Contractor objects, Tutors in TutorCruncher, includes basic user information including fields that are only linked to the Contractor Role. For example, subjects and qualifications, under `skills`, they have earned. diff --git a/pages/contractors/contractor-object-v2.yml b/pages/contractors/contractor-object-v2.yml new file mode 100644 index 0000000..03510ff --- /dev/null +++ b/pages/contractors/contractor-object-v2.yml @@ -0,0 +1,237 @@ +attributes: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: The user's first name. + - + name: last_name + type: string + description: The user's last name. + - + name: email + type: string + description: The user's email address. + - + name: mobile + type: string + description: The user's mobile number. + - + name: phone + type: string + description: The user's phone number. + - + name: street + type: string + description: The user's street address. + - + name: state + type: string + description: This field is only needed for US users. This value will use the state's 2-letter code. + - + name: town + type: string + description: The user's town on address. + - + name: country + type: integer + description: | + User's country, value is an `id` of the country stored in TutorCruncher. These country ids can be found + by doing an options request at this endpoints base URL. + - + name: postcode + type: string + description: The user's postcode on address. + - + name: latitude + type: decimal + description: The user's addresses latitude. + - + name: longitude + type: decimal + description: The user's addresses longitude. + - + name: date_created + type: string + description: The date and time the user was created. + - + name: timezone + type: string + description: The user's timezone, accepted values are timezone database values. + - + name: status + type: string + description: The Contractor's status, choices are `pending`, `approved`, `rejected` and `dormant`. + - + name: default_rate + type: decimal + description: The Contractor's rate which will be used to override service default rates. + - + name: qualifications + type: array + description: An array of the Contractor's qualifications. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: institution + type: string + description: Name of the institution. + - + name: subject + type: string + description: Name of the subject. + - + name: qual_level + type: string + description: Name of the qualification. + - + name: grade + type: string + description: The grade for the qualification. + - + name: year + type: integer + description: The year for the qualification. + - + name: governing_body + type: string + description: Name of the governing body for the qualification. + - + name: skills + type: array + description: An array of the Contractor's skills. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: subject + type: string + description: Name of the subject. + - + name: qual_level + type: string + description: Name of the qualification. + - + name: institutions + type: array + description: An array of the Contractor's institutions. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: name + type: string + description: Name of the institution. + - + name: receive_service_notifications + type: boolean + description: When checked the Tutor will receive email notifications of Jobs available for application. + - + name: review_rating + type: decimal + description: Contractor's review rating. + - + name: review_duration + type: string + description: Total amount of time that has been reviewed. + - + name: last_updated + type: string + description: The date and time the Contractor was last updated. + - + name: calendar_colour + type: string + description: Use hex values, like `#fff000`, or use CSS Named colours. + - + name: labels + type: array + description: An array of the Contractor's labels. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: name + type: string + description: Name of the label. + - + name: machine_name + type: string + description: Unique slugified name of the label. + - + name: extra_attrs + type: array + description: | + Custom fields for this object. + + Updated with payload shape: `'extra_attrs': {'custom_field_machine_name_1': 'value_1', 'custom_field_machine_name_2': 'value_2'}` + - + name: work_done_details + type: object + description: Details about the work the Contractor has done. + children: + - + name: amount_owed + type: decimal + description: The amount of money the Contractor is owed. + - + name: amount_paid + type: decimal + description: The amount of money the Contractor has been paid. + - + name: total_paid_hours + type: string + description: Total amount of time the Contractor has been paid for. + +filters: + - + name: user__created__gte + type: string + description: Filter by the date and time the Contractor was created. + - + name: user__created__lte + type: string + description: Filter by the date and time the Contractor was created. + - + name: user__first_name + type: string + description: Filter by the Contractor's first name. + - + name: user__last_name + type: string + description: Filter by the Contractor's last name. + - + name: user__email + type: string + description: Filter by the Contractor's email address. + - + name: status + type: string + description: Filter by the Contractor's status. + - + name: distance_address + type: string + description: Filter by the address. + - + name: distance_radius + type: integer + description: Filter by the radius of the address. This is used in conjunction with the `address` filter. + - + name: labels + type: integer + description: Filter by the Contractor's labels (id). + - + name: skills + type: integer + description: Filter by the Contractor's skills (id). diff --git a/pages/contractors/contractors.yml b/pages/contractors/contractors.yml index b24bcb3..a70b481 100644 --- a/pages/contractors/contractors.yml +++ b/pages/contractors/contractors.yml @@ -1,10 +1,17 @@ sections: - - title: Contractor Object - id: contractor-object - description: /contractors/contractor-object.md - attributes: /contractors/contractor-object.yml - response: /contractors/contractor-object.json + title: Contractor Object (Version 1) + id: contractor-object-v1 + description: /contractors/contractor-object-v1.md + attributes: /contractors/contractor-object-v1.yml + response: /contractors/contractor-object-v1.json + response_title: OBJECT + - + title: Contractor Object (Version 2) + id: contractor-object-v2 + description: /contractors/contractor-object-v2.md + attributes: /contractors/contractor-object-v2.yml + response: /contractors/contractor-object-v2.json response_title: OBJECT - title: List all Contractors diff --git a/pages/contractors/create-a-contractor.json b/pages/contractors/create-a-contractor.json index 0addbce..8fe66cf 100644 --- a/pages/contractors/create-a-contractor.json +++ b/pages/contractors/create-a-contractor.json @@ -1,60 +1,54 @@ { - "status": "success", - "role": { - "id": 568433, - "user": { - "title": null, - "first_name": "James", - "last_name": "Higgins", - "email": "james_higgins@example.com", - "mobile": "07842 485 204", - "phone": null, - "street": "Royal Lane", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "W1T 4AY", - "latitude": "51.5210000000000008", - "longitude": "-0.1370000000000005", - "date_created": "2018-11-22T09:23:55.297608Z", - "timezone": null + "id": 568433, + "title": null, + "first_name": "James", + "last_name": "Higgins", + "email": "james_higgins@example.com", + "mobile": "07842 485 204", + "phone": null, + "street": "Royal Lane", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "W1T 4AY", + "latitude": "51.5210000000000008", + "longitude": "-0.1370000000000005", + "date_created": "2018-11-22T09:23:55.297608Z", + "timezone": null, + "status": "approved", + "default_rate": null, + "qualifications": [], + "skills": [ + { + "id": 1436, + "subject": "American Studies", + "qual_level": "Key Stage 5" }, - "status": "approved", - "charge_via_branch": false, - "default_rate": null, - "qualifications": [], - "skills": [ - { - "id": 1436, - "subject": "American Studies", - "qual_level": "Key Stage 5" - }, - { - "id": 4082, - "subject": "American Studies", - "qual_level": "A Level" - } - ], - "institutions": [], - "receive_service_notifications": true, - "review_rating": null, - "review_duration": "00:00:00", - "last_updated": "2020-04-06T15:36:16.924625+01:00", - "calendar_colour": "#757575", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "user-dob", - "name": "Date of birth" - } - ], - "work_done_details": { - "amount_owed": 264.49, - "amount_paid": 175.0, - "total_paid_hours": "05:00:00" + { + "id": 4082, + "subject": "American Studies", + "qual_level": "A Level" } + ], + "institutions": [], + "receive_service_notifications": true, + "review_rating": null, + "review_duration": "00:00:00", + "last_updated": "2020-04-06T15:36:16.924625+01:00", + "calendar_colour": "#757575", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ], + "work_done_details": { + "amount_owed": 264.49, + "amount_paid": 175.0, + "total_paid_hours": "05:00:00" } } diff --git a/pages/contractors/create-a-contractor.py b/pages/contractors/create-a-contractor.py index 11026cd..45614f9 100644 --- a/pages/contractors/create-a-contractor.py +++ b/pages/contractors/create-a-contractor.py @@ -2,21 +2,17 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'first_name': 'Billy', - 'last_name': 'Bob', - 'email': 'billy_bob@example.com', - 'mobile': '07123456789', - 'phone': '02081234567', - 'street': '177 South Lambeth Road', - 'state': None, - 'town': 'London', - 'country': 183, - 'postcode': 'SW8 1XP', - 'latitude': '51.5549', - 'longitude': '-0.1084', - 'timezone': 'Europe/London', - }, + 'first_name': 'Billy', + 'last_name': 'Bob', + 'email': 'billy_bob@example.com', + 'mobile': '07123456789', + 'phone': '02081234567', + 'street': '177 South Lambeth Road', + 'state': None, + 'town': 'London', + 'country': 183, + 'postcode': 'SW8 1XP', + 'timezone': 'Europe/London', 'status': 'live', 'change_via_branch': True, 'default_rate': 80.0, diff --git a/pages/contractors/delete-a-contractor.json b/pages/contractors/delete-a-contractor.json new file mode 100644 index 0000000..17772f0 --- /dev/null +++ b/pages/contractors/delete-a-contractor.json @@ -0,0 +1 @@ +{"message": "Successfully deleted role 568433: James Higgins"} \ No newline at end of file diff --git a/pages/contractors/delete-a-contractor.md b/pages/contractors/delete-a-contractor.md new file mode 100644 index 0000000..21b230d --- /dev/null +++ b/pages/contractors/delete-a-contractor.md @@ -0,0 +1,4 @@ +### Delete an Contractor + +Deletes an existing Contractor. You only need to specify the unique +`id` of the Contractor to get the correct details. This will put the agent in the trash but will not permanently delete them. diff --git a/pages/contractors/delete-a-contractor.py b/pages/contractors/delete-a-contractor.py new file mode 100644 index 0000000..c81c7b0 --- /dev/null +++ b/pages/contractors/delete-a-contractor.py @@ -0,0 +1,5 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +r = requests.delete('https://secure.tutorcruncher.com/api/contractors/', headers=headers) +pprint.pprint(r.json()) diff --git a/pages/contractors/get-a-contractor.json b/pages/contractors/get-a-contractor.json index cfadc4c..cbfee07 100644 --- a/pages/contractors/get-a-contractor.json +++ b/pages/contractors/get-a-contractor.json @@ -1,24 +1,21 @@ { "id": 568433, - "user": { - "title": null, - "first_name": "James", - "last_name": "Higgins", - "email": "james_higgins@example.com", - "mobile": "07842 485 204", - "phone": null, - "street": "Royal Lane", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "W1T 4AY", - "latitude": "51.5210000000000008", - "longitude": "-0.1370000000000005", - "date_created": "2018-11-22T09:23:55.297608Z", - "timezone": null - }, + "title": null, + "first_name": "James", + "last_name": "Higgins", + "email": "james_higgins@example.com", + "mobile": "07842 485 204", + "phone": null, + "street": "Royal Lane", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "W1T 4AY", + "latitude": "51.5210000000000008", + "longitude": "-0.1370000000000005", + "date_created": "2018-11-22T09:23:55.297608Z", + "timezone": null, "status": "approved", - "charge_via_branch": false, "default_rate": null, "qualifications": [], "skills": [ diff --git a/pages/contractors/label-add-to-a-contractor.json b/pages/contractors/label-add-to-a-contractor.json index f8c633f..cbc284e 100644 --- a/pages/contractors/label-add-to-a-contractor.json +++ b/pages/contractors/label-add-to-a-contractor.json @@ -1,22 +1,20 @@ { "id": 3, - "user": { - "title": "Mr", - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "mobile": "0207 1128 953", - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null - }, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null, "status": "live", "is_taxable": true, "received_notifications": [ @@ -28,7 +26,6 @@ "low_balance_reminders", "broadcasts" ], - "charge_via_branch": false, "invoices_count": 4, "payment_pending": "100.50", "auto_charge": true, diff --git a/pages/contractors/label-remove-from-a-contractor.json b/pages/contractors/label-remove-from-a-contractor.json index d780f7f..085a1ef 100644 --- a/pages/contractors/label-remove-from-a-contractor.json +++ b/pages/contractors/label-remove-from-a-contractor.json @@ -1,22 +1,20 @@ { "id": 3, - "user": { - "title": "Mr", - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "mobile": "0207 1128 953", - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null - }, + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null, "status": "live", "is_taxable": true, "received_notifications": [ @@ -28,7 +26,6 @@ "low_balance_reminders", "broadcasts" ], - "charge_via_branch": false, "invoices_count": 4, "payment_pending": "100.50", "auto_charge": true, diff --git a/pages/contractors/update-a-contractor.json b/pages/contractors/update-a-contractor.json index 8be09a0..53b826a 100644 --- a/pages/contractors/update-a-contractor.json +++ b/pages/contractors/update-a-contractor.json @@ -1,60 +1,54 @@ { - "status": "success", - "role": { - "id": 568433, - "user": { - "title": null, - "first_name": "James", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": "07842 485 204", - "phone": null, - "street": "Royal Lane", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "W1T 4AY", - "latitude": "51.5210000000000008", - "longitude": "-0.1370000000000005", - "date_created": "2018-11-22T09:23:55.297608Z", - "timezone": null + "id": 568433, + "title": null, + "first_name": "James", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07842 485 204", + "phone": null, + "street": "Royal Lane", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "W1T 4AY", + "latitude": "51.5210000000000008", + "longitude": "-0.1370000000000005", + "date_created": "2018-11-22T09:23:55.297608Z", + "timezone": null, + "status": "approved", + "default_rate": null, + "qualifications": [], + "skills": [ + { + "id": 1436, + "subject": "American Studies", + "qual_level": "Key Stage 5" }, - "status": "approved", - "charge_via_branch": false, - "default_rate": null, - "qualifications": [], - "skills": [ - { - "id": 1436, - "subject": "American Studies", - "qual_level": "Key Stage 5" - }, - { - "id": 4082, - "subject": "American Studies", - "qual_level": "A Level" - } - ], - "institutions": [], - "receive_service_notifications": true, - "review_rating": null, - "review_duration": "00:00:00", - "last_updated": "2020-04-06T15:36:16.924625+01:00", - "calendar_colour": "#757575", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "user-dob", - "name": "Date of birth" - } - ], - "work_done_details": { - "amount_owed": 264.49, - "amount_paid": 175.0, - "total_paid_hours": "05:00:00" + { + "id": 4082, + "subject": "American Studies", + "qual_level": "A Level" } + ], + "institutions": [], + "receive_service_notifications": true, + "review_rating": null, + "review_duration": "00:00:00", + "last_updated": "2020-04-06T15:36:16.924625+01:00", + "calendar_colour": "#757575", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ], + "work_done_details": { + "amount_owed": 264.49, + "amount_paid": 175.0, + "total_paid_hours": "05:00:00" } } diff --git a/pages/contractors/update-a-contractor.md b/pages/contractors/update-a-contractor.md index c37b350..9e1121c 100644 --- a/pages/contractors/update-a-contractor.md +++ b/pages/contractors/update-a-contractor.md @@ -1,6 +1,6 @@ ### Update a Contractor -Update a Contractor object by supplying the email address as the unique identifier. You must also supply required fields +Update an Contractor object by supplying the ID as the unique identifier in the url. You must also supply required fields like `last_name` even if they are not being updated. You only need to post information that you want to change and not the whole Contractor object. diff --git a/pages/contractors/update-a-contractor.py b/pages/contractors/update-a-contractor.py index af83b61..7a3ad05 100644 --- a/pages/contractors/update-a-contractor.py +++ b/pages/contractors/update-a-contractor.py @@ -2,13 +2,11 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'email': 'billy_bob@example.com', - 'last_name': 'Bob2', - # ... - }, + 'email': 'billy_bob@example.com', + 'last_name': 'Bob2', + # ... 'extra_attrs': {'user_dob': '1993-06-23'} # ... } -r = requests.post('https://secure.tutorcruncher.com/api/contractors/', json=data, headers=headers) +r = requests.post('https://secure.tutorcruncher.com/api/contractors//', json=data, headers=headers) pprint.pprint(r.json()) diff --git a/pages/custom-fields/custom-fields.md b/pages/custom-fields/custom-fields.md index d5312da..4dac1d5 100644 --- a/pages/custom-fields/custom-fields.md +++ b/pages/custom-fields/custom-fields.md @@ -5,7 +5,7 @@ These custom fields are stored in array called `extra_attrs`, you can see the sh However, to update a custom field you must not post this whole array. Instead, you should assign `extra_attrs` with an object with keys equal to custom field machine names and values equal to the new values. For example a valid payload would be: -`'extra_attrs': {'custom_field_machine_name_1': 'value_1', 'custom_field_machine_name_2': 'value_2'},` +`'extra_attrs': [{'custom_field_machine_name_1': 'value_1', 'custom_field_machine_name_2': 'value_2'},]` You can find the machine name of a custom field by clicking on it in your [custom field settings](https://secure.tutorcruncher.com/setup/attrs/). See [creating a client](#3-create-a-client) diff --git a/pages/recipients/create-a-recipient.json b/pages/recipients/create-a-recipient.json index f4fc1cc..eddf8e7 100644 --- a/pages/recipients/create-a-recipient.json +++ b/pages/recipients/create-a-recipient.json @@ -1,46 +1,40 @@ { - "status": "success", - "role": { - "id": 4, - "user": { - "title": null, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "mobile": null, - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null - }, - "default_rate": null, - "paying_client": { - "id": 3, - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/clients/3/" - }, - "associated_clients": [], - "academic_year": 1, - "last_updated": "2019-11-24T16:11:48.312507Z", - "calendar_colour": "Khaki", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "user-dob", - "name": "Date of birth" - } - ] - - } + "id": 4, + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null, + "default_rate": null, + "paying_client": { + "id": 3, + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/clients/3/" + }, + "associated_clients": [], + "academic_year": 1, + "last_updated": "2019-11-24T16:11:48.312507Z", + "calendar_colour": "Khaki", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] } diff --git a/pages/recipients/create-a-recipient.py b/pages/recipients/create-a-recipient.py index 580dc0f..b0a9e93 100644 --- a/pages/recipients/create-a-recipient.py +++ b/pages/recipients/create-a-recipient.py @@ -2,21 +2,17 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'first_name': 'Billy', - 'last_name': 'Bob', - 'email': 'billy_bob@example.com', - 'mobile': '07123456789', - 'phone': '02081234567', - 'street': '177 South Lambeth Road', - 'state': None, - 'town': 'London', - 'country': 183, - 'postcode': 'SW8 1XP', - 'latitude': '51.5549', - 'longitude': '-0.1084', - 'timezone': 'Europe/London', - }, + 'first_name': 'Billy', + 'last_name': 'Bob', + 'email': 'billy_bob@example.com', + 'mobile': '07123456789', + 'phone': '02081234567', + 'street': '177 South Lambeth Road', + 'state': None, + 'town': 'London', + 'country': 183, + 'postcode': 'SW8 1XP', + 'timezone': 'Europe/London', 'default_rate': 80.0, 'paying_client': 838, 'calendar_colour': 'LimeGreen', diff --git a/pages/recipients/delete-a-recipient.json b/pages/recipients/delete-a-recipient.json new file mode 100644 index 0000000..a0344f5 --- /dev/null +++ b/pages/recipients/delete-a-recipient.json @@ -0,0 +1 @@ +{"message": "Successfully deleted role 4: Arthur Hoskins"} \ No newline at end of file diff --git a/pages/recipients/delete-a-recipient.md b/pages/recipients/delete-a-recipient.md new file mode 100644 index 0000000..222e06c --- /dev/null +++ b/pages/recipients/delete-a-recipient.md @@ -0,0 +1,4 @@ +### Delete an Recipient + +Deletes an existing Recipient. You only need to specify the unique +`id` of the Recipient to get the correct details. This will put the agent in the trash but will not permanently delete them. diff --git a/pages/recipients/delete-a-recipient.py b/pages/recipients/delete-a-recipient.py new file mode 100644 index 0000000..82161cc --- /dev/null +++ b/pages/recipients/delete-a-recipient.py @@ -0,0 +1,5 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +r = requests.delete('https://secure.tutorcruncher.com/api/recipients/', headers=headers) +pprint.pprint(r.json()) diff --git a/pages/recipients/get-a-recipient.json b/pages/recipients/get-a-recipient.json index af7d15e..8de7e74 100644 --- a/pages/recipients/get-a-recipient.json +++ b/pages/recipients/get-a-recipient.json @@ -1,22 +1,20 @@ { "id": 4, - "user": { - "title": null, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "mobile": null, - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null - }, + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null, "default_rate": null, "paying_client": { "id": 3, diff --git a/pages/recipients/label-add-to-a-recipient.json b/pages/recipients/label-add-to-a-recipient.json index af7d15e..8de7e74 100644 --- a/pages/recipients/label-add-to-a-recipient.json +++ b/pages/recipients/label-add-to-a-recipient.json @@ -1,22 +1,20 @@ { "id": 4, - "user": { - "title": null, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "mobile": null, - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null - }, + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null, "default_rate": null, "paying_client": { "id": 3, diff --git a/pages/recipients/label-remove-from-a-recipient.json b/pages/recipients/label-remove-from-a-recipient.json index 6a7cfc3..982911e 100644 --- a/pages/recipients/label-remove-from-a-recipient.json +++ b/pages/recipients/label-remove-from-a-recipient.json @@ -1,22 +1,20 @@ { "id": 4, - "user": { - "title": null, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "mobile": null, - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null - }, + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null, "default_rate": null, "paying_client": { "id": 3, diff --git a/pages/recipients/recipient-object-v1.json b/pages/recipients/recipient-object-v1.json new file mode 100644 index 0000000..19b6084 --- /dev/null +++ b/pages/recipients/recipient-object-v1.json @@ -0,0 +1,32 @@ +{ + "id": 4, + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null, + "default_rate": null, + "paying_client": { + "id": 3, + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/clients/3/" + }, + "associated_clients": [], + "academic_year": null, + "last_updated": "2019-11-24T16:11:48.312507Z", + "calendar_colour": "Khaki", + "labels": [], + "extra_attrs": [] +} diff --git a/pages/recipients/recipient-object-v1.md b/pages/recipients/recipient-object-v1.md new file mode 100644 index 0000000..f903ba4 --- /dev/null +++ b/pages/recipients/recipient-object-v1.md @@ -0,0 +1,4 @@ +### Recipient Object (Version 1 - Will be deprecated 3rd July 2025) + +Recipient objects contain the information of your Student including the `paying_client` which +is responsible for paying for the Student's Appointments and other charges. diff --git a/pages/recipients/recipient-object.yml b/pages/recipients/recipient-object-v1.yml similarity index 100% rename from pages/recipients/recipient-object.yml rename to pages/recipients/recipient-object-v1.yml diff --git a/pages/recipients/recipient-object-v2.json b/pages/recipients/recipient-object-v2.json new file mode 100644 index 0000000..1926cce --- /dev/null +++ b/pages/recipients/recipient-object-v2.json @@ -0,0 +1,32 @@ +{ + "id": 4, + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null + "default_rate": null, + "paying_client": { + "id": 3, + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/clients/3/" + }, + "associated_clients": [], + "academic_year": null, + "last_updated": "2019-11-24T16:11:48.312507Z", + "calendar_colour": "Khaki", + "labels": [], + "extra_attrs": [] +} diff --git a/pages/recipients/recipient-object.md b/pages/recipients/recipient-object-v2.md similarity index 83% rename from pages/recipients/recipient-object.md rename to pages/recipients/recipient-object-v2.md index 2ca4918..791bed2 100644 --- a/pages/recipients/recipient-object.md +++ b/pages/recipients/recipient-object-v2.md @@ -1,4 +1,4 @@ -### Recipient Object +### Recipient Object (Version 2) Recipient objects contain the information of your Student including the `paying_client` which is responsible for paying for the Student's Appointments and other charges. diff --git a/pages/recipients/recipient-object-v2.yml b/pages/recipients/recipient-object-v2.yml new file mode 100644 index 0000000..56589e9 --- /dev/null +++ b/pages/recipients/recipient-object-v2.yml @@ -0,0 +1,186 @@ +attributes: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: The user's first name. + - + name: last_name + type: string + description: The user's last name. + - + name: email + type: string + description: The user's email address. + - + name: mobile + type: string + description: The user's mobile number. + - + name: phone + type: string + description: The user's phone number. + - + name: street + type: string + description: The user's street address. + - + name: state + type: string + description: This field is only needed for US users. This value will use the state's 2-letter code. + - + name: town + type: string + description: The user's town on address. + - + name: country + type: integer + description: | + User's country, value is an `id` of the country stored in TutorCruncher. These country ids can be found + by doing an options request at this endpoints base URL. + - + name: postcode + type: string + description: The user's postcode on address. + - + name: latitude + type: decimal + description: The user's addresses latitude. + - + name: longitude + type: decimal + description: The user's addresses longitude. + - + name: date_created + type: string + description: The date and time the user was created. + - + name: timezone + type: string + description: The user's timezone, accepted values are timezone database values. + - + name: default_rate + type: decimal + description: The Recipient's default rate. + - + name: paying_client + type: object + description: An object of the Client who pays invoice on behalf of the Recipient. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: User's first name. + - + name: last_name + type: string + description: User's last name. + - + name: email + type: string + description: User's email address. + - + name: url + type: string + description: URL to the Agent's object. + - + name: associated_clients + type: array + description: An array of other Clients associated to this Recipient. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: first_name + type: string + description: User's first name. + - + name: last_name + type: string + description: User's last name. + - + name: email + type: string + description: User's email address. + - + name: url + type: string + description: URL to the Agent's object. + - + name: academic_year + type: string + description: Name of the academic year the Recipient is in. + - + name: last_updated + type: string + description: The date and time the Agent was last updated. + - + name: calendar_colour + type: string + description: Use hex values, like `#fff000`, or use CSS Named colours. + - + name: labels + type: array + description: An array of the Agent's labels. + children: + - + name: id + type: integer + description: Unique identifier for the object. + - + name: name + type: string + description: Name of the label. + - + name: machine_name + type: string + description: Unique slugified name of the label. + - + name: extra_attrs + type: array + description: | + Custom fields for this object. + + Updated with payload shape: `'extra_attrs': {'custom_field_machine_name_1': 'value_1', 'custom_field_machine_name_2': 'value_2'}` +filters: + - + name: user__created__gte + type: string + description: Filter by the date and time the Recipient was created. + - + name: user__created__lte + type: string + description: Filter by the date and time the Recipient was created. + - + name: user__first_name + type: string + description: Filter by the Recipient's first name. + - + name: user__last_name + type: string + description: Filter by the Recipient's last name. + - + name: user__email + type: string + description: Filter by the Recipient's email address. + - + name: distance_address + type: string + description: Filter by the address. + - + name: distance_radius + type: integer + description: Filter by the radius of the address. This is used in conjunction with the `address` filter. + - + name: labels + type: integer + description: Filter by the Recipient's labels (id). diff --git a/pages/recipients/recipient-object.json b/pages/recipients/recipient-object.json deleted file mode 100644 index 859c413..0000000 --- a/pages/recipients/recipient-object.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "id": 4, - "user": { - "title": null, - "first_name": "Arthur", - "last_name": "Hoskins", - "email": "arthur_hoskins@example.com", - "mobile": null, - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null - }, - "default_rate": null, - "paying_client": { - "id": 3, - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/clients/3/" - }, - "associated_clients": [], - "academic_year": null, - "last_updated": "2019-11-24T16:11:48.312507Z", - "calendar_colour": "Khaki", - "labels": [], - "extra_attrs": [] -} diff --git a/pages/recipients/recipients.yml b/pages/recipients/recipients.yml index df022fb..9e07273 100644 --- a/pages/recipients/recipients.yml +++ b/pages/recipients/recipients.yml @@ -1,10 +1,17 @@ sections: - - title: Recipient Object - id: recipient-object - description: /recipients/recipient-object.md - attributes: /recipients/recipient-object.yml - response: /recipients/recipient-object.json + title: Recipient Object (Version 1) + id: recipient-object-v1 + description: /recipients/recipient-object-v1.md + attributes: /recipients/recipient-object-v1.yml + response: /recipients/recipient-object-v1.json + response_title: OBJECT + - + title: Recipient Object (Version 2) + id: recipient-object-v2 + description: /recipients/recipient-object-v2.md + attributes: /recipients/recipient-object-v2.yml + response: /recipients/recipient-object-v2.json response_title: OBJECT - title: List all Recipients diff --git a/pages/recipients/update-a-recipient.json b/pages/recipients/update-a-recipient.json index 133e3aa..18100c0 100644 --- a/pages/recipients/update-a-recipient.json +++ b/pages/recipients/update-a-recipient.json @@ -1,46 +1,40 @@ { - "status": "success", - "role": { - "id": 4, - "user": { - "title": null, - "first_name": "Arthur", - "last_name": "Bob2", - "email": "billy_bob@example.com", - "mobile": null, - "phone": null, - "street": "12 Helmet Row", - "state": null, - "town": "London", - "country": "United Kingdom (GB)", - "postcode": "EC1V 3QJ", - "latitude": "51.5249280000000027", - "longitude": "-0.0944689940000000", - "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null - }, - "default_rate": null, - "paying_client": { - "id": 3, - "first_name": "Jamie", - "last_name": "Hoskins", - "email": "jamie_hoskins@example.com", - "url": "https://secure.tutorcruncher.com/api/clients/3/" - }, - "associated_clients": [], - "academic_year": null, - "last_updated": "2019-11-24T16:11:48.312507Z", - "calendar_colour": "Khaki", - "labels": [], - "extra_attrs": [ - { - "id": 1, - "value": "1993-06-23", - "type": "Date", - "machine_name": "user-dob", - "name": "Date of birth" - } - ] - - } + "id": 4, + "title": null, + "first_name": "Arthur", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null, + "default_rate": null, + "paying_client": { + "id": 3, + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/clients/3/" + }, + "associated_clients": [], + "academic_year": null, + "last_updated": "2019-11-24T16:11:48.312507Z", + "calendar_colour": "Khaki", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] } diff --git a/pages/recipients/update-a-recipient.md b/pages/recipients/update-a-recipient.md index b4e8008..ea35b1e 100644 --- a/pages/recipients/update-a-recipient.md +++ b/pages/recipients/update-a-recipient.md @@ -1,11 +1,7 @@ ### Update a Recipient -Update a Recipient object by supplying the email address as the unique identifier. You must also supply the required -fields like `last_name` even if they are not being updated. You only need to post information that you want to change -and not the whole Recipient object. - -If the Recipient doesn't have an email address, if you supply a `first_name`, `last_name` and `paying_client`, -we will update a Recipient if the names match an existing Recipient linked to the Client ID you supply -for `paying_client`. +Update an Recipient object by supplying the ID as the unique identifier in the url. You must also supply required fields +like `last_name` even if they are not being updated. You only need to post information that you want to change and +not the whole Recipient object. Check out [Creating/Updating Users](#creating-updating-users) for more information on linking to a specific user. diff --git a/pages/recipients/update-a-recipient.py b/pages/recipients/update-a-recipient.py index 257f125..e881fcc 100644 --- a/pages/recipients/update-a-recipient.py +++ b/pages/recipients/update-a-recipient.py @@ -2,13 +2,11 @@ headers = {'Authorization': 'token '} data = { - 'user': { - 'email': 'billy_bob@example.com', - 'last_name': 'Bob2', - # ... - }, + 'email': 'billy_bob@example.com', + 'last_name': 'Bob2', + # ... 'extra_attrs': {'user_dob': '1993-06-23'}, # ... } -r = requests.post('https://secure.tutorcruncher.com/api/recipients/', json=data, headers=headers) +r = requests.post('https://secure.tutorcruncher.com/api/recipients//', json=data, headers=headers) pprint.pprint(r.json()) diff --git a/pages/versioning/versioning.md b/pages/versioning/versioning.md new file mode 100644 index 0000000..abd80d1 --- /dev/null +++ b/pages/versioning/versioning.md @@ -0,0 +1,25 @@ +Version 2 of the Roles API is on its way. The changes are mostly in the backend and to improve speed and set us up for better developments going forward. +We will be removing Version 1 of the Roles API on the 3rd July 2025 so please update your API integrations as needed before then. +While the changes will be very small for you, we recommend that you adapt your system to handle both Version 1 and Version 2 +simultaneously to allow you to have a smooth transition. + +The core change that affects your endpoints is that we have removed the usage of the 'user' dictionary for roles. You will +see in each of the Roles that there is now two versions and each displays the difference in usage. Note that when sending +data in a request to TutorCruncher you will still be able to use the 'user' dictionary in Version 2 as it was used in Version 1 +but the data we return will be dependent on the version set on your Branch. See difference -> + +### Other changes include: +* Version 2 allows you to update the role by ID now instead of email or name by posting to the endpoint for that specific role. e.g. to update the Client with ID 1234 I can use post to `secure.tutorcruncher.com/api/clients/1234/` with a dictionary of data to update that client and its related user data. +* Version 2 will not match on a users first and last name. +* In Version 1 you could update a role by posting to the list page e.g. `secure.tutorcruncher.com/api/clients/` and update a role based on the email passed. In Version 2 this will return an error as it is expecting to create a user with that email. +* In both Versions, if I have a client with the email `example@example.com` and I post to the list page for contractors with the same email then it will create a new contractor role that is linked to the existing client. +* We no longer send emails about failed requests, the errors are returned when the request fails and should be handled then. + +### Recommendations for using Version 2: +* Retrieve: Use a GET request to the detail page for an individual role (e.g. `secure.tutorcruncher.com/api/clients//`) +* Create: Use a POST request to the list page for each role (e.g. `secure.tutorcruncher.com/api/clients/`) +* Update: Use a POST request to the detail page for an individual role (e.g. `secure.tutorcruncher.com/api/clients//`) +* Delete: Use a DELETE request to the detail page for an individual role (e.g. `secure.tutorcruncher.com/api/clients//`) + +Note that the rest of the docs have been updated to reflect Version 2 usage. While you can still use Version 1 until the 3rd July 2025 +we recommend that your refrain from doing so and update your integrations to use Version 2 as soon as possible. \ No newline at end of file diff --git a/pages/versioning/versioning.py b/pages/versioning/versioning.py new file mode 100644 index 0000000..9bd8775 --- /dev/null +++ b/pages/versioning/versioning.py @@ -0,0 +1,53 @@ +# Version 1: +{ + "id": 65, + "user": { + "title": null, + "first_name": "Billy", + "last_name": "Holiday", + "email": "billy_holiday@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London" + }, + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [] +} + +# Version 2: +{ + "id": 65, + "title": null, + "first_name": "Billy", + "last_name": "Holiday", + "email": "billy_holiday@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London", + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [] +} diff --git a/pages/versioning/versioning.yml b/pages/versioning/versioning.yml new file mode 100644 index 0000000..8275a71 --- /dev/null +++ b/pages/versioning/versioning.yml @@ -0,0 +1,5 @@ +sections: + - + description: /versioning/versioning.md + code: /versioning/versioning.py + code_type: VERSIONING diff --git a/pages/webhooks/webhook-object.json b/pages/webhooks/webhook-object.json index 140427c..1e81257 100644 --- a/pages/webhooks/webhook-object.json +++ b/pages/webhooks/webhook-object.json @@ -33,7 +33,6 @@ "timezone": null }, "status": "pending", - "charge_via_branch": false, "default_rate": null, "qualifications": [], "skills": [