# Variations

Manage variations

## Get variations of the variation group

> Return the list of the variations of the variation group

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Variations","description":"Manage variations"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}},"variation_group_id":{"name":"variation_group_id","in":"path","description":"The ID of the variation group","required":true,"schema":{"type":"string"}},"_page":{"name":"_page","in":"query","description":"Index of the page","schema":{"type":"integer"}},"_max_per_page":{"name":"_max_per_page","in":"query","description":"Number of items per page","schema":{"type":"integer"}}},"schemas":{"ItemCollection":{"properties":{"current_item_count":{"description":"Returns the number of items in the current page","type":"integer","format":"int"},"current_page":{"description":"Returns the number of the current page","type":"integer","format":"int","default":0},"total_count":{"description":"Returns the number of total items","type":"integer","format":"int"},"items_per_page":{"title":"Items per page","description":"Returns the number of items per page","type":"integer","format":"int","default":10},"last_page":{"title":"Last page","description":"Returns the index of the page","type":"integer","format":"int"}},"type":"object"},"Variation":{"required":["name","allocation"],"properties":{"id":{"description":"ID of the variation","type":"string","readOnly":true},"name":{"description":"Name of the variation","type":"string"},"reference":{"description":"Wether the variation is the reference or not","type":"boolean"},"allocation":{"description":"Allocation of the variation (0-100)","type":"integer"},"modifications":{"$ref":"#/components/schemas/Modifications"}},"type":"object"},"Modifications":{"required":["type","value"],"properties":{"type":{"description":"Type of the modification","type":"string"},"value":{"description":"Value of the variation","type":"object"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/variation_groups/{variation_group_id}/variations":{"get":{"tags":["Variations"],"summary":"Get variations of the variation group","description":"Return the list of the variations of the variation group","operationId":"7bd5dfd478e6e9160083f6cc5a83c156","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"},{"$ref":"#/components/parameters/variation_group_id"},{"$ref":"#/components/parameters/_page"},{"$ref":"#/components/parameters/_max_per_page"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ItemCollection"},{"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Variation"}}},"type":"object"}]}}}},"404":{"description":"Not Found"}}}}}}
```

## Create a variation

> Create a variation

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Variations","description":"Manage variations"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}},"variation_group_id":{"name":"variation_group_id","in":"path","description":"The ID of the variation group","required":true,"schema":{"type":"string"}}},"schemas":{"Variation":{"required":["name","allocation"],"properties":{"id":{"description":"ID of the variation","type":"string","readOnly":true},"name":{"description":"Name of the variation","type":"string"},"reference":{"description":"Wether the variation is the reference or not","type":"boolean"},"allocation":{"description":"Allocation of the variation (0-100)","type":"integer"},"modifications":{"$ref":"#/components/schemas/Modifications"}},"type":"object"},"Modifications":{"required":["type","value"],"properties":{"type":{"description":"Type of the modification","type":"string"},"value":{"description":"Value of the variation","type":"object"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/variation_groups/{variation_group_id}/variations":{"post":{"tags":["Variations"],"summary":"Create a variation","description":"Create a variation","operationId":"f052ad34ef1e817660802140f0e9a8af","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"},{"$ref":"#/components/parameters/variation_group_id"}],"requestBody":{"description":"Informations of the variation","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variation"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variation"}}}},"400":{"description":"Validation errors"}}}}}}
```

## Get one variation

