NAV Navbar
Logo

Introduction

Welcome to the Fashionphile API! You can use this api to access Fashionphile endpoints.

We generally use Shell code examples to keep the endpoints clear. Code examples can be found in the dark area to the right.

This API documentation page was created with Slate.

Development

Make sure to run php artisan jwt:secret to add a jwt secret to your environment. It’s also nice to add JWT_BLACKLIST_ENABLED=false and API_DEBUG=true to your environment to ease development. Another optional settings is to set AUTO_AUTHENTICATE_USER_ID=2 to have everything act as though you’re logged in as a given user regardless of headers.

Versioning

Versioning is supported via the Accept header. It should be set to application/x.fashionphile.v1+json. The current version is v1.

curl "http://www.fashionphile.test/api/ping" \
  -H "Accept: application/x.fashionphile.v1+json"

Authentication

Example JSON response for unauthorized request:

{
  "message": "Failed to authenticate because of bad credentials or an invalid authorization header.",
  "status_code": 401
}

First make a request with correct credentials in order to get a token:

curl -X POST "http://www.fashionphile.test/api/authenticate" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -F "email=user@example.com" \
  -F "password=password"

You’ll receive a token in a response that looks like:

{
  "token": "abc123"
}

Then make a request to an endpoint that requires authentication:

curl "http://www.fashionphile.test/api/whoami" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

The response should look like:

{
  "message": "user@example.com"
}

The response would also include an Authorization header that looks like:

Authorization: Bearer def456

The token def456 would then be used for the next request made to the API.

Make sure to replace abc123 and def456 with your token.

Most endpoints require authorization. If you are missing or have an invalid token, you will receive a 401 response. The header should look like:

Bearer: abc123

There is an example with multiple steps to the side.

For security, tokens are rotated on every request. Once a token has been used for a request, it is blacklisted. Blacklisted tokens can only be used for a short grace period, 5 seconds. The purpose of the grace period is to allow multiple async requests to work with an already blacklisted token.

Signing In

This endpoint allows a user to sign it. It returns a token for future requests.

curl -X POST "http://www.fashionphile.test/api/authenticate" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -F "email=user@example.com" \
  -F "password=password"

HTTP Request

POST http://www.fashionphile.test/api/authentication

Signing in through Facebook

You can use a valid Facebook access token to log in using the API. The token will be verified and if a user already exists for the email associated with the user token, that user will be logged in. Otherwise, a new user will be created.

Example Request

curl -X POST "http://www.fashionphile.dev/api/authenticate" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -F "token=123456789asdf"

Example Response

Parameters

Key Required Description
token Required Sign-in token from Facebook. This is retrieved from the Facebook SDK on the app.

Signing Out

Signing out will blacklist the token so it can no longer be used. Authenticating again will be required to get a new token.

curl -X DELETE "http://www.fashionphile.test/api/authentication" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

HTTP Request

DELETE http://www.fashionphile.test/api/authenticate

Forgot password

This endpoint allows a user to reset forgotten password. It returns message about successful sending of an email.

curl -X POST "http://www.fashionphile.test/api/forgot" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -F "email=user@example.com"

HTTP Request

POST http://www.fashionphile.test/api/forgot

Accounts

Create an Account

Test workflow 2

curl -X POST "http://www.fashionphile.test/api/account" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -d '{
        "email": "charlie@example.com",
        "password": "password"
  }'

HTTP Request

POST http://www.fashionphile.test/api/account

Creating an account is one of the few unauthenticated requests. After creating an account you would still need to make a separate request to the authenticate endpoint to log in.

Fetch an Account

Example Request

curl "http://www.fashionphile.test/api/account" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data": {
    "type": "user",
    "id": "194159",
    "attributes": {
      "email": "user@example.com"
    }
  }
}

HTTP Request

GET http://www.fashionphile.test/api/account

You can fetch the account of the currently authenticated user.

Update an Account

Example Request

curl --request PUT "http://www.fashionphile.test/api/account/194159" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"
  -d '{
        "firstName": "Jon",
        "lastName": "Jones",
        "email": "jonny@gmail.com",
        "password": "abc123",
        "password_confirmation": "abc123"
  }'

Example Response

{
  "data": {
    "type": "user",
    "id": "194159",
    "attributes": {
        "email": "jonny@gmail.com",
        "firstName": "Jon",
        "lastName": "Jones",
        "accountBalance": "0.00",
        "authorizeNetCustomerProfileId": null,
        "paymentMethod": "check",
        "paypalAddress": null
    }
  }
}

HTTP Request

PUT http://www.fashionphile.test/api/account/1

Use this endpoint to update a user account. Note, password_confirmation is required if password is supplied via the request.

Parameter Description
email The new email of the user
firstName User’s first name
lastName User’s last name
password Updated password
password_confirm Required if password is provided

