Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add API V1 namespace in API guides urls
  • Loading branch information
damianlegawiec committed Sep 16, 2016
1 parent 6758822 commit 94e456c
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 173 deletions.
4 changes: 2 additions & 2 deletions guides/content/api/addresses.md
Expand Up @@ -8,7 +8,7 @@ description: Use the Spree Commerce storefront API to access Address data.
Retrieve details about a particular address:

```text
GET /api/orders/1/addresses/1```
GET /api/v1/orders/1/addresses/1```

### Response

Expand All @@ -20,7 +20,7 @@ GET /api/orders/1/addresses/1```
To update an address, make a request like this:

```text
PUT /api/orders/1/addresses/1?address[firstname]=Ryan```
PUT /api/v1/orders/1/addresses/1?address[firstname]=Ryan```

This request will update the `firstname` field for an address to the value of \"Ryan\"

Expand Down
24 changes: 12 additions & 12 deletions guides/content/api/checkouts.md
Expand Up @@ -8,7 +8,7 @@ description: Use the Spree Commerce storefront API to access Checkout data.
## Introduction

The checkout API functionality can be used to advance an existing order's state.
Sending a `PUT` request to `/api/checkouts/:number` will advance an order's
Sending a `PUT` request to `/api/v1/checkouts/:number` will advance an order's
state or, failing that, report any errors.

The following sections will walk through creating a new order and advancing an order from its `cart` state to its `complete` state.
Expand All @@ -17,7 +17,7 @@ The following sections will walk through creating a new order and advancing an o

To create a new, empty order, make this request:

POST /api/orders.json
POST /api/v1/orders.json

### Response

Expand Down Expand Up @@ -87,7 +87,7 @@ Pass line item attributes like this:

to this api endpoint:

POST /api/orders/:number/line_items.json
POST /api/v1/orders/:number/line_items.json

<%= headers 201 %>
<pre class="highlight"><code class="language-javascript">{
Expand Down Expand Up @@ -162,19 +162,19 @@ to this api endpoint:

To update an order you must be authenticated as the order's user, and perform a request like this:

PUT /api/orders/:number.json
PUT /api/v1/orders/:number.json

If you know the order's token, then you can also update the order:

PUT /api/orders/:number.json?order_token=abcdef123456
PUT /api/v1/orders/:number.json?order_token=abcdef123456

Requests performed as a non-admin or non-authorized user will be met with a 401 response from this action.

## Address

To transition an order to its next step, make a request like this:

PUT /api/checkouts/:number/next.json
PUT /api/v1/checkouts/:number/next.json

If the request is successfull you'll get a 200 response using the same order
template shown when creating the order with the state updated. See example of
Expand All @@ -191,7 +191,7 @@ To advance to the next state, `delivery`, the order will first need both a shipp

In order to update the addresses, make this request with the necessary parameters:

PUT /api/checkouts/:number.json
PUT /api/v1/checkouts/:number.json

As an example, here are the required address attributes and how they should be formatted:

Expand Down Expand Up @@ -347,17 +347,17 @@ To advance to the next state, `payment`, you will need to select a shipping rate
for each shipment for the order. These were returned when transitioning to the
`delivery` step. If you need want to see them again, make the following request:

GET /api/orders/:number.json
GET /api/v1/orders/:number.json

Spree will select a shipping rate by default so you can advance to the `payment`
state by making this request:

PUT /api/checkouts/:number/next.json
PUT /api/v1/checkouts/:number/next.json

If the order doesn't have an assigned shipping rate, or you want to choose a different
shipping rate make the following request to select one and advance the order's state:

PUT /api/checkouts/:number.json
PUT /api/v1/checkouts/:number.json

With parameters such as these:

Expand Down Expand Up @@ -437,7 +437,7 @@ via api/checkouts is slight different. See example:_

If the order already has a payment, you can advance it to the `confirm` state by making this request:

PUT /api/checkouts/:number.json
PUT /api/v1/checkouts/:number.json

For more information on payments, view the [payments documentation](payments).

Expand Down Expand Up @@ -482,6 +482,6 @@ For more information on payments, view the [payments documentation](payments).

Now the order is ready to be advanced to the final state, `complete`. To accomplish this, make this request:

PUT /api/checkouts/:number.json
PUT /api/v1/checkouts/:number.json

You should get a 200 response with all the order info.
10 changes: 5 additions & 5 deletions guides/content/api/countries.md
Expand Up @@ -8,12 +8,12 @@ description: Use the Spree Commerce storefront API to access Country data.
Retrieve a list of all countries by making this request:

```text
GET /api/countries```
GET /api/v1/countries```

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

