Merchant API - shopwareDowntown/downtown GitHub Wiki

Merchant-API

Getting all available authorities

GET /merchant-api/v1/authorities

Login

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)

POST /sales-channel-api/v1/customer/login

Request

{
    "username": "EMAIL",
    "password": "PW"
}

Response

{
    "sw-context-token": "xxxx"
}

Register

POST /merchant-api/v1/register

Request

{
	"publicCompanyName": "Company Name",
	"email": "[email protected]",
	"password": "test1234",
	"salesChannelId": "ID FROM authorities CALL"
}

Response

Success, need to confirm double optin mail to login

Reset Password

POST /merchant-api/v1/reset-password

Request

{
	"email": "[email protected]"
}

Reset Passwword Confirm

POST /merchant-api/v1/reset-password-confirm

Request

{
	"token": "TOKEN FROM MAIL",
        "newPassword": "new password"
}

Industries API

Requires sw-access-key and sw-context-token from login

GET:/merchant-api/vi/industries

Use this to map to the profile categoryId

[
   ...
   {
      "id": "f66b32afe0ea485880bdab239480af35"
      "name": "Clothing & Shoes"
   },
   ...
]

Profile API

Requires sw-access-key and sw-context-token from login

GET:/merchant-api/v1/profile reading the currently logged in merchants data

"""
{
    "public": false,
    "publicCompanyName": "FOO",
    "publicPhoneNumber": null,
    "publicEmail": null,\n
    "publicOpeningTimes": null,
    "publicDescription": null,
    "publicWebsite": null,
    "firstName": null,
    "lastName": null,
    "street": null,
    "zip": null,
    "city": null,
    "country": null,
    "email": "[email protected]",
    "phoneNumber": null,
    "customerId": "dfbf7acb8857430a90ccbf50a45e2d98",
    "customer": null,
    "salesChannelId": "98432def39fc4624b33213a56b8c944d",
    "salesChannel": null,
    "categoryId": null,
    "category": null,
    "products": null,
    "shippingMethods": null,
    "orders": null,
    "versionId": null,
    "translated": [],
    "createdAt": "2020-03-27T06:39:56+00:00",
    "updatedAt": "2020-03-27T06:39:56+00:00",
    "id": "a282c5af7e2e467581b967043537d44b",
}

PATCH:/merchant-api/v1/profile update the profile

{
    "public": true,
    "publicCompanyName": "publicCompanyName",
    "publicPhoneNumber": "publicPhoneNumber",
    "publicEmail": "publicEmail",
    "publicOpeningTimes": "publicOpeningTimes",
    "publicDescription": "publicDescription",
    "publicWebsite": "publicWebsite",
    "categoryId": "f66b32afe0ea485880bdab239480af35",
    "firstName": "firstName",
    "lastName": "lastName",
    "street": "street",
    "zip": "zip",
    "city": "city",
    "country": "country",
    "email": "email",
    "password": "password",
    "phoneNumber": "phoneNumber"
}

Product List

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

GET /merchant-api/v{version}/products

You can apply query parameters like limit or offset. The total value is always ignoring the limit.

Product Create

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

POST /merchant-api/v{version}/products

Request

{
	"name": "Test",
	"price": "5",
	"stock": 0,
	"tax": "7",
	"description": "Test",
        "productType": "product",
        "active": 1
}

productType has to be "product", "service", "voucher"

Image can be send as media[] with multipart form. Yes, this has to be an array! The first submitted media will always be the cover.

Product Update

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

POST /merchant-api/v{version}/products/{id}

Request

Same as above. Note: Previously set medias are replaced!

Product Delete

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

DELETE /merchant-api/v{version}/products

Orders-API

Orders List

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

GET /merchant-api/v{version}/orders

Request

{
    "limit": 2,
    "offset": 1,
    "state": "completed" // open, completed
}

Orders Detail

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

GET /merchant-api/v{version}/order/{orderId}

Order Finish

Required Headers:

  • sw-access-key (Access Key FROM authorities CALL)
  • sw-context-token (Token from Login)

PATCH /merchant-api/v{version}/order/{orderId}/done