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

# POST /users/me/comparisons/{poll_name}

`POST /users/me/comparisons/{poll_name}`

Create a new comparison associated with the logged user, in a given
poll.

## Path parameters

- `poll_name` string, required

## Request body

- ComparisonRequest — A comparison serializer used for the operations create, retrieve and list. Given the context determined by the view, it will represent the comparison in the reverse order. Use `ComparisonUpdateSerializer` for the update operation.
  - `entity_a` RelatedEntityRequest, 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
  - `entity_b` RelatedEntityRequest, 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
  - `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`

- Comparison — A comparison serializer used for the operations create, retrieve and list. Given the context determined by the view, it will represent the comparison in the reverse order. Use `ComparisonUpdateSerializer` for the update operation.
  - `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
  - `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)

---

[API](https://skmtc.net/tournesol-app/apis/tournesol-api.md) · [All operations](https://skmtc.net/tournesol-app/apis/tournesol-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tournesol-app/tournesol-api/revisions/96c8c62ad972/schema)
