From 76d5a7545ca58cef19c0051be57dd381fa30d118 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Tue, 8 Apr 2025 17:39:45 +0100 Subject: [PATCH 1/7] added docs for photo add delete --- pages/creating-updating-users/creating-updating-users.md | 3 +++ pages/creating-updating-users/creating-updating-users.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/creating-updating-users/creating-updating-users.md b/pages/creating-updating-users/creating-updating-users.md index 81e18cf..e22819e 100644 --- a/pages/creating-updating-users/creating-updating-users.md +++ b/pages/creating-updating-users/creating-updating-users.md @@ -6,3 +6,6 @@ You can create a user without an email address, however, you will not be able to include the users last name when creating/updating as this field is required. Any other role specific required fields are specified on the endpoint description. +Profile photos can optionally be added for all user roles — [Agents](#agents), [Clients](#clients), [Contractors](#contractors), and [Recipients](#recipients) during creation — by providing a `photo` field with a valid image URL when creating or updating a user. If the URL points to a valid and accessible image, it will be downloaded and processed into thumbnails, and the response will include the processed photo URL. If the image is invalid, corrupted, or the URL is inaccessible, the request will fail with a `400 Bad Request` and an appropriate error message. + +You can also update the photo for all user roles by providing a new image URL in the `photo` field when making an update request to the relevant role’s endpoint (e.g., updating via the [Client](#clients), [Contractor](#contractors), [Agent](#agents), or [Recipient](#recipients) update endpoint). If the image is valid and accessible, it will be processed and replace any existing photo. If the `photo` field is omitted, the current photo remains unchanged. To remove an existing photo, set the `photo` field to `null`. Invalid or inaccessible image URLs will result in a `400 Bad Request` response with a relevant error message. diff --git a/pages/creating-updating-users/creating-updating-users.py b/pages/creating-updating-users/creating-updating-users.py index 3852b27..687e6e4 100644 --- a/pages/creating-updating-users/creating-updating-users.py +++ b/pages/creating-updating-users/creating-updating-users.py @@ -4,7 +4,8 @@ data = { 'user': { 'email': 'billy_bob@example.com', - 'last_name': 'Bob' + 'last_name': 'Bob', + 'photo': 'https://picsum.photos/200/300' # ... }, # ... From 5ea1cfa540ebfcecd1cd7a4ec8b32897197fce59 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Wed, 9 Apr 2025 23:45:33 +0100 Subject: [PATCH 2/7] dan comments --- pages/agents/agent-object-v2.json | 3 ++- pages/agents/agent-object-v2.md | 2 +- pages/agents/agent-object-v2.yml | 4 ++++ pages/clients/client-object-v2.json | 3 ++- pages/clients/client-object-v2.yml | 4 ++++ pages/contractors/contractor-object-v2.json | 1 + pages/contractors/contractor-object-v2.yml | 4 ++++ .../creating-updating-users.py | 15 ++++++++------- .../public-contractor-object.yml | 2 +- pages/recipients/recipient-object-v2.json | 3 ++- pages/recipients/recipient-object-v2.yml | 4 ++++ pages/roles_versioning/roles_versioning.md | 1 + 12 files changed, 34 insertions(+), 12 deletions(-) diff --git a/pages/agents/agent-object-v2.json b/pages/agents/agent-object-v2.json index 0f9bbca..62cceae 100644 --- a/pages/agents/agent-object-v2.json +++ b/pages/agents/agent-object-v2.json @@ -14,7 +14,8 @@ "latitude": "51.5373258999999990", "longitude": "-0.1496343000000000", "date_created": "2020-02-18T16:13:04.193340Z", - "timezone": "Europe/London" + "timezone": "Europe/London", + "photo": "https://secure.tutorcruncher.com/media/photo/65.jpg", "commission_rate": null, "clients": [], "last_updated": "2020-03-16T12:23:39.056867Z", diff --git a/pages/agents/agent-object-v2.md b/pages/agents/agent-object-v2.md index 31b019b..2dac936 100644 --- a/pages/agents/agent-object-v2.md +++ b/pages/agents/agent-object-v2.md @@ -1,4 +1,4 @@ ### Agent Object (Version 2) -Agent objects, Affiliates in TutorCruncher, includes basic user information including fields that are only linked to the Agent Role. +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 index 5641254..d31edd3 100644 --- a/pages/agents/agent-object-v2.yml +++ b/pages/agents/agent-object-v2.yml @@ -61,6 +61,10 @@ attributes: name: timezone type: string description: The user's timezone, accepted values are timezone database values. + - + name: photo + type: string + description: The URL to the user's photo. - name: commission_rate type: string diff --git a/pages/clients/client-object-v2.json b/pages/clients/client-object-v2.json index 1412bc2..376634e 100644 --- a/pages/clients/client-object-v2.json +++ b/pages/clients/client-object-v2.json @@ -14,7 +14,8 @@ "latitude": "51.5249280000000027", "longitude": "-0.0944689940000000", "date_created": "2020-01-01T12:00:00.000000Z", - "timezone": null + "timezone": null, + "photo": "https://secure.tutorcruncher.com/media/photo/44bc4e56.jpg", "status": "live", "is_taxable": true, "received_notifications": [ diff --git a/pages/clients/client-object-v2.yml b/pages/clients/client-object-v2.yml index f24d813..10beeef 100644 --- a/pages/clients/client-object-v2.yml +++ b/pages/clients/client-object-v2.yml @@ -61,6 +61,10 @@ attributes: name: timezone type: string description: The user's timezone, accepted values are timezone database values. + - + name: photo + type: string + description: The URL to the user's photo. - name: status type: string diff --git a/pages/contractors/contractor-object-v2.json b/pages/contractors/contractor-object-v2.json index 736387d..63f4806 100644 --- a/pages/contractors/contractor-object-v2.json +++ b/pages/contractors/contractor-object-v2.json @@ -15,6 +15,7 @@ "longitude": "-0.1370000000000005", "date_created": "2018-11-22T09:23:55.297608Z", "timezone": null, + "photo": "https://secure.tutorcruncher.com/media/photo/44bc4e56.jpg", "status": "approved", "default_rate": null, "qualifications": [], diff --git a/pages/contractors/contractor-object-v2.yml b/pages/contractors/contractor-object-v2.yml index 03510ff..3e4868b 100644 --- a/pages/contractors/contractor-object-v2.yml +++ b/pages/contractors/contractor-object-v2.yml @@ -61,6 +61,10 @@ attributes: name: timezone type: string description: The user's timezone, accepted values are timezone database values. + - + name: photo + type: string + description: The URL to the user's photo. - name: status type: string diff --git a/pages/creating-updating-users/creating-updating-users.py b/pages/creating-updating-users/creating-updating-users.py index 687e6e4..f018949 100644 --- a/pages/creating-updating-users/creating-updating-users.py +++ b/pages/creating-updating-users/creating-updating-users.py @@ -1,13 +1,14 @@ import requests headers = {'Authorization': 'token '} + data = { - 'user': { - 'email': 'billy_bob@example.com', - 'last_name': 'Bob', - 'photo': 'https://picsum.photos/200/300' - # ... - }, - # ... + "id": 568433, + "email": "billy_bob@example.com", + "last_name": "Bob", + "mobile": "07842 485 204", + "photo": "https://photo_url.com/200/300" + # ... } + requests.post('...', json=data, headers=headers) diff --git a/pages/public-contractors/public-contractor-object.yml b/pages/public-contractors/public-contractor-object.yml index c2ff89e..fa727ae 100644 --- a/pages/public-contractors/public-contractor-object.yml +++ b/pages/public-contractors/public-contractor-object.yml @@ -47,7 +47,7 @@ attributes: - name: photo type: string - description: URL to access the Contractor's profile photo. + description: URL to access the user's profile photo. - name: extra_attributes type: array diff --git a/pages/recipients/recipient-object-v2.json b/pages/recipients/recipient-object-v2.json index 1926cce..accfc68 100644 --- a/pages/recipients/recipient-object-v2.json +++ b/pages/recipients/recipient-object-v2.json @@ -14,7 +14,8 @@ "latitude": "51.5249280000000027", "longitude": "-0.0944689940000000", "date_created": "2019-11-24T16:11:48.312507Z", - "timezone": null + "timezone": null, + "photo": "https://secure.tutorcruncher.com/media/photo/44bc4e56.jpg", "default_rate": null, "paying_client": { "id": 3, diff --git a/pages/recipients/recipient-object-v2.yml b/pages/recipients/recipient-object-v2.yml index 56589e9..c1cd708 100644 --- a/pages/recipients/recipient-object-v2.yml +++ b/pages/recipients/recipient-object-v2.yml @@ -61,6 +61,10 @@ attributes: name: timezone type: string description: The user's timezone, accepted values are timezone database values. + - + name: photo + type: string + description: The URL to the user's photo. - name: default_rate type: decimal diff --git a/pages/roles_versioning/roles_versioning.md b/pages/roles_versioning/roles_versioning.md index 13e4373..e6a434d 100644 --- a/pages/roles_versioning/roles_versioning.md +++ b/pages/roles_versioning/roles_versioning.md @@ -28,6 +28,7 @@ but the data we return will be dependent on the version set on your Branch. See ### 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. +* Version 2 contains a new field `photo` for all roles containing a URL to the photo of the user. You can update a user's photo by sending a URL to the `photo` field in the request. For more info checkout the [Creating/Updating User](#creating-updating-users) section. * 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. From 2b3673500a6aca8cfb51c6e4d47caceb05c0fe9d Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 10 Apr 2025 09:18:52 +0100 Subject: [PATCH 3/7] last commit didtn go wlel --- pages/creating-updating-users/creating-updating-users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/creating-updating-users/creating-updating-users.py b/pages/creating-updating-users/creating-updating-users.py index f018949..553dd10 100644 --- a/pages/creating-updating-users/creating-updating-users.py +++ b/pages/creating-updating-users/creating-updating-users.py @@ -8,7 +8,7 @@ "last_name": "Bob", "mobile": "07842 485 204", "photo": "https://photo_url.com/200/300" - # ... + #... } requests.post('...', json=data, headers=headers) From 45c822838b15a768c967d1f1cced6f4155089e8c Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 10 Apr 2025 12:12:15 +0100 Subject: [PATCH 4/7] dan comments --- pages/agents/agent-object-v2.yml | 2 +- pages/clients/client-object-v2.yml | 2 +- pages/contractors/contractor-object-v2.yml | 2 +- pages/recipients/recipient-object-v2.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/agents/agent-object-v2.yml b/pages/agents/agent-object-v2.yml index d31edd3..fe78a65 100644 --- a/pages/agents/agent-object-v2.yml +++ b/pages/agents/agent-object-v2.yml @@ -64,7 +64,7 @@ attributes: - name: photo type: string - description: The URL to the user's photo. + description: The URL to the Agent's photo. - name: commission_rate type: string diff --git a/pages/clients/client-object-v2.yml b/pages/clients/client-object-v2.yml index 10beeef..2c18ead 100644 --- a/pages/clients/client-object-v2.yml +++ b/pages/clients/client-object-v2.yml @@ -64,7 +64,7 @@ attributes: - name: photo type: string - description: The URL to the user's photo. + description: The URL to the Client's photo. - name: status type: string diff --git a/pages/contractors/contractor-object-v2.yml b/pages/contractors/contractor-object-v2.yml index 3e4868b..688871a 100644 --- a/pages/contractors/contractor-object-v2.yml +++ b/pages/contractors/contractor-object-v2.yml @@ -64,7 +64,7 @@ attributes: - name: photo type: string - description: The URL to the user's photo. + description: The URL to the Contractor's photo. - name: status type: string diff --git a/pages/recipients/recipient-object-v2.yml b/pages/recipients/recipient-object-v2.yml index c1cd708..f3922d2 100644 --- a/pages/recipients/recipient-object-v2.yml +++ b/pages/recipients/recipient-object-v2.yml @@ -64,7 +64,7 @@ attributes: - name: photo type: string - description: The URL to the user's photo. + description: The URL to the Recipient's photo. - name: default_rate type: decimal From 4274694d6a27138ed73f1c200fb2a9039ef879ce Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 10 Apr 2025 16:05:40 +0100 Subject: [PATCH 5/7] added photo to webhook object --- pages/webhooks/webhook-object.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pages/webhooks/webhook-object.json b/pages/webhooks/webhook-object.json index 954e923..07edd67 100644 --- a/pages/webhooks/webhook-object.json +++ b/pages/webhooks/webhook-object.json @@ -47,8 +47,9 @@ "country": null, "postcode": null, "timezone": null, - "title": null + "title": null, + "photo": "https://secure.tutorcruncher.com/media/photo/65.jpg" } } ] -} \ No newline at end of file +} From deb74dcf4307dfec6a22fbea94504550dfe4edf5 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 10 Apr 2025 16:19:57 +0100 Subject: [PATCH 6/7] henrys comment --- pages/public-contractors/public-contractor-object.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/public-contractors/public-contractor-object.yml b/pages/public-contractors/public-contractor-object.yml index fa727ae..c2ff89e 100644 --- a/pages/public-contractors/public-contractor-object.yml +++ b/pages/public-contractors/public-contractor-object.yml @@ -47,7 +47,7 @@ attributes: - name: photo type: string - description: URL to access the user's profile photo. + description: URL to access the Contractor's profile photo. - name: extra_attributes type: array From 07a3727a73c276e4f2fc84a129ef4589f053a4e7 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Thu, 10 Apr 2025 16:23:10 +0100 Subject: [PATCH 7/7] henrys comment about duplication --- pages/creating-updating-users/creating-updating-users.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pages/creating-updating-users/creating-updating-users.md b/pages/creating-updating-users/creating-updating-users.md index e22819e..be504fc 100644 --- a/pages/creating-updating-users/creating-updating-users.md +++ b/pages/creating-updating-users/creating-updating-users.md @@ -6,6 +6,4 @@ You can create a user without an email address, however, you will not be able to include the users last name when creating/updating as this field is required. Any other role specific required fields are specified on the endpoint description. -Profile photos can optionally be added for all user roles — [Agents](#agents), [Clients](#clients), [Contractors](#contractors), and [Recipients](#recipients) during creation — by providing a `photo` field with a valid image URL when creating or updating a user. If the URL points to a valid and accessible image, it will be downloaded and processed into thumbnails, and the response will include the processed photo URL. If the image is invalid, corrupted, or the URL is inaccessible, the request will fail with a `400 Bad Request` and an appropriate error message. - -You can also update the photo for all user roles by providing a new image URL in the `photo` field when making an update request to the relevant role’s endpoint (e.g., updating via the [Client](#clients), [Contractor](#contractors), [Agent](#agents), or [Recipient](#recipients) update endpoint). If the image is valid and accessible, it will be processed and replace any existing photo. If the `photo` field is omitted, the current photo remains unchanged. To remove an existing photo, set the `photo` field to `null`. Invalid or inaccessible image URLs will result in a `400 Bad Request` response with a relevant error message. +Profile photos can be optionally added or updated for all user roles — [Agents](#agents), [Clients](#clients), [Contractors](#contractors), and [Recipients](#recipients) — by including a `photo` field with a valid image URL when creating or updating a user. If the image is valid and accessible, it will be downloaded, processed into thumbnails, and included in the response. If the `photo` field is omitted during an update, the current photo remains unchanged. To remove an existing photo, set the `photo` field to `null`. Invalid, corrupted, or inaccessible image URLs will result in a `400 Bad Request` with an appropriate error message.