> Return one variation by its id

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Variations","description":"Manage variations"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}},"variation_group_id":{"name":"variation_group_id","in":"path","description":"The ID of the variation group","required":true,"schema":{"type":"string"}},"variation_id":{"name":"variation_id","in":"path","description":"The ID of the variation","required":true,"schema":{"type":"string"}}},"schemas":{"Variation":{"required":["name","allocation"],"properties":{"id":{"description":"ID of the variation","type":"string","readOnly":true},"name":{"description":"Name of the variation","type":"string"},"reference":{"description":"Wether the variation is the reference or not","type":"boolean"},"allocation":{"description":"Allocation of the variation (0-100)","type":"integer"},"modifications":{"$ref":"#/components/schemas/Modifications"}},"type":"object"},"Modifications":{"required":["type","value"],"properties":{"type":{"description":"Type of the modification","type":"string"},"value":{"description":"Value of the variation","type":"object"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/variation_groups/{variation_group_id}/variations/{variation_id}":{"get":{"tags":["Variations"],"summary":"Get one variation","description":"Return one variation by its id","operationId":"79e6c992d1a75245647ee741a9c61fc6","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"},{"$ref":"#/components/parameters/variation_group_id"},{"$ref":"#/components/parameters/variation_id"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variation"}}}},"404":{"description":"Not Found"}}}}}}
```

## Delete a variation

> Delete a variation by its id.

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Variations","description":"Manage variations"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}},"variation_group_id":{"name":"variation_group_id","in":"path","description":"The ID of the variation group","required":true,"schema":{"type":"string"}},"variation_id":{"name":"variation_id","in":"path","description":"The ID of the variation","required":true,"schema":{"type":"string"}}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/variation_groups/{variation_group_id}/variations/{variation_id}":{"delete":{"tags":["Variations"],"summary":"Delete a variation","description":"Delete a variation by its id.","operationId":"b6a54e3f308a61a9786a4156a3d390ae","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"},{"$ref":"#/components/parameters/variation_group_id"},{"$ref":"#/components/parameters/variation_id"}],"responses":{"204":{"description":"Deleted"},"404":{"description":"Not Found"}}}}}}
```

## Update a variation

> Update variation informations - You can set only the properies you want to update in the request body.

```json
{"openapi":"3.0.0","info":{"title":"Flagship - Remote Control API","version":"1.0"},"tags":[{"name":"Variations","description":"Manage variations"}],"servers":[{"url":"https://api.flagship.io/v1"}],"security":[{"token":[]}],"components":{"securitySchemes":{"token":{"type":"apiKey","description":"Prefix the token with 'Bearer ' to indicate it is a bearer token","name":"Authorization","in":"header"}},"parameters":{"account_id":{"name":"account_id","in":"path","description":"The ID of the account","required":true,"schema":{"type":"string"}},"account_environment_id":{"name":"account_environment_id","in":"path","description":"The ID of the environment","required":true,"schema":{"type":"string"}},"campaign_id":{"name":"campaign_id","in":"path","description":"The ID of the campaign","required":true,"schema":{"type":"string"}},"variation_group_id":{"name":"variation_group_id","in":"path","description":"The ID of the variation group","required":true,"schema":{"type":"string"}},"variation_id":{"name":"variation_id","in":"path","description":"The ID of the variation","required":true,"schema":{"type":"string"}}},"schemas":{"Variation":{"required":["name","allocation"],"properties":{"id":{"description":"ID of the variation","type":"string","readOnly":true},"name":{"description":"Name of the variation","type":"string"},"reference":{"description":"Wether the variation is the reference or not","type":"boolean"},"allocation":{"description":"Allocation of the variation (0-100)","type":"integer"},"modifications":{"$ref":"#/components/schemas/Modifications"}},"type":"object"},"Modifications":{"required":["type","value"],"properties":{"type":{"description":"Type of the modification","type":"string"},"value":{"description":"Value of the variation","type":"object"}},"type":"object"}}},"paths":{"/accounts/{account_id}/account_environments/{account_environment_id}/campaigns/{campaign_id}/variation_groups/{variation_group_id}/variations/{variation_id}":{"patch":{"tags":["Variations"],"summary":"Update a variation","description":"Update variation informations - You can set only the properies you want to update in the request body.","operationId":"ce18e2b90f668a60cd211d5cbcde0abc","parameters":[{"$ref":"#/components/parameters/account_id"},{"$ref":"#/components/parameters/account_environment_id"},{"$ref":"#/components/parameters/campaign_id"},{"$ref":"#/components/parameters/variation_group_id"},{"$ref":"#/components/parameters/variation_id"}],"requestBody":{"description":"Informations of the variation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variation"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variation"}}}},"400":{"description":"Validation errors"}}}}}}
```
