---
title: "PUT /users/me/comparisons/{poll_name}/{uid_a}/{uid_b}/"
method: PUT
path: "/users/me/comparisons/{poll_name}/{uid_a}/{uid_b}/"
tags: ["users"]
---

# PUT /users/me/comparisons/{poll_name}/{uid_a}/{uid_b}/

`PUT /users/me/comparisons/{poll_name}/{uid_a}/{uid_b}/`

## Request

- The document declares no server URL.
- Auth: OAuth 2
  - Password
  - Token URL: `http://127.0.0.1:8000/o/token/` scopes: `read write groups`

Update a comparison made by the logged user, in the given poll

## Path parameters

- `poll_name` string, required
- `uid_a` string, required
- `uid_b` string, required

## Request body

- ComparisonUpdateRequest: A comparison serializer used only for updates. Given the context determined by the view, it will represent or save the comparison in the reverse order. Use `ComparisonSerializer` for all other operations.
  - `criteria_scores` ComparisonCriteriaScoreRequest[], required
    - `criteria` string, required: Name of the criteria
    - `score` number, double, required: Score for the given comparison
    - `score_max` integer, required: The absolute value of the maximum score.
    - `weight` number, double: Weight of the comparison
  - `duration_ms` number, double, nullable: Time it took to rate the videos (in milliseconds)

## Response `200`

- ComparisonUpdate: A comparison serializer used only for updates. Given the context determined by the view, it will represent or save the comparison in the reverse order. Use `ComparisonSerializer` for all other operations.
  - `criteria_scores` ComparisonCriteriaScore[], required
    - `criteria` string, required: Name of the criteria
    - `score` number, double, required: Score for the given comparison
    - `score_max` integer, required: The absolute value of the maximum score.
    - `weight` number, double: Weight of the comparison
  - `duration_ms` number, double, nullable: Time it took to rate the videos (in milliseconds)
  - `entity_a` RelatedEntity, required: An Entity serializer that will lookup and possibly create the Entity object on validation, if it does not exist in the database yet. Only the field `uid` is provided when using write HTTP methods. Used by ModelSerializer(s) having one or more nested relations with Entity, and having the constraint to ensure that entity instances exist before they can be saved properly.
    - `uid` string, required
    - `type` 'video' | 'candidate_fr_2022', required: * `video` - Video * `candidate_fr_2022` - Candidate (FR 2022)
    - `metadata` object, required
  - `entity_b` RelatedEntity, required: An Entity serializer that will lookup and possibly create the Entity object on validation, if it does not exist in the database yet. Only the field `uid` is provided when using write HTTP methods. Used by ModelSerializer(s) having one or more nested relations with Entity, and having the constraint to ensure that entity instances exist before they can be saved properly.
    - `uid` string, required
    - `type` 'video' | 'candidate_fr_2022', required: * `video` - Video * `candidate_fr_2022` - Candidate (FR 2022)
    - `metadata` object, required
  - `entity_a_contexts` EntityContext[], required
    - `origin` 'ASSOCIATION' | 'CONTRIBUTORS': * `ASSOCIATION` - Association * `CONTRIBUTORS` - Contributors
    - `unsafe` boolean: If True, this context will make the targeted entities unsafe.
    - `text` string, required
    - `created_at` string, date-time, required
  - `entity_b_contexts` EntityContext[], required
    - `origin` 'ASSOCIATION' | 'CONTRIBUTORS': * `ASSOCIATION` - Association * `CONTRIBUTORS` - Contributors
    - `unsafe` boolean: If True, this context will make the targeted entities unsafe.
    - `text` string, required
    - `created_at` string, date-time, required

## Changes

- **2024-05-02** `250644b3d55e`: 3 breaking, 1 info
  - added the new required request property `criteria_scores/items/score_max` (media type: application/json)
  - added the new required request property `criteria_scores/items/score_max` (media type: application/x-www-form-urlencoded)
  - added the new required request property `criteria_scores/items/score_max` (media type: multipart/form-data)
  - added the required property `criteria_scores/items/score_max` to the response with the `200` status
- **2024-01-18** `c8dd025d9919`: 2 info
  - the `entity_a_contexts` response's property default value `` was added for the status `200`
  - the `entity_b_contexts` response's property default value `` was added for the status `200`
- **2024-01-04** `1ed44f2e2527`: 2 info
  - added the required property `entity_a_contexts` to the response with the `200` status
  - added the required property `entity_b_contexts` to the response with the `200` status
- **2023-04-13** `5598f38c96c6`: 3 breaking, 9 info
  - the `criteria_scores/items/score` response's property format changed from `float` to `double` for status `200`
  - the `criteria_scores/items/weight` response's property format changed from `float` to `double` for status `200`
  - the `duration_ms` response's property format changed from `float` to `double` for status `200`
  - the `criteria_scores/items/score` request property format was generalized from `float` to `double` (media type: application/json)
  - …8 more

[Operation history](https://skmtc.dev/tournesol-app/apis/tournesol-api/changes/users/me/comparisons/:poll_name/:uid_a/:uid_b/put.md)

---

[API](https://skmtc.dev/tournesol-app/apis/tournesol-api.md) - [All operations](https://skmtc.dev/tournesol-app/apis/tournesol-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tournesol-app/apis/tournesol-api/revisions/96c8c62ad972?raw)
