API End Points

Introduction

This area of the API help documents the API end points. These are split into two areas. The first being authentication related end points.


Authentication End Points

These end points are related to authentication and retrieving a auth token.

Authentication

API Authentication end points. Note that the document format for the token request follows that of the OAuth 2.0

API Description
POST v{version}/auth

If the request for an access token is valid, the authorization server needs to generate an access token (and optional refresh token) and return these to the client, typically along with some additional properties about the authorization.

GET v{version}/auth/validate

A get request to test if your token is valid.

Debugging End Points

These end points allow clients to help debug error responses and check connectivity.

Ping

Test controller. The methods here can be used to check your connectivity to the Procure Wizard API. No authentication is required.

API Description
GET v{version}/ping

A get request to test connectivity.

POST v{version}/ping

A post request to test connectivity.

Errors

Error responses. These responses are used for test purposes, to allow clients to check error handling. It gives endpoints to consumers of the API that will generate errors to help their development. All errors returned are in adherence to the JSON:API specification. For more information see https://jsonapi.org/format/#errors.

API Description
GET v{version}/errors/bad-request

A 400 response. Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. For example if query parameters are sent with the request that are not supported, a 400 bad request response would be returned.

GET v{version}/errors/not-authorized

Not authorized 401 response. This error is returned if the current requested is not authorized to access the requested end point. This could be because a auth token has expired, or it could be that an endpoint is requested that the API client has not been granted permission to access.

GET v{version}/errors/forbidden

A 403 forbidden response will be returned if a clients request has been forbidden by the server. For example, trying to access a resource that belongs to another API client user will return this error.

GET v{version}/errors/not-found

404 response. This error is returned if a requested endpoint can not be found. Note that a 404 is not returned if the data of a resource requested just happens to be empty. In those scenarios the data object is either empty, or an empty array.

GET v{version}/errors/method-not-allowed

Method not allowed 405 response. This error occurs if the wrong HTTP method is used. This will stop a HTTP DELETE request to what should be a HTTP GET request for example. To simulate this scenario, send anything other than a GET request to this endpoint.

GET v{version}/errors/conflict

A 409 conflict response. This error occurs when there is a conflict between client and server. If a client tries to post a data object that the server does not understand a 409 conflict response would be returned.

GET v{version}/errors/internal-server-error

When a SERVER level error has occured we will return a 500 response. A 500 error means that there is a proble with the Procure Wizard API.

Core End Points

The system data end points for retrieving, creating and updating Procure Wizard data.

Allergens

API for Allergens.

API Description
GET v{version}/allergens

Gets a list of supported allergen types that Procure Wizard supports.

GET v{version}/allergens/treenuts

Gets a list of supported allergen types for tree nuts only.

GET v{version}/allergens/gluten

Gets a list of supported allergen types for gluten types only.

GET v{version}/products/{productId}/allergens

Gets an allergen response for a specific product.

GET v{version}/dishes/{dishId}/allergens

Gets an allergen response for a specific dish.

GET v{version}/recipes/{recipeId}/allergens

Gets an allergen response for a specific recipe.

GET v{version}/menus/{menuId}/allergens

Gets an allergen response for a specific menu.

Categories

Category API controller.

API Description
GET v{version}/categories/{categoryId}

Gets a category response for a specific category.

GET v{version}/categories

Gets the category structure for the Purchaser as an array response.

GET v{version}/categories/mdr

Gets the category structure for the Purchaser as an array response. This contains only categories that have been used with MDR. This is categories that have products in that, which those products have been used in a dish or recipe.

Dietary Suitability

API for Dietary Suitability.

API Description
GET v{version}/dietary-suitability

Gets a list of supported dietary suitability details that Procure Wizard supports.

GET v{version}/dishes/{dishId}/dietary-suitability

Gets an allergen response for a specific dish.

GET v{version}/recipes/{recipeId}/dietary-suitability

Gets an allergen response for a specific recipe.

GET v{version}/menus/{menuId}/dietary-suitability

