Sha256: ee9965589749f2ccee3ca0865b7f9f34057a056bea82f907ba2bc74dc500bca5

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

# States

## List States

```shell
curl "https://example.com/api/v2/states"
```

```json
{
  "data": [
    {
      "id": "1",
      "type": "spree_states",
      "attributes": {
        "name": "Canillo",
        "abbr": "02"
      },
      "relationships": {
        "country": {
          "data": {
            "type": "spree_countries",
            "id": "1"
          }
        }
      }
    }
  ]
}
```

This will list all of the states.

## Show State

```shell
curl "https://example.com/api/v2/states/1"
```

```json
{
  "data": {
    "id": "1",
    "type": "spree_states",
    "attributes": {
      "name": "Canillo",
      "abbr": "02"
    },
    "relationships": {
      "country": {
        "data": {
          "type": "spree_countries",
          "id": "1"
        }
      }
    }
  }
}
```

Select a state via its `id`.

## Show Country of a States

```shell
curl "https://example.com/api/v2/states/1/countries"
```

```json
{
  "data": {
    "id": "1",
    "type": "spree_countries",
    "attributes": {
      "iso_name": "ANDORRA",
      "iso": "AD",
      "iso3": "AND",
      "name": "Andorra",
      "numcode": 20,
      "states_required": true
    },
    "relationships": {
      "states": {
        "data": [
          {
            "type": "spree_states",
            "id": "1"
          }
        ]
      }
    }
  }
}
```

View the country that a state belongs to via the state's `id`.

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 docs/source/includes/_states.md
solidus_json_api-0.3.0 docs/source/includes/_states.md
spree_api_v2-0.2.2 docs/source/includes/_states.md
solidus_api_v2-0.2.2 docs/source/includes/_states.md