Update Payment Options

PATCH http://www.fashionphile.test/api/account/payment-options

Use this endpoint to update payment options of a supplier.

Example Request

curl --request PATCH "http://www.fashionphile.test/api/account/payment-options" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"
  -d '{
        "paymentMethod": "paypal",
        "paypalAddress": "charlie@example.com",
  }'
Parameter Description
paymentMethod The user payment method. One of “check”, “paypal”, “ach”, “wire_transfer”, or “account_balance”
paypalAddress The PayPal email address
achBankName Bank name for ACH payment
accountNumber Account number for ACH payment
achRoutingNumber 9 digit routing number
wireBankName Bank name for wire transfer
bankBranchAddress Bank branch address for wire transfer
accountOrIbanNumber Wire transfer account number
wireRoutingNumber 9 digit wire routing number
swiftCode Swift code for wire transfer

Addresses

Create an Address

curl -X POST "http://www.fashionphile.test/api/addresses" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
        "email": "charlie@example.com",
        "firstName": "Charlie",
        "lastName": "Kelly",
        "address1": "123 Sesame Street",
        "address2": "",
        "city": "Salt Lake City",
        "state": "UT",
        "country": "US",
        "postalCode": "84102",
        "phone": "8018018018",
        "business": ""
  }'

HTTP Request

POST http://www.fashionphile.test/api/addresses

Parameters

Parameter Rules Description
firstName required First Name
lastName required Last Name
address1 required Address Line 1
address2 optional Address Line 2
city required City
state required State
country required Country
phone required Phone
postalCode required Postal Code
email required, email Email
business optional Business Name

Fetch all Addresses

Example Request

curl "http://www.fashionphile.test/api/addresses" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data": [{
    "type": "addresses",
    "id": "1",
    "attributes": {
      "email": "charlie@example.com",
      "firstName": "Charlie",
      "lastName": "Kelly",
      "address1": "123 Sesame Street",
      "address2": "",
      "city": "Salt Lake City",
      "state": "UT",
      "country": "US",
      "postalCode": "84102",
      "phone": "8018018018",
      "business": ""
    }
  }]
}

HTTP Request

GET http://www.fashionphile.test/api/addresses

This will fetch all addresses for the currently authenticated user.

Update Address

Example Request

curl -X PUT "http://www.fashionphile.test/api/addresses/1" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
        "email": "charlie@example.com",
        "firstName": "Charlie",
        "lastName": "Kelly",
        "address1": "123 Sesame Street",
        "address2": "",
        "city": "Salt Lake City",
        "state": "UT",
        "country": "US",
        "postalCode": "84102",
        "phone": "8018018018",
        "business": ""
  }'

Example Response

{
  "data": [{
    "type": "addresses",
    "id": "1",
    "attributes": {
      "email": "charlie@example.com",
      "firstName": "Charlie",
      "lastName": "Kelly",
      "address1": "123 Sesame Street",
      "address2": "",
      "city": "Salt Lake City",
      "state": "UT",
      "country": "US",
      "postalCode": "84102",
      "phone": "8018018018",
      "business": ""
    }
  }]
}

HTTP Request

PUT http://www.fashionphile.test/api/addresses/{id}

This will update an address in a user’s address book.

Parameters

Parameter Rules Description
firstName required First Name
lastName required Last Name
address1 required Address Line 1
address2 optional Address Line 2
city required City
state required State
country required Country
phone required Phone
postalCode required Postal Code
email required, email Email
business optional Business Name

Remove Address

curl -X DELETE "http://www.fashionphile.test/api/addresses/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

HTTP Request

DELETE http://www.fashionphile.test/api/addresses/{id}

This endpoint allows deleting an address.

Categories

Fetch all categories

Retrieve a list of categories with an optional filter.

Example Request

curl "http://www.fashionphile.test/api/categories" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Example Response

{
    "data": [
        {
            "type": "categories,",
            "id": "15",
            "attributes": {
                "name": "Accessories",
                "slug": "accessories",
                "isEnabledForQuotes": 0
            }
        },
        ...
    ],
    "links": {
        "self": "http://fashionphile.test/api/categories?page=1",
        "first": "http://fashionphile.test/api/categories?page=1",
        "next": "http://fashionphile.test/api/categories?page=2",
        "last": "http://fashionphile.test/api/categories?page=7"
    }
}

Parameters

Parameter Default Description
limit 15 The maximum number of categories to return per page
sortDirection ‘asc’ The sorting direction.
sortField name The field to sort on.
filter null A filter to use on the categories. The only supported filter for now is “enabledForQuotes”

Followed Products

Fetch all followed products

Example Request