Gets an allergen response for a specific menu.

Dishes

API for Procure Wizard dishes.

API Description
GET v{version}/dishes

Gets all dishes for the current purchaser.

GET v{version}/dishes?updatedAfter={updatedAfter}

Gets all dishes for a Purchaser that have been updated after the specified date.

GET v{version}/dishes/{dishId}

Get an individual dish.

GET v{version}/dishes?unitId={unitId}

Gets all dishes for a Purchaser that are attached to a specific unit.

POST v{version}/dishes/{dishId}

Updates an individual dish.

GET v{version}/menus/{menuId}/dishes

Gets a dish array response by a specific menu.

GET v{version}/menus/{menuId}/dishes?updatedAfter={updatedAfter}

Gets a dish array response by a specific menu filtered by dishes created or altered after a specific date.

GET v{version}/tills/{tillId}/dishes

Gets a dish array response for a specific till.

Ingredients

API for Procure Wizard dishes.

API Description
GET v{version}/ingredients/{ingredientId}

Gets an ingredient response by its ID.

GET v{version}/dishes/{dishId}/ingredients

Gets an ingredients response for a specific dish.

GET v{version}/recipes/{recipeId}/ingredients

Gets an ingredients response for a specific recipe.

API for Procure Wizard menus.

API Description
GET v{version}/menus/{menuId}

Get an individual menu.

GET v{version}/menus

Gets all menus for the current authenticated Purchaser.

GET v{version}/menus?fromMenuId={fromMenuId}

Gets all menus for the current authenticated Purchaser starting from a specific menu. The menus returned in the response will only be a descendant of the a menu specified.

Nutrition

API for Nutrition.

API Description
GET v{version}/nutrition

Gets a list of nutrition types that Procure Wizard supports.

GET v{version}/products/{productId}/nutrition

Get a product nutrition response for a specific product.

GET v{version}/dishes/{dishId}/nutrition

Get a dish nutrition response for a specific dish.

Products

API for Allergens.

API Description
GET v{version}/products/{productId}

Gets a single product.

GET v{version}/products/mdr

Gets a product array response containing all products for a purchaser that are currently used in any menus (i.e. in any recipes or dishes).

GET v{version}/dishes/{dishId}/products/{limited}

Get a product array response for a dish.

GET v{version}/recipes/{recipeId}/products

Get a product array response for a recipe.

Recipes

API for Procure Wizard recipes.

API Description
GET v{version}/recipes

Gets all recipes for a Purchaser.

GET v{version}/recipes?updatedAfter={updatedAfter}

Gets all recipes for a Purchaser that have been updated after the specified date.

GET v{version}/recipes/{recipeId}

Get an individual recipe.

GET v{version}/dishes/{dishId}/recipes

Gets a dish array response by a specific menu.

Till Management

API for Procure Wizard Till Management.

API Description
GET v{version}/tills

Gets all tills for the current authenticated Purchaser.

GET v{version}/tills/{tillId}

Gets a single till with all related data.

GET v{version}/tills/{tillId}?updatedAfter={updatedAfter}

Gets a single till with all related data filtering out dishes updated or created before the supplied parameter.

Unit Measure

Unit of measures API end points.

API Description
GET v{version}/unit-measures

Gets all available unit of measure data from Procure Wizard.

GET v{version}/unit-measures/{unitMeasureId}

Gets a unit measure response for a specific unit of measure.

GET v{version}/products/{productId}/unit-measure

Gets a unit of measure response for a specific product.

Webhooks

API for Webhooks.

API Description
GET v{version}/webhooks/types

Gets a WebhookEventTypeArray response for all the current webhook types the Procure Wizard webhook system allows.

GET v{version}/webhooks/types/subscription

Gets a WebhookEventTypeArray response for all the current webhook types a user is subscribed to.

POST v{version}/webhooks/types/subscription

Subscribe to a specific webhook.

DELETE v{version}/webhooks/types/subscription

Unsubscribe to a specific webhook.