APIExtensionsDeveloperUserReleasesDemoSupport
  • V 1

    • Summary
    • Address
    • Checkouts
    • Countries
    • Customer Returns
    • Line Items
    • Option Types
    • Option Values
    • Orders
    • Payments
    • Product Images
    • Product Properties
    • Products
    • Return Authorizations
    • Shipments
    • States
    • Stock Items
    • Stock Locations
    • Stock Movements
    • Taxonomies
    • Users
    • Variants
    • Zones

Table Of Contents

IndexResponseShowResponse

States

Index

To get a list of states within Spree, make a request like this:

GET /api/v1/states

States are paginated and can be iterated through by passing along a page parameter:

GET /api/v1/states?page=2

As well as a per_page parameter to control how many results will be returned:

GET /api/v1/states?per_page=100

You can scope the states by country by passing along a country_id parameter too:

GET /api/v1/states?country_id=1

Response

Status:
200 OK
{
"states": [
{
"id": 1,
"name": "New York",
"abbr": "NY",
"country_id": 1
}
],
"count": 25,
"pages": 5,
"current_page": 1
}

Show

To find out about a single state, make a request like this:

GET /api/v1/states/1

Response

Status:
200 OK
{
"id": 1,
"name": "New York",
"abbr": "NY",
"country_id": 1
}
Propose changes to this page
Maintained bySpree Commerce & Ruby on Rails developers© Spree Commerce. 2021 All Rights Reserved.