curl "http://www.fashionphile.test/api/followed-products" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data":
    [
      {
        "type":"products",
        "id":"1",
        "attributes":
        {
          "title":"Title",
          "price":"10.00",
          "createdAt":"2014-06-20T12:00:00-07:00",
          "images":[],
          "brand":null
        }
      },
      {
        "type":"products",
        "id":"2",
        "attributes":
        {
          "title":"Title",
          "price":"10.00",
          "createdAt":"2014-06-20T12:00:00-07:00",
          "images":[],
          "brand":null
        }
      }
    ]
}

HTTP Request

GET http://www.fashionphile.test/api/followed-products

This will fetch all followed products for the currently authenticated user.

Follow product

Example Request

curl -X POST "http://www.fashionphile.test/api/followed-products" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
        "id": 1
  }'

Example Response

{
  "data":
  {
    "type":"products",
    "id":"3",
    "attributes":
    {
      "title":"Title",
      "price":"10.00",
      "createdAt":"2014-06-20T12:00:00-07:00",
      "images":[],
      "brand":null
    }
  }
}

HTTP Request

POST http://www.fashionphile.test/api/followed-products

Follow a product for currently authenticated user.

Parameters

Parameter Rules Description
id required Product id

Unfollow a product

curl -X DELETE "http://www.fashionphile.test/api/followed-products/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

HTTP Request

DELETE http://www.fashionphile.test/api/followed-products/{id}

This endpoint allows unfollowing a product for currently authenticated user.

Orders

Fetching Orders

Example Request

curl "http://www.fashionphile.test/api/account/orders" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data": [
    {
      "type": "orders",
      "id": "1",
      "attributes": {
        "createdAt": "2017-01-01T10:11:12-08:00",
        "shippedAt": "2017-01-03T10:11:12-08:00",
        "layawayPayoffAt": "2017-01-02T10:11:12-07:00",
        "total": "123.00",
        "subtotal": "123.00",
        "discountedSubtotal": 123,
        "tax": "0.00",
        "totalLayawayPaid": "123.00",
        "shippingStatus": "Shipped",
        "shippingRate": "0.00",
        "couponAmount": "0.00",
        "extraShippingDue": null,
        "isCancelled": false,
        "isLayaway": true,
        "isActiveLayaway": false,
        "isReturnable": false,
        "pendingAmount": "0.00",
        "remainingBuyBackMinutes": 87,
        "status": "completed",
        "friendlyStatus": "completed",
        "displayId": 197674,
        "refundedAt": null,
        "shipmentStatus": "shipped",
        "type": "website",
        "ebayLinkUrl": null,
        "ebayLinkTitle": null,
        "warehouseName": null,
        "shipmentId": 279631
      },
      "relationships": {
        "details": {
          "data": [
            {
              "type": "details",
              "id": "1"
            }
          ]
        }
      }
    }
  ],
  "meta": {
    "pagination": {
      "total": 1,
      "count": 1,
      "per_page": 15,
      "current_page": 1,
      "total_pages": 1
    }
  },
  "links": {
    "self": "http://www.fashionphile.test/api/account/orders?page=1",
    "first": "http://www.fashionphile.test/api/account/orders?page=1",
    "last": "http://www.fashionphile.test/api/account/orders?page=1"
  }
}

Fetch orders of the currently authenticated user.

HTTP Request

GET http://www.fashionphile.test/api/account/orders

Available relationship includes

You can include related models by passing in an include key and a comma-separated list of relationship keys.

Key Description
details Collection of OrderDetail for an order
details.product Products
payments Collection of Payments for an order
shippingAddress Address shipping address
billingAddress Address billing address

Filtering Orders

A filter is required. You can filter orders by passing in a filter key.

Filter Value Description
unpaid Orders which are unpaid layaways
paid Orders which are paid (all orders excluding unpaid layaways)

Products

Search Products

Example Request

curl "http://www.fashionphile.test/api/products" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data": [
    {
      "type": "products",
      "id": "66593",
      "attributes": {
        "title": "BALENCIAGA Agneau Perforated Dot City Sorbet",
        "price": "695.00",
        "createdAt": "2014-09-26T11:47:02-07:00"
      }
    }
  ],
  "meta": {
    "filters": [
      {
        "key": "brands",
        "title": "Brands",
        "children": [
          {
            "key": "louis-vuitton",
            "title": "Louis Vuitton",
          }
        ]
      },
      {
        "key": "price",
        "title": "Price",
        "children": [
          {
            "key": "lt200",
            "title": "Under $200"
          }
        ]
      },
      {
        "key": "colors",
        "title": "Color",
        "children": [
          {
            "key" :"black",
            "title": "Black"
          }
        ]
      }
    ],
    "pagination": {
      "total": 30,
      "count": 20,
      "per_page": 20,
      "current_page": 1,
      "total_pages": 2
    }
  },
  "links": {
    "self": "http://www.fashionphile.test/api/products?page=1",
    "first": "http://www.fashionphile.test/api/products?page=1",
    "next": "http://www.fashionphile.test/api/products?page=2",
    "last": "http://www.fashionphile.test/api/products?page=2"
  }
}

