Skip to content

DISCOVERY: PWA 2.0 REST queries to Magento 2.3.1 GraphQL  #953

Closed
@awilcoxa

Description

@awilcoxa

PWA studio should take advantage of new graphql features launched in 2.3.1 and replace existing REST queries in Venia. This discovery should result in a clear definition for LOE and scope of changes necessary to move any applicable queries from REST to GraphQL.

Remaining REST API usage in repo as of cf29cd6.

See here for parameter/options.

src/actions/cart/asyncActions.js

  • ✅ POST /rest/V1/guest-carts (can be replaced by createEmptyCart mutation)
  • ✅ POST /rest/V1/guest-carts/:cartId/items (replaceable by addSimpleProductsToCart/addConfigurableProductsToCart mutations)
  • ❌ PUT /rest/V1/guest-carts/:cartId/items/:itemId (no replacement mutation exists)
  • ❌ DELETE /rest/V1/guest-carts/:cartId/items/:itemId (no replacement mutation exists)
  • ❌ GET /rest/V1/guest-carts/:cartId/payment-methods (no replacement query exists)
  • ❌ GET /rest/V1/guest-carts/:cartId/totals (no replacement query exists. a cart query does exist, but it currently doesn't contain total information.)

src/actions/checkout/asyncActions.js

  • ❌POST /rest/V1/guest-carts/:cartId/estimate-shipping-methods (no replaceable mutation exists)
  • ✅POST /rest/V1/guest-carts/:cartId/shipping-information (can be replaced by two mutations, setShippingAddressesOnCart and setShippingMethodsOnCart. there does appear to be some complexity here, it seems to expect cart items are passed with shipping addresses, I presume to support multi-address shipping)
  • ❌POST /rest/V1/guest-carts/:cartId/payment-information (no replacement mutation exists)

src/actions/directory/asyncActions.js

  • ✅GET /rest/V1/directory/countries (can be replaced by countries query)

src/actions/user/asyncActions.js

  • ✅POST /rest/V1/integration/customer/token (can be replaced by generateCustomerToken mutation)
  • ✅GET /rest/V1/customers/me (can be replaced by customer query)
  • ✅POST /rest/V1/customers (can be replaced by createCustomer)
  • ❌PUT /rest/V1/guest-carts/:cartId (no replacement mutation exists. if we wanted to migrate to GraphQL, I think you'd have to create a new cart and copy everything over from the old cart)

src/components/CreateAccount/validators.js

  • ❌POST /rest/V1/customers/isEmailAvailable (no replacement mutation exists)

src/actions/purchaseDetails/restApi.js

  • ❌ MOCK orderDetailsRequest (customerOrders does exist, but the response structure is very light on detail, only contains total and status; no item detail either)

Metadata

Metadata

Assignees

Labels

m2 > 2.3.0Requires Magento > 2.3.0 functionality.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions