Connect to the Mendix API to retrieve Marketplace content data

0
Hey fellow Mendix developers!Last week, I started a project in Mendix 11.6.1 with the purpose of creating an app to help in Life Cycle Management. To achieve that, I tried connecting to the Mendix content API using this doc, but I am running into difficulties authenticating properly and getting a response. I tried using a PAT in the header that I created in my Developer Settings with the scope mx:marketplace-content:read.I failed in both Mendix and with Postman to connect successfully.Does anyone have any experience with this? What steps did (would) you take to solve this issue?I am very curious to learn.
asked
4 answers
0

Hello Sarajan,

What error do you get when you try to to make an api call to market place ? Please verify if you did the below steps.

1.Create PAT with mx:marketplace-content:read. Make sure to copy the PAT without any spaces.
2.To try from postman add a Authorization header with value "MxToken yourgeneratedtoken goes here" (make sure to add MxToken before your token)
3.Make a GET call to this endpoint https://marketplace-api.mendix.com/v1/content
4.Verify if you get a 200 OK response

If you don't get a sucessfully response , post the error message or snapshot of the response you get.

answered
0

Hi Sarajan,

I would recommend troubleshooting the authentication separately in Postman first before integrating the Content API into your Mendix application. This will help identify whether the issue is related to the PAT, request configuration, or the API integration itself.

Here are a few things I would check:

1. Verify the Personal Access Token (PAT)

  • Make sure the PAT was generated under your Mendix Developer Settings.

  • Verify that it includes the required mx:marketplace-content:read scope.

  • Ensure that the token has not expired or been revoked.

2. Check the Authorization Header

Make sure the PAT is passed using the authentication format specified in the Content API documentation.

For example, check whether your request uses the expected Bearer token format:

Authorization: Bearer YOUR_PERSONAL_ACCESS_TOKEN

Also, ensure there are no extra spaces or quotation marks around the token.

3. Verify the API Endpoint and Request

Double-check the Content API endpoint, HTTP method, and required headers against the documentation. Also, check whether the endpoint requires any additional parameters.

4. Test Using Postman First

Before implementing the integration in Mendix:

  • Configure the request in Postman.

  • Add the PAT to the Authorization header.

  • Send a simple GET request to the documented endpoint.

  • Check the HTTP status code and response body.

Pay particular attention to the difference between 401 Unauthorized and 403 Forbidden, as they can indicate different authentication or permission issues.

5. Integrate with Mendix

Once the request works successfully in Postman, you can implement the same configuration in Mendix using a Call REST activity inside a microflow. Store the PAT securely rather than hardcoding it in the microflow or application.

My suggestion: If possible, share the HTTP status code and error response you receive from Postman (without sharing your PAT). That would help narrow down whether the problem is related to token authentication, scope permissions, or the API endpoint.

You can also refer to the official Mendix Content API documentation.

Hope this helps!

answered
0

Hello enthusiastic Mendix techies!

I stumbled upon something of key importance. The Marketplace Content API described in this doc only allows retrieval of company-specific Marketplace content. I am looking for a way to retrieve info on Mendix's own Marketplace content. So, the modules and widgets that can be downloaded at https://marketplace.mendix.com/link/components

Is there a way to access that data with an API to retrieve info on components like the newest version, release dates, StudioPro compatibility, etc. That is really what I'm looking for.

Thank you all for your help.

answered
0

Hi Sarajan,

The first thing I would check is the Authorization header format.

The Mendix Marketplace Content API uses a Personal Access Token (PAT), but the required authentication scheme is MxToken, not Bearer.

According to the official Mendix documentation, the request must contain:

Authorization: MxToken YOUR_PERSONAL_ACCESS_TOKEN

1. Verify the PAT

In your Mendix Developer Settings, create or verify a PAT with the following scope:

mx:marketplace-content:read

This scope is required for Marketplace Content API GET operations.

2. Configure Postman correctly

Create a GET request using the Marketplace Content API endpoint from the official documentation.

Under Authorization, select No Auth.

Then manually add the following headers:

Key

Value

Authorization

MxToken YOUR_PAT

Accept

application/json

Do not use Postman's Bearer Token authentication option, because that generates Authorization: Bearer ..., which is not the required scheme.

3. Test the API

Start with:

GET /content

Use the complete base URL specified in the Marketplace Content API documentation.

Once that works, you can retrieve a specific component and its versions using:

GET /content/{contentId}
GET /content/{contentId}/versions

4. Configure the Mendix REST call

In Studio Pro:

  1. Create a microflow.

  2. Add a Call REST Service activity.

  3. Select the GET method.

  4. Configure the complete Marketplace Content API URL.

  5. Add the Authorization header:

'MxToken ' + $YourPAT
  1. Configure the response handling using an import mapping or store the response as a string for initial testing.

Store the PAT securely rather than hardcoding it in the microflow.

5. Troubleshooting

If authentication still fails:

  • 401 Unauthorized: Check the token value, expiration, and Authorization header format.

  • 403 Forbidden: Verify the PAT scope and the account's access to the requested content.

  • 404 Not Found: Verify the API base URL and resource path.

  • Network/TLS error: Check proxy, firewall, and certificate configuration.

Also, the OpenAPI/Swagger specification displayed in the documentation cannot be executed directly from that documentation page. Use Postman or your Mendix REST activity instead.

Official documentation:

https://docs.mendix.com/apidocs-mxsdk/apidocs/content-api/

My recommendation: First test the API in Postman using Authorization: MxToken YOUR_PAT. Once you receive a successful response, reproduce the same request in Mendix using Call REST Service.

If it still fails, please share the HTTP status code and response body (without exposing your PAT).

Hope this helps! If you find this answer helpful, please mark it as the accepted answer.

answered