This endpoint is for searching products.

HTTP Request

GET http://www.fashionphile.test/api/products

Query Parameters

Parameter Default Description
limit 20 The maximum number of products to return.
minimumPrice null The minimum price.
maximumPrice null the maximum price.
sortDirection desc The sorting direction.
sortField price The field to sort on. This can be "alphabetical", "made_available_at" or "price".
search null Search text to filter products
filter null An array of filters to apply. See below for more details
showFeaturedFirst false A boolean flag to indicate if you want featured products to show in results first

Search Filtering

Example Request

curl "http://www.fashionphile.test/api/products?filter[brands][]=louis-vuitton&filter[price][]=lt200" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

The above request will filter products by brand = louis vuitton and price less than 200.

The search endpoint allows you to filter the results by passing in an array of filters. The possible filters are returned in each response from this endpoint in the meta.filters key. You can also fetch a list of available filters using GET api/products/filters

Fetching Product Filters

Example Request

curl "http://www.fashionphile.test/api/products/filters" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

Example Response

[
  {
    "key": "brands",
    "title": "Brands",
    "children": [
      {
        "key": "louis-vuitton",
        "title": "Louis Vuitton",
      }
    ]
  },
  {
    "key": "price",
    "title": "Price",
    "children": [
      {
        "key": "lt200",
        "title": "Under $200"
      }
    ]
  },
  {
    "key": "colors",
    "title": "Color",
    "children": [
      {
        "key" :"black",
        "title": "Black"
      }
    ]
  }
]

Use this endpoint to retrieve a list of product filters that can be used in product search requests.

Fetching Products

Example Request

curl "http://www.fashionphile.test/api/products/10001,10002" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data": [
    {
      "type": "products",
      "id": "10001",
      "attributes": {
        "title": "Fashionphile Gift Card",
        "price": "0.00",
        "createdAt": "2012-12-06T00:00:00-08:00"
      }
    },
    {
      "type": "products",
      "id": "10002",
      "attributes": {
        "title": "FASHIONPHILE 2014 Handbag Calendar",
        "price": "5.00",
        "createdAt": "2012-12-06T00:00:00-08:00"
      }
    }
  ]
}

You can fetch multiple products at once by id

HTTP Request

GET http://www.fashionphile.test/api/products/{ids}

Url Parameters

ids is a comma separated list of ids. For example, 1,2,3 would fetch 3 products with those respective ids.

Getting Suggestions

Example request

curl "http://www.fashionphile.test/api/products/suggest" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

Use this endpoint to retrieve a list of product title suggestions based on the current search. Currently, this endpoint does not accept filters.

Parameter Description
search The current search string
limit The amount of suggestions to return

Fetching Main Image for Big vision

Example Request

curl -X POST \
 "http://www.fashionphile.test/api/products/image" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123 \
  -F title=Chanel Calf Skin Quilted Small Boy Flap"

Example Response

{
  "data":
    {
      "productId": 73357,
      "mainImageUrl": "http:\/\/www.fashionphile.com\/includes\/images\/BW73357\/BW73357-CHANEL%20IRIDESCENT%20SMALL%20BOY%20FLAP%20BLUE-a.jpg"
    }
}

This endpoint is to retrieve product image url from a predicted quote title.

Cart

Cart resource

Example Cart

