Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add API Reference page to Spree Guides

Damian Legawiecdb678c2fed90
diff --git a/guides/src/components/Header.js b/guides/src/components/Header.js
index 4e41550a7f..84b38bf09a 100644
--- a/guides/src/components/Header.js
+++ b/guides/src/components/Header.js
@@ -71,9 +71,7 @@ export default class Header extends React.PureComponent {
<DocSearch isOpen={this.state.searchIsOpen} />
<nav className="h-100 w-100 tr dn flex-l items-center justify-end">
- <NavItem url="https://api.spreecommerce.org/">
- API
- </NavItem>
+ <NavItem text="API" url="/api/" isActive={this.isActive('api')} />
<NavItem
text="Developer"
isActive={this.isActive('developer')}
diff --git a/guides/src/components/Layout.js b/guides/src/components/Layout.js
index 78cd340a15..3a91e59f58 100644
--- a/guides/src/components/Layout.js
+++ b/guides/src/components/Layout.js
@@ -44,7 +44,7 @@ export default class Layout extends React.Component {
/>
<div className="z-3 relative ph4 items-center mw9 center h-100">
- {this.props.nav && (
+ {this.props.nav && this.props.activeSection != 'api' && (
<Sidebar
nav={this.props.nav}
activeSection={this.props.activeSection}
diff --git a/guides/src/content/api/index.md b/guides/src/content/api/index.md
index db14eef039..7539acc21a 100644
--- a/guides/src/content/api/index.md
+++ b/guides/src/content/api/index.md
@@ -1,9 +1,22 @@
---
-title: REST API v1 guide
+title: Spree API reference
---
-This site covers the inner working of Spree\'s RESTful API. It assumes a basic understanding of the principles of REST.
+Currently Spree has two REST APIs and in the future we will add GraphQL as well.
-The REST API is designed to give developers a convenient way to access data contained within Spree. With a standard read/write interface to store data, it is now very simple to write third party applications (eg. iPhone) that can talk to your Spree store. It is also possible to build sophisticated middleware applications that can serve as a bridge between Spree and a warehouse or inventory system.
+## [REST API v2](https://api.spreecommerce.org/docs/api-v2/api/docs/v2/storefront/index.yaml)
+
+* Modern lightweight REST API based on JSON API schema built
+* OAuth 2.0 authentication
+* Recommended for building Storefronts and mobile apps
+* [JavaScript / TypeScript SDK](https://github.com/spree/spree-storefront-api-v2-js-sdk) available
+
+## [REST API v1](/api/v1/summary.html)
+
+* Older REST API that requires API key authentication for access
+* Full feature set of Admin Panel
+* Recommended for building System integrations
+
+## GraphQL
+GraphQL support is coming soon!
-For a comprehensive list of API functions, start browsing the resources in the above diagram.
diff --git a/guides/src/content/api/addresses.md b/guides/src/content/api/v1/addresses.md
similarity index 100%
rename from guides/src/content/api/addresses.md
rename to guides/src/content/api/v1/addresses.md
diff --git a/guides/src/content/api/checkouts.md b/guides/src/content/api/v1/checkouts.md
similarity index 100%
rename from guides/src/content/api/checkouts.md
rename to guides/src/content/api/v1/checkouts.md
diff --git a/guides/src/content/api/countries.md b/guides/src/content/api/v1/countries.md
similarity index 100%
rename from guides/src/content/api/countries.md
rename to guides/src/content/api/v1/countries.md
diff --git a/guides/src/content/api/customer_returns.md b/guides/src/content/api/v1/customer_returns.md
similarity index 100%
rename from guides/src/content/api/customer_returns.md
rename to guides/src/content/api/v1/customer_returns.md
diff --git a/guides/src/content/api/line_items.md b/guides/src/content/api/v1/line_items.md
similarity index 100%
rename from guides/src/content/api/line_items.md
rename to guides/src/content/api/v1/line_items.md
diff --git a/guides/src/content/api/option_types.md b/guides/src/content/api/v1/option_types.md
similarity index 100%
rename from guides/src/content/api/option_types.md
rename to guides/src/content/api/v1/option_types.md
diff --git a/guides/src/content/api/option_values.md b/guides/src/content/api/v1/option_values.md
similarity index 100%
rename from guides/src/content/api/option_values.md
rename to guides/src/content/api/v1/option_values.md
diff --git a/guides/src/content/api/orders.md b/guides/src/content/api/v1/orders.md
similarity index 100%
rename from guides/src/content/api/orders.md
rename to guides/src/content/api/v1/orders.md
diff --git a/guides/src/content/api/payments.md b/guides/src/content/api/v1/payments.md
similarity index 100%
rename from guides/src/content/api/payments.md
rename to guides/src/content/api/v1/payments.md
diff --git a/guides/src/content/api/product_images.md b/guides/src/content/api/v1/product_images.md
similarity index 100%
rename from guides/src/content/api/product_images.md
rename to guides/src/content/api/v1/product_images.md
diff --git a/guides/src/content/api/product_properties.md b/guides/src/content/api/v1/product_properties.md
similarity index 100%
rename from guides/src/content/api/product_properties.md
rename to guides/src/content/api/v1/product_properties.md
diff --git a/guides/src/content/api/products.md b/guides/src/content/api/v1/products.md
similarity index 100%
rename from guides/src/content/api/products.md
rename to guides/src/content/api/v1/products.md
diff --git a/guides/src/content/api/return_authorizations.md b/guides/src/content/api/v1/return_authorizations.md
similarity index 100%
rename from guides/src/content/api/return_authorizations.md
rename to guides/src/content/api/v1/return_authorizations.md
diff --git a/guides/src/content/api/shipments.md b/guides/src/content/api/v1/shipments.md
similarity index 100%
rename from guides/src/content/api/shipments.md
rename to guides/src/content/api/v1/shipments.md
diff --git a/guides/src/content/api/states.md b/guides/src/content/api/v1/states.md
similarity index 100%
rename from guides/src/content/api/states.md
rename to guides/src/content/api/v1/states.md
diff --git a/guides/src/content/api/stock_items.md b/guides/src/content/api/v1/stock_items.md
similarity index 100%
rename from guides/src/content/api/stock_items.md
rename to guides/src/content/api/v1/stock_items.md
diff --git a/guides/src/content/api/stock_locations.md b/guides/src/content/api/v1/stock_locations.md
similarity index 100%
rename from guides/src/content/api/stock_locations.md
rename to guides/src/content/api/v1/stock_locations.md
diff --git a/guides/src/content/api/stock_movements.md b/guides/src/content/api/v1/stock_movements.md
similarity index 100%
rename from guides/src/content/api/stock_movements.md
rename to guides/src/content/api/v1/stock_movements.md
diff --git a/guides/src/content/api/summary.md b/guides/src/content/api/v1/summary.md
similarity index 99%
rename from guides/src/content/api/summary.md
rename to guides/src/content/api/v1/summary.md
index ba2fa45d61..7df53cc7fd 100644
--- a/guides/src/content/api/summary.md
+++ b/guides/src/content/api/v1/summary.md
@@ -6,7 +6,7 @@ order: 0
## Overview
Spree currently supports RESTful access to the resources listed in the sidebar
-on the right &raquo;
+on the left.
This API was built using the great [Rabl](https://github.com/nesquena/rabl) gem.
Please consult its documentation if you wish to understand how the templates use
diff --git a/guides/src/content/api/taxonomies.md b/guides/src/content/api/v1/taxonomies.md
similarity index 100%
rename from guides/src/content/api/taxonomies.md
rename to guides/src/content/api/v1/taxonomies.md
diff --git a/guides/src/content/api/users.md b/guides/src/content/api/v1/users.md
similarity index 100%
rename from guides/src/content/api/users.md
rename to guides/src/content/api/v1/users.md
diff --git a/guides/src/content/api/variants.md b/guides/src/content/api/v1/variants.md
similarity index 100%
rename from guides/src/content/api/variants.md
rename to guides/src/content/api/v1/variants.md
diff --git a/guides/src/content/api/zones.md b/guides/src/content/api/v1/zones.md
similarity index 100%
rename from guides/src/content/api/zones.md
rename to guides/src/content/api/v1/zones.md
diff --git a/guides/src/pages/index.js b/guides/src/pages/index.js
index 38215f7e4d..8e8f96c8a4 100644
--- a/guides/src/pages/index.js
+++ b/guides/src/pages/index.js
@@ -25,12 +25,18 @@ const IndexPage = () => (
<div className="mw8 center">
<div className="flex flex-column flex-wrap flex-row-ns mv4 w-100">
- <Section path="https://api.spreecommerce.org" title="API Guides" className="w-50-ns">
- The REST API is designed to give developers a convenient way to
- access data contained within Spree. With a standard read/write
- interface to store data, it is now very simple to write third party
- applications (JavaScript/Mobile/other technologies) that can talk to
- your Spree store.
+ <Section path="/api/" title="API Reference" className="w-50-ns">
+ <p>
+ The REST API is designed to give developers a convenient way to
+ access data contained within Spree. With a standard read/write
+ interface to store data, it is now very simple to write third party
+ applications (JavaScript/Mobile/other technologies) that can talk to
+ your Spree store.
+ </p>
+ <ul className="list">
+ <li className="dib mr2"><a href="/api/v1/summary.html">REST API v1</a></li>
+ <li className="dib mr2"><a href="https://api.spreecommerce.org/docs/api-v2/api/docs/v2/storefront/index.yaml">REST API v2</a></li>
+ </ul>
</Section>
<Section