```text
GET /api/countries?page=2```
GET /api/v1/countries?page=2```

### Parameters

Expand All @@ -38,7 +38,7 @@ end %>
To search for a particular country, make a request like this:

```text
GET /api/countries?q[name_cont]=united```
GET /api/v1/countries?q[name_cont]=united```

The searching API is provided through the Ransack gem which Spree depends on. The `name_cont` here is called a predicate, and you can learn more about them by reading about [Predicates on the Ransack wiki](https://github.com/ernie/ransack/wiki/Basic-Searching).

Expand All @@ -57,14 +57,14 @@ end %>
Results can be returned in a specific order by specifying which field to sort by when making a request.

```text
GET /api/countries?q[s]=name%20desc```
GET /api/v1/countries?q[s]=name%20desc```

## Show

Retrieve details about a particular country:

```text
GET /api/countries/1```
GET /api/v1/countries/1```

### Response

Expand Down
6 changes: 3 additions & 3 deletions guides/content/api/line_items.md
Expand Up @@ -9,7 +9,7 @@ description: Use the Spree Commerce storefront API to access LineItem data.

To create a new line item, make a request like this:

POST /api/orders/R1234567/line_items?line_item[variant_id]=1&line_item[quantity]=1
POST /api/v1/orders/R1234567/line_items?line_item[variant_id]=1&line_item[quantity]=1

This will create a new line item representing a single item for the variant with the id of 1.

Expand All @@ -22,7 +22,7 @@ This will create a new line item representing a single item for the variant with

To update the information for a line item, make a request like this:

PUT /api/orders/R1234567/line_items/1?line_item[variant_id]=1&line_item[quantity]=1
PUT /api/v1/orders/R1234567/line_items/1?line_item[variant_id]=1&line_item[quantity]=1

This request will update the line item with the ID of 1 for the order, updating the line item's `variant_id` to 1, and its `quantity` 1.

Expand All @@ -35,7 +35,7 @@ This request will update the line item with the ID of 1 for the order, updating

To delete a line item, make a request like this:

DELETE /api/orders/R1234567/line_items/1
DELETE /api/v1/orders/R1234567/line_items/1

### Response

Expand Down
20 changes: 10 additions & 10 deletions guides/content/api/orders.md
Expand Up @@ -10,12 +10,12 @@ description: Use the Spree Commerce storefront API to access Order data.
Retrieve a list of orders by making this request:

```text
GET /api/orders```
GET /api/v1/orders```

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

```text
GET /api/orders?page=2```
GET /api/v1/orders?page=2```

### Parameters

Expand All @@ -40,7 +40,7 @@ end %>
To search for a particular order, make a request like this:

```text
GET /api/orders?q[email_cont]=bob```
GET /api/v1/orders?q[email_cont]=bob```

The searching API is provided through the Ransack gem which Spree depends on. The `email_cont` here is called a predicate, and you can learn more about them by reading about [Predicates on the Ransack wiki](https://github.com/ernie/ransack/wiki/Basic-Searching).

Expand All @@ -61,19 +61,19 @@ end %>
Results can be returned in a specific order by specifying which field to sort by when making a request.

```text
GET /api/orders?q[s]=number%20desc```
GET /api/v1/orders?q[s]=number%20desc```

It is also possible to sort results using an associated object's field.

```text
GET /api/orders?q[s]=user_name%20asc```
GET /api/v1/orders?q[s]=user_name%20asc```

## Show

To view the details for a single product, make a request using that order\'s number:

```text
GET /api/orders/R123456789```
GET /api/v1/orders/R123456789```

Orders through the API will only be visible to admins and the users who own
them. If a user attempts to access an order that does not belong to them, they
Expand All @@ -82,7 +82,7 @@ will be met with an authorization error.
Users may pass in the order's token in order to be authorized to view an order:

```text
GET /api/orders/R123456789?order_token=abcdef123456
GET /api/v1/orders/R123456789?order_token=abcdef123456
```

The `order_token` parameter will work for authorizing any action for an order within Spree's API.
Expand Down Expand Up @@ -113,12 +113,12 @@ end %>
To create a new order through the API, make this request:

```text
POST /api/orders```
POST /api/v1/orders```

If you wish to create an order with a line item matching to a variant whose ID is \"1\" and quantity is 5, make this request:

```text
POST /api/orders
POST /api/v1/orders
{
"order": {
Expand Down Expand Up @@ -153,7 +153,7 @@ To add address information to an order, please see the [checkout transitions](ch
To empty an order\'s cart, make this request:

```text
PUT /api/orders/R1234567/empty```
PUT /api/v1/orders/R1234567/empty```

All line items will be removed from the cart and the order\'s information will
be cleared. Inventory that was previously depleted by this order will be
Expand Down
26 changes: 13 additions & 13 deletions guides/content/api/payments.md
Expand Up @@ -9,11 +9,11 @@ description: Use the Spree Commerce storefront API to access Payment data.

To see details about an order's payments, make this request:

GET /api/orders/R1234567/payments
GET /api/v1/orders/R1234567/payments

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

GET /api/orders/R1234567/payments?page=2
GET /api/v1/orders/R1234567/payments?page=2

### Parameters

Expand All @@ -37,7 +37,7 @@ end %>

To search for a particular payment, make a request like this:

GET /api/orders/R1234567/payments?q[response_code_cont]=123
GET /api/v1/orders/R1234567/payments?q[response_code_cont]=123

The searching API is provided through the Ransack gem which Spree depends on. The `response_code_cont` here is called a predicate, and you can learn more about them by reading about [Predicates on the Ransack wiki](https://github.com/ernie/ransack/wiki/Basic-Searching).

Expand All @@ -57,17 +57,17 @@ end %>

Results can be returned in a specific order by specifying which field to sort by when making a request.

GET /api/payments?q[s]=state%20desc
GET /api/v1/payments?q[s]=state%20desc

It is also possible to sort results using an associated object's field.

GET /api/payments?q[s]=order_number%20asc
GET /api/v1/payments?q[s]=order_number%20asc

## New

In order to create a new payment, you will need to know about the available payment methods and attributes. To find these out, make this request:

GET /api/orders/R1234567/payments/new
GET /api/v1/orders/R1234567/payments/new

### Response

Expand All @@ -83,7 +83,7 @@ In order to create a new payment, you will need to know about the available paym

To create a new payment, make a request like this:

POST /api/orders/R1234567/payments?payment[payment_method_id]=1&payment[amount]=10
POST /api/v1/orders/R1234567/payments?payment[payment_method_id]=1&payment[amount]=10

### Response

Expand All @@ -94,7 +94,7 @@ To create a new payment, make a request like this:

To get information for a particular payment, make a request like this:

GET /api/orders/R1234567/payments/1
GET /api/v1/orders/R1234567/payments/1

### Response

Expand All @@ -105,7 +105,7 @@ To get information for a particular payment, make a request like this:

To authorize a payment, make a request like this:

PUT /api/orders/R1234567/payments/1/authorize
PUT /api/v1/orders/R1234567/payments/1/authorize

### Response

Expand All @@ -123,7 +123,7 @@ To authorize a payment, make a request like this:

To capture a payment, make a request like this:

PUT /api/orders/R1234567/payments/1/capture
PUT /api/v1/orders/R1234567/payments/1/capture

### Response

Expand All @@ -141,7 +141,7 @@ To capture a payment, make a request like this:

To make a purchase with a payment, make a request like this:

PUT /api/orders/R1234567/payments/1/purchase
PUT /api/v1/orders/R1234567/payments/1/purchase

### Response

Expand All @@ -157,7 +157,7 @@ To make a purchase with a payment, make a request like this:

To void a payment, make a request like this:

PUT /api/orders/R1234567/payments/1/void
PUT /api/v1/orders/R1234567/payments/1/void

### Response

Expand All @@ -173,7 +173,7 @@ To void a payment, make a request like this:

To credit a payment, make a request like this:

PUT /api/orders/R1234567/payments/1/credit?amount=10
PUT /api/v1/orders/R1234567/payments/1/credit?amount=10

If the payment is over the payment's credit allowed limit, a "Credit Over Limit" response will be returned.

Expand Down

0 comments on commit 94e456c

Please sign in to comment.