{
    "data": {
        "type": "carts",
        "id": "4",
        "attributes": {
            "shippingMethod": "ups",
            "shippingOptions": [
                {
                    "name": "USPS - Priority",
                    "rate": 12.24375,
                    "type": "Ground",
                    "formattedRate": "$12.24"
                },
                {
                    "name": "USPS - Express",
                    "rate": 44.55,
                    "type": "Overnight",
                    "formattedRate": "$44.55"
                }
            ],
            "paymentMethod": null,
            "coupon": null,
            "giftCard": null,
            "isLayaway": null,
            "layawayAmount": null,
            "useAccountBalance": null,
            "createdAt": "2017-06-21T10:22:06-07:00",
            "canWaiveSignature": true,
            "isSignatureRequired": false
        },
        "relationships": {
            "cartItems": {
                "data": [
                    {
                        "type": "cartItems",
                        "id": "2"
                    },
                    {
                        "type": "cartItems",
                        "id": "3"
                    }
                ]
            },
            "shippingAddress": {
                "data": {
                    "type": "shippingAddress",
                    "id": "459632"
                }
            },
            "billingAddress": {
                "data": {
                    "type": "billingAddress",
                    "id": "459631"
                }
            }
        }
    },
    "included": [
        {
            "type": "products",
            "id": "1",
            "attributes": {
                "brand": "Louis Vuitton",
                "createdAt": "2014-07-10T15:42:12-07:00",
                "currentLocation": "Carlsbad HQ",
                "description": "",
                "discount": "",
                "discountEnabled": true,
                "discountPrice": 143,
                "drop": "7",
                "exteriorDescription": null,
                "friendlyCondition": "New",
                "handleDescription": null,
                "hardwareDescription": null,
                "height": "6.5",
                "images": [],
                "interiorDescription": null,
                "isEligibleForBuyBack": false,
                "itemNumber": "BD13",
                "length": "11",
                "price": "950.00",
                "retailPrice": "985.00",
                "title": "LOUIS VUITTON Monogram Favorite MM",
                "width": "2"
            }
        },
        {
            "type": "cartItems",
            "id": "2",
            "attributes": {
                "quantity": 1,
                "amount": "800.00"
            },
            "relationships": {
                "product": {
                    "data": {
                        "type": "products",
                        "id": "177489"
                    }
                }
            }
        },
        {
            "type": "cartItems",
            "id": "3",
            "attributes": {
                "quantity": 1,
                "amount": "0.00"
            },
            "relationships": {
                "product": {
                    "data": {
                        "type": "products",
                        "id": "1"
                    }
                }
            }
        },
        {
            "type": "shippingAddress",
            "id": "459632",
            "attributes": {
                "firstName": "Example",
                "lastName": "User",
                "address1": "123 fake st",
                "address2": null,
                "city": "Los Angeles",
                "state": "CA",
                "country": "US",
                "phone": "555-555-5555",
                "postalCode": "83939",
                "email": "test@example.com",
                "business": null
            }
        },
        {
            "type": "billingAddress",
            "id": "459631",
            "attributes": {
                "firstName": "Example",
                "lastName": "User",
                "address1": "123 fake st",
                "address2": null,
                "city": "Los Angeles",
                "state": "CA",
                "country": "US",
                "phone": "555-555-5555",
                "postalCode": "83939",
                "email": "test@example.com",
                "business": null
            }
        }
    ],
    "meta": {
        "summary": {
            "discount": 190,
            "subtotal": 800,
            "shipping": 0,
            "total": 800,
            "amountDue": 610,
            "couponAmount" 0
        },
        "shippingOptions": [
            {
                "name": "USPS - Priority",
                "rate": 12.24375,
                "type": "Ground",
                "formattedRate": "$12.24"
            },
            {
                "name": "USPS - Express",
                "rate": 44.55,
                "type": "Overnight",
                "formattedRate": "$44.55"
            }
        ],
        "accountBalance": "0.00",
        "isEligibleForLayaway": false,
    }
}

The cart object is returned from multiple cart endpoints. It contains data about what items are in the cart, as well as addresses, payment modifiers, and shipping options.

Attribute Description Type
accountBalanceAmount Amount of account balance to apply. float
billingAddress Id of the billing address that should be used. integer
coupon Coupon code to apply. string
creditCardAmount The amount that should be charged to a credit card. float
giftCards An array of gift cards that should be applied. Each gift card needs an id. array
giftCardAmount The amount that should be charged to gift cards. float
isLayaway Boolean to indicate if order should be layaway. boolean
layawayAmount Layaway payment amount. float
paymentMethod The payment method to use. Can be one of the following:
paypal
authorizenet
string
shippingAddressId ID of the shipping address that should be used integer
shippingMethod string
canWaiveSignature Boolean indicating whether or not the user can waive
the signature on an order
boolean
isSignatureRequired Boolean value reflecting users choice to waive or
keep signature requirement
boolean

Create a Cart

Example Request

curl -X POST "http://www.fashionphile.test/api/carts" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
    "cartItems": [
      {
        "quantity": 1,
        "productId": 123
      }
    ]
  }'

This endpoint returns a cart response

HTTP Request

POST http://www.fashionphile.test/api/carts

This endpoint simply creates a cart. The id of the returned cart will be used for other cart endpoints. You can optionally pass in cart items to be added.

Fetch a Cart

Example Request

curl "http://www.fashionphile.test/api/carts/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

This endpoint returns a cart response

HTTP Request

GET http://www.fashionphile.test/api/carts/{id}

Returns the cart.

Add Cart Item to a Cart

Example Request


curl -X POST "http://www.fashionphile.test/api/carts/123/cart_items" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
        "quantity": 1,
        "productId": 123
  }'

Example Response

