Using the API Log
Miles Dinsmore avatar
Written by Miles Dinsmore
Updated over a week ago

This article will not render properly in this window. View the full article by clicking the [] button above.

When integration with your state regulator is turned on, many actions in MJ platform result in API calls to your state integrator in the background in order to keep things synchronized. However, as with any integration over the internet, it is possible that an API call may fail.

Use the Reporting Log to check the result of API calls.

In this article:

Checking the Status of API Calls to Your State Integrator

  1. Open the App Drawer, expand the Integration menu and click Api Transactions.

  2. From the Integrator drop-down menu, select your state integrator.

  3. Click Get Report. The list populates with all API calls and whether they succeeded or failed.

    mceclip1.png

API Method Reference

Each entry in the API Call Endpoint list on the Reporting Log page is the response MJ Platform received from your state integrator after sending it an API call.

Endpoint Method

Description

Meaning of a Successful Response

GET

MJ Platform requested information from your state integrator.

MJ Platform verified the properties of a collection of entities in the background, such as what strains are available, or the quantity of some inventory.

POST

MJ Platform sent information to your state integrator to add an entity, such as a plant, a location, a strain, or an inventory item.

The entity was successfully added to your state integrator's records, or authentication was successful.

PUT

MJ Platform sent information to your state integrator to update the properties of an entity.

The entity was successfully updated in your state integrator's records to match MJ Platform.

The sequence of API calls is as follows:

  1. When you save changes on certain pages, MJ Platform sends a series of GET calls to your state integrator to get information on the current state of some entities, such as product masters, strains, or packages.

  2. Your state integrator sends a response to each GET call.

  3. MJ Platform then sends a series of POST or PUT calls to your state integrator to update your state integrator's records.

  4. Your state integrator sends a response for each POST or PUT call to indicate whether they were successful.

Investigating Failed API Calls

If you see a failed API call, you will see an error code listed.

mceclip0.png

Common Error Response Codes

Look at the table below to see what the error code means.

Code

Description

0

A connection could not be established to the state integrator. This can occur if either you or the server of your state integrator is experiencing a slow/unreliable internet connection. This error usually indicates that no data was sent to them.

400

Your state integrator could not do what the API call requested. This is usually due to a data mismatch or missing information. For example, when adding a product master to MJ Platform, it will attempt to push it to your state integrator, but if the product's strain is missing from your state integrator's records, your state integrator will not be able to process the request to create the product master.

401

Your state integrator rejected the API call because the authentication (credentials such as API key, license number, password, etc.) you provided to MJ Platform is invalid or expired.

403

The account for your state integrator associated with the authentication provided to MJ Platform does not have permission to access the requested entity. Log into your state integrator's site and select all permissions for yourself to resolve the issue.

404

The requested resource doesn't exist in your state integrator's records. This is usually due to an entity in MJ Platform (such as a strain) missing from your state integrator's records. If the error is associated with a GET call, it is not necessarily problematic. MJ Platform sometimes uses GET calls to simply check whether the entity exists in your state integrator's records.

422

Information in a POST call is incorrect or missing. This might happen if information about an entity is not filled out properly in MJ Platform. This might also happen if the state integrator credentials entered into MJ Platform are incorrect or expired.

429

Your state integrator cut off the request because too many were sent at once. This can happen if you attempt to push changes to too many entities at once.

500

An error occurred on your state integrator's end.

Viewing Error Details

You can click View Details to see the full response from your state integrator.

Note: Failed GET calls are not always problematic. The calls that will affect data in your state integrator's records are POST and PUT.

Here is a sample failed call:

mceclip7.png

The information in the Data Sent section shows the affected entity, such as a product master or strain.

The text at the bottom of the Data Received section shows the reason the state integrator gave for the failed API call. In the sample above, the call failed because the user attempted to push a product master to Metrc but didn't yet map the product master's subcategory to Metrc.

Integrator-Specific APIs

Each integrator has its own set of API endpoints that MJ Platform uses to communicate with it. These are the endpoints you will see in the API Log.

Did this answer your question?