Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pages/agents/agent-object-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pages/agents/agent-object-v2.md
Original file line number Diff line number Diff line change
@@ -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`.
4 changes: 4 additions & 0 deletions pages/agents/agent-object-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pages/clients/client-object-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 4 additions & 0 deletions pages/clients/client-object-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pages/contractors/contractor-object-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down
4 changes: 4 additions & 0 deletions pages/contractors/contractor-object-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pages/creating-updating-users/creating-updating-users.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
14 changes: 8 additions & 6 deletions pages/creating-updating-users/creating-updating-users.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import requests

headers = {'Authorization': 'token <API KEY>'}

data = {
'user': {
'email': '[email protected]',
'last_name': 'Bob'
# ...
},
# ...
"id": 568433,
"email": "[email protected]",
"last_name": "Bob",
"mobile": "07842 485 204",
"photo": "https://photo_url.com/200/300"
#...
}

requests.post('...', json=data, headers=headers)
2 changes: 1 addition & 1 deletion pages/public-contractors/public-contractor-object.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? I think this should say contractor especially as we're moving to V2 of the API without the user stuff.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint is irrelevant afaik so just leave it as it was

-
name: extra_attributes
type: array
Expand Down
3 changes: 2 additions & 1 deletion pages/recipients/recipient-object-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions pages/recipients/recipient-object-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pages/roles_versioning/roles_versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `[email protected]` 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.
Expand Down