{
  "data": {
    "type": "cartItems",
    "id": "234",
    "relationships": {
      "cart": {
        "data": {
          "type": "carts",
          "id": "22"
        }
      },
      "product": {
        "data": {
          "type": "products",
          "id": "10"
        }
      }
    }
  },
  "included": [{
    "type": "carts",
    "id": "22",
    "relationships": {
      "items": {
        "data": {
          "type": "cartItems",
          "id": "234"
        }
      }
    }
  }, {
    "type": "product",
    "id": "205",
    "title": "Louis Vuitton Speedy Monogram",
    "price": 425
  }]
}

HTTP Request

POST http://www.fashionphile.test/api/cart_items

This endpoint creates a cart item.

Remove Cart Item from a Cart

Example Request

curl -X DELETE "http://www.fashionphile.test/api/carts/123/cart_items/456" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Returns a cart response

HTTP Request

DELETE http://www.fashionphile.test/api/carts/{cartId}/cart_items/{cartItemId}

This endpoint allows removing an item from the cart.

Setting the shipping method

Each cart response will include the available shipping options based on the shipping address. To actually set the shipping method being used, set the cart’s shippingMethod to the type of the selected shipping option.

Checkout

Checkout relies on a Cart object. Checkout mostly relies on updating the cart with PATCH requests

Setting a billing or shipping address

For an existing user, there is likely to be a related shipping address and billing address set by default for the cart. For a new user or a user that wants to change which address to use for this order, you can use a PATCH request.

Example Request

curl -X PATCH "http://www.fashionphile.test/api/carts/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
    "billing_address_id": 2,
    "shipping_address_id": 3
  }'

This endpoint returns a cart response

HTTP Request

PATCH http://www.fashionphile.test/api/carts/{id}

This endpoint updates a cart.

This endpoint returns a cart response

Using account balance

Pass in a payment method for account balance with the following information:

amount – This is the amount of account balance that should be applied. type – for account balance: account_balance

{
  "amount": 23.5,
  "type": "account_balance"
}

Using a gift card

To use a gift card, payment method should be like this:

{
  "amount": 23.5,
  "type": "gift_card",
  "giftCode": "asdf1234jkl"
}

You can use multiple gift cards. Just pass in multiple payment methods of type = “gift_card”. They will each be redeemed when completing checkout

Using a credit card

To use a credit card, payment method should be like this:

{
  "amount": 23.5,
  "type": "credit_card",
  "transactionId": 1,
  "cardType": "Visa",
  "avsCode":"",
  "cvvCode": "123"
}

Using PayPal

To use a gift card, payment method should be like this:

{
  "amount": 23.5,
  "type": "paypal",
  "transactionId": 1
}

You can use multiple gift cards. Just pass in multiple payment methods of type = “gift_card”. They will each be redeemed when completing checkout

Signature Requirement

Waive Signature

Set isSignatureRequired to false. Note that this value will only be taken into effect if canWaiveSignature is true

Example Request

curl -X PATCH "http://www.fashionphile.test/api/carts/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{ "isSignatureRequired": false }'

This endpoint returns a cart response.

Layaways

Starting a layaway

Set is_layaway to true on the cart.

Making a payment

Creating a payment profile

Before you can checkout using a credit card, you need an Authorize.net customer profile with a payment profile id.

Example Request

curl -x POST "http://www.fashionphile.test/api/carts/123/payment-profiles" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
    "credit_card_number": "4444111144441111",
    "save_for_later": true,
    "expiration_month": 14,
    "expiration_year": 2021,
    "verification_number": 353
  }'

This endpoint returns a cart response.

Parameters

Name Description
credit_card_number Required
expiration_month Required
expiration_year Required
verification_number Required
save_for_later Required. If true, a reference to the payment profile will be stored for the user.

Completing Checkout

Example Request

curl -x POST "http://www.fashionphile.test/api/carts/123/checkout" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
    "payment_profile_id": "12343859302"
  }'

If payment is successful, this endpoint returns an order response

If a credit card is being used for payment, the user needs to have an authorize.net customer profile along with a payment profile.

Parameters

Name Description
payment_profile_id Required*. The id of the authorize.net payment profile that should be charged. Required if a credit card is being used.

Payment Profiles

Fetching Payment Profiles

Example Request

curl "http://www.fashionphile.test/api/payment-profiles" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"
  -F paymentProfileId=32114594
  -F name="Visa ending in 1234"

Example Response

{
    "data": [
        {
            "type": "paymentProfiles",
            "id": "1",
            "attributes": {
                "userId": 2,
                "paymentProfileId": 32114594,
                "name": "Visa ending in 1234"
            }
        }
    ]
}

Fetch payment profiles of the currently authenticated user. These are references to authorize.net payment profiles.

HTTP Request

GET http://www.fashionphile.test/api/payment-profiles

Searches

Fetch all searches

Example Request

