Error Handling

When requests have to be answered with non-success status codes (4xx, 5xx), the API will return some details in the response body according to the “Problem Details for HTTP APIs” standard defined in RFC 7807.

Depending on the Accept header, the response will be formatted as JSON or XML.

Client applications should handle specific error conditions based on the Type URI, as the type URI will remain constant, while the title or detail texts which could change over time.

Exceptions

  • The endpoint for submitting orders will answer 400, 403 and 404 responses with a OrderResponse Spectaris XML document, instead of a Problem Details document, as the OrderResponse document type can represent reasons for rejecting orders.
  • HTTP 404 responses for requests not matching any of the API URL patterns have an empty response.
  • Gateway Timeouts (HTTP 504) currently have a HTML response body (without any meaningful information).

Examples

JSON

{
  "type": "https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#required-oauth-scope-missing",
  "title": "Required OAuth Scope Missing",
  "status": 403,
  "detail": "Required OAuth scope is missing. One of the following scopes is required: l4o.supplierreg.read."
}

XML

<?xml version="1.0"?>
<problem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:ietf:rfc:7807">
  <type>https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#required-oauth-scope-missing</type>
  <title>Required OAuth Scope Missing</title>
  <status>403</status>
  <detail>Required OAuth scope is missing. One of the following scopes is required: l4o.supplierreg.readwrite.</detail>
</problem>

Contacting LOOK4 Support

If you want to contact our support about a specific request returning a non-success status code, please include the request ID that is provided in the X-Request-Id HTTP header in each API response.

Problem Types

Problem Details documents contain a problem type attribute containing a HTTP URL resolving to HTML documentation that explains how to resolve the problem.

Following you will find all problem types used by the API.

Required Order Filters Missing

HTTP Status Code:
 400
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#required-order-filters-missing
Description:clientOrderID, or clientOrderItemID, or both, must be provided as a filter.

ClientID or Verification Data Invalid

HTTP Status Code:
 400
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#clientid-or-verification-data-invalid
Description:The requested clientID is either invalid, or the provided verification details (postal code) does not match the data provided by the supplier.

Invalid SKU Type

HTTP Status Code:
 400
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#invalid-sku-type
Description:The requested SKU (Stock Keeping Unit) type is not supported in this context. See the message details for a list of allowed types.

SKU does not match requested SKU type

HTTP Status Code:
 400
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#sku-does-not-match-requested-sku-type
Description:The supplied sku is not compatible with the requested skuType.

Invalid B2BOptic Catalog

HTTP Status Code:
 400
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#invalid-b2boptic-catalog
Description:The provided catalog file (it’s name or content) was rejected. The reasons are listed in the error message details attribute.

Invalid SPECTARIS XML document

HTTP Status Code:
 400
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#invalid-spectaris-xml-document
Description:The provided XML file was rejected. The reasons are listed in the error message details attribute.

Bearer Token Invalid

HTTP Status Code:
 401
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#bearer-token-invalid
Description:An access token was provided in the authentication header, but it was invalid. Most probably, the access token has expired. If available, use a refresh token to claim a fresh access token. See the LOOK4 ID documentation for details.

Bearer Token Required

HTTP Status Code:
 401
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#bearer-token-required
Description:Please make sure that the request is sent authenticated (i.e. the access token is provided in the Authorize header), and that the access token is requested including the required scope. The required scope is included in the detail attribute of the message.

Required OAuth Scope Missing

HTTP Status Code:
 403
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#required-oauth-scope-missing
Description:Required OAuth scope is missing. The required scope is included in the detail attribute of the message.

Unauthorized supplierID

HTTP Status Code:
 403
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#unauthorized-supplierid
Description:The requested supplierID is not allowed for the required scope in the current security context.

Unauthorized clientID

HTTP Status Code:
 403
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#unauthorized-clientid
Description:The requested clientID is not allowed in the current security context.

Company Entry Required

HTTP Status Code:
 403
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#company-entry-required
Description:This operation is only available to users that are assigned to a company entry in LOOK4 Optics.

Configurator Widget Unlicensed

HTTP Status Code:
 

403

Type:

https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#configurator-unlicensed

Description:

The client software you are using is not licensed to use the full version of the Configurator Widget feature and its related API calls.

Please ask your LOOK4 contact for licensing options.

For the free version (without private label articles and pricing information), use the Configurator Widget or all the configurator API endpoints without OAuth token (no Authentication header).

supplierID Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#supplierid-not-found
Description:The requested supplierID is not found. Refer to Catalog Infos (Suppliers and Catalogs Listing) for available suppliers.

catalogID Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#catalogid-not-found
Description:The requested combination of supplierID and catalogID is not found. Refer to Catalog Infos (Suppliers and Catalogs Listing) for available catalogs.

articleID Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#articleid-not-found
Description:The requested articleID is not found in this catalog, or the current user is not allowed to see it.

No Barcode List for This Catalog

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#no-barcode-list-for-this-catalog
Description:No barcode list is available for this catalog. Only catalogs listed with a _downloadBarcodeListUrl attribute in Catalog Infos (Suppliers and Catalogs Listing) have barcode lists available for download.

Order Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#order-not-found
Description:No order found matching the given supplierID, clientID and filters. or the OAuth scope used does not allow to see it. This could be the case if the scope used is l4o.orders.read.sameclient, and the requested order was not submitted by the same OAuth client.

ASN Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#asn-not-found
Description:No Advanced Shipping Note document found matching the given supplierID and advancedShippingNoteID, or the current user is not allowed to see it, or the OAuth scope used dos not allow to see it. The scope-based restriction applies if the scope used is l4o.orders.read.sameclient, and the requested ASN includes orders that were not submitted by the same OAuth client.

InventoryReport Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#inventoryreport-not-found
Description:No InventoryReport document found matching the given supplierID, clientID and inventoryReportID, or the current user is not allowed to see it.

Invoice Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#invoice-not-found
Description:No Invoice document found matching the given supplierID, clientID and invoiceID, or the current user is not allowed to see it.

SalesReport Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#salesreport-not-found
Description:No SalesReport document found matching the given supplierID, clientID and salesReportID, or the current user is not allowed to see it.

SKU Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#sku-not-found
Description:No Stock Keeping Unit (SKU) matching the requested SKU type was found.

clientID Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#clientid-not-found
Description:clientID not found in the current context.

B2BOptic Catalog Not Found

HTTP Status Code:
 404
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#b2boptic-catalog-not-found
Description:B2BOptic catalog with the provided filename could not be found, or accessing the catalog is not allowed in the current security context.

B2B Optic Catalog Already Exists

HTTP Status Code:
 409
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#b2boptic-catalog-already-exists
Description:The provided filename is already present and must not be replaced. Please try again using a new name (version number).

InventoryReport Document Already Exists

HTTP Status Code:
 409
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#inventoryreport-already-exists
Description:The combination of supplierID, clientID and inventoryReportID in the uploaded document is not unique.

Invoice Document Already Exists

HTTP Status Code:
 409
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#invoice-already-exists
Description:The combination of supplierID and invoiceID in the uploaded document is not unique.

SalesReport Document Already Exists

HTTP Status Code:
 409
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#salesreport-already-exists
Description:The combination of supplierID, clientID and salesReportID in the uploaded document is not unique.

Server Error

HTTP Status Code:
 500
Type:https://docs.look4optics.com/webservices-v2/webservices/errortypes.html#server-error
Description:An unexpected error occurred. Please try again later. If you want to contact our support about this problem, please include the request ID that is provided in the detail attribute of this message, and in addition in the X-Request-Id HTTP response header.