curl "http://www.fashionphile.test/api/account/searches" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data":
  [
    {
      "type":"user_searches",
      "id":"1",
      "attributes":
      {
        "refreshedAt":"2018-02-07T05:21:48-08:00",
        "createdAt":"2018-02-07T05:21:48-08:00",
        "updatedAt":"2018-02-07T05:21:48-08:00"
      },
      "relationships":
      {
        "search":
          {"data":
            {
              "type":"search",
              "id":"1"
            }
          }
      }
    },
    {
      "type":"user_searches",
      "id":"2",
      "attributes":
      {
        "refreshedAt":"2018-02-07T05:21:48-08:00",
        "createdAt":"2018-02-07T05:21:48-08:00",
        "updatedAt":"2018-02-07T05:21:48-08:00"
      },
      "relationships":
      {
        "search":
        {
          "data":
          {
            "type":"search",
            "id":"2"
          }
        }
      }
    }
  ],
  "included":
  [
    {
      "type":"search",
      "id":"1",
      "attributes":{"searchTerm":"search a"}
    },
    {
      "type":"search",
      "id":"2",
      "attributes":{"searchTerm":"search b"}
    }
  ]
}

HTTP Request

GET http://www.fashionphile.test/api/account/searches

This will fetch all searches for the currently authenticated user.

Get search by its id

Example Request

curl "http://www.fashionphile.test/api/account/searches/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data":
  [
    {
      "type":"user_searches",
      "id":"123",
      "attributes":
      {
        "refreshedAt":"2018-02-07T05:21:48-08:00",
        "createdAt":"2018-02-07T05:21:48-08:00",
        "updatedAt":"2018-02-07T05:21:48-08:00"
      },
      "relationships":
      {
        "search":
          {"data":
            {
              "type":"search",
              "id":"1"
            }
          }
      }
    }
  ],
  "included":
  [
    {
      "type":"search",
      "id":"1",
      "attributes":{"searchTerm":"search a"}
    }
  ]
}

HTTP Request

GET http://www.fashionphile.test/api/account/searches/{id}

This will get search by id for the currently authenticated user.

Example Request

curl -X POST "http://www.fashionphile.test/api/account/searches" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
        "searchTerm": "cool bag",
        "isFollowed: true
  }'

Example Response

{
  "data":
  {
    "type":"user_searches",
    "id":"4",
    "attributes":
    {
      "refreshedAt":"2018-02-07T05:48:28-08:00",
      "createdAt":"2018-02-07T05:48:28-08:00",
      "updatedAt":"2018-02-07T05:48:28-08:00"
    },
    "relationships":
    {
      "search":
      {
        "data":
          {
            "type":"search","id":"4"
          }
      }
    }
  },
  "included":
  [
    {
      "type":"search",
      "id":"4",
      "attributes":{"searchTerm":"test"}
    }
  ]
}

HTTP Request

POST http://www.fashionphile.test/api/account/searches

Create a search for currently authenticated user.

Parameters

Parameter Rules Description
searchTerm required Search term
isFollowed required whether search is followed

Example Request

curl -X PUT "http://www.fashionphile.test/api/account/searches/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

Example Response

{
  "data":
  {
    "type":"user_searches",
    "id":"5",
    "attributes":
    {
      "refreshedAt":"2018-02-07T06:09:39-08:00",
      "createdAt":"2018-02-07T06:09:39-08:00",
      "updatedAt":"2018-02-07T06:09:39-08:00"
    },
    "relationships":
    {
      "search":
      {
        "data":
        {
          "type":"search",
          "id":"5"
        }
      }
    }
  },
  "included":
  [
    {
      "type":"search",
      "id":"5",
      "attributes":
      {
        "searchTerm":"search a"
      }
    }
  ]
}

HTTP Request

PUT http://www.fashionphile.test/api/account/searches/{id}

Refresh a search by id for currently authenticated user.

Refresh multiple searches

Example Request

curl -X PUT "http://www.fashionphile.test/api/account/searches/refresh-many" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
          "ids": ["1", "2"]
    }'

Example Response

{
  "data":
  [
    {
      "type":"user_searches",
      "id":"6",
      "attributes":
      {
        "refreshedAt":"2018-02-07T06:26:59-08:00",
        "createdAt":"2018-02-07T06:26:59-08:00",
        "updatedAt":"2018-02-07T06:26:59-08:00"
      },
      "relationships":
      {
        "search":
        {
          "data":
          {
            "type":"search",
            "id":"6"
          }
        }
      }
    },
    {
      "type":"user_searches",
      "id":"7",
      "attributes":
      {
        "refreshedAt":"2018-02-07T06:26:59-08:00",
        "createdAt":"2018-02-07T06:26:59-08:00",
        "updatedAt":"2018-02-07T06:26:59-08:00"
      },
      "relationships":
      {
        "search":
        {
          "data":
          {
            "type":"search",
            "id":"7"
          }
        }
      }
    }
  ],
  "included":
  [
    {
      "type":"search",
      "id":"6",
      "attributes":
      {
        "searchTerm":"search a"
      }
    },
    {
      "type":"search",
      "id":"7",
      "attributes":
      {
        "searchTerm":"search b"
      }
    }
  ]
}

HTTP Request

POST http://www.fashionphile.test/api/account/searches/refresh-many

Refresh multiple searches for currently authenticated user.

curl -X DELETE "http://www.fashionphile.test/api/account/searches/123" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123"

HTTP Request

DELETE http://www.fashionphile.test/api/account/searches/{id}

Delete a search by id for currently authenticated user.

Delete multiple searches

Example Request

curl -X PUT "http://www.fashionphile.test/api/account/searches/delete-many" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{
          "ids": ["1", "2"]
    }'

HTTP Request

POST http://www.fashionphile.test/api/account/searches/delete-many

Delete multiple searches for currently authenticated user.

Other Endpoints

Statistics

curl "http://www.fashionphile.test/api/statistics" \
  -H "Accept: application/x.fashionphile.v1+json"

HTTP Request

GET http://www.fashionphile.test/api/statistics

Returns the weekly stats for buyouts, number of items sold, amount paid to suppliers, etc

Debugging Endpoints

There are two simple endpoints to help debug connecting to the api. One unauthenticated one is the ping endpoint. One authenticated one is the whoami endpoint.

Ping

curl "http://www.fashionphile.test/api/ping" \
  -H "Accept: application/x.fashionphile.v1+json"

HTTP Request

GET http://www.fashionphile.test/api/ping

The ping endpoint will simply return a message of pong.

Whoami

curl "http://www.fashionphile.test/api/whoami" \
  -H "Accept: application/x.fashionphile.v1+json" \
  -H "Authorization: Bearer abc123"

HTTP Request

GET http://www.fashionphile.test/api/whoami

The whoami endpoint will simply return the email address of the authenticated user.

Errors

The following errors are used:

Error Code Meaning
400 Bad Request – Your request sucks
401 Unauthorized – Your token is wrong or invalid
403 Forbidden – The requested endpoint is unavailable to the currently authenticated user
404 Not Found – The specified endpoint could not be found
405 Method Not Allowed – You tried to access an endpoint with an invalid method
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarily offline for maintenance. Please try again later.

BigVision

Authentication

Example Request

curl -X POST \
  http://www.fashionphile.test/api/big-vision/authenticate \
  -H 'accept: application/x.fashionphile.v1+json' \
  -H 'authorization: Bearer abc123\
  -F brand=LouisVuitton \
  -F itemId=12345 \
  -F class=LouisVuittonDamierEbene \
  -F itemType=Product \
  -F 'images[0]=@/path/to/image.jpg'

Example Response

{
  "data": {
    "type": "bigVisionAuthenticateResponse",
    "id": "2017-12-12 10:43:05",
    "attributes": {
      "big_vision_response": {
        "data": [
          {
            "authentication_status": "fake",
            "brand": "LouisVuitton",
            "class": "LouisVuittonDamierEbene",
            "confidence": 100,
            "item_id": "12345",
            "item_type": "Product"
          }
        ]
      },
      "is_authentic": false
    }
  }
}

This endpoint is meant for the Fashionphile Authenticator app and eventually for internal Fashionphile requests. It allows you to send data to BigVision about a bag and get an “is this authentic” response.

Currently, this endpoint is only available to users with a developer role.

Parameters

Attribute Description Type
brand Brand Code from BigVision (use /brands request to get the list of available brands) string
class Special class field from BigVision (use /brands request to get list of available classes) string
images At least one image to send to BigVision for authentication array of images
itemId Either the Product ID or the Pending Item ID int
itemType Can be either Product or pendingItem string

Brands

Example Request

curl -X GET \
  http://www.fashionphile.test/api/big-vision/brands \
  -H 'accept: application/x.fashionphile.v1+json' \
  -H 'authorization: Bearer abc123

Example Response

{
  "data": [
    {
      "type": "bigVisionBrand",
      "id": "LouisVuitton",
      "attributes": {
        "classes": [
          "LouisVuittonDamierEbene",
          "LouisVuittonMonogram"
        ]
      }
    },
    {
      "type": "bigVisionBrand",
      "id": "Chanel",
      "attributes": {
        "classes": [
          "ChanelCaviar"
        ]
      }
    }
  ]
}

Big Vision has created an endpoint to list the possible brands and classes that we can send to them through their /authenticate endpoint. This endpoint will fetch that list. Results are cached for 1 day by default, but you can force a refresh by passing the forceRefresh parameter