Exchange API icon

Exchange API

(3 reviews)

Reviews

Reviews for an asset can be created in order to give a review and rate the asset.

Following there are exposed some examples about how to create a new

Before executing the examples, read the Anypoint Platform Token section to know how to obtain the token to be used in the examples. This should be replaced for the value ANYPOINT_TOKEN in each curl example.

The examples have been made by cURL, but optionally, instead of sending HTTP commands with cURL, you can use Postman or another application.

How to create a review for an asset

Here is an example of how to create a review for an asset.
These URL parameters should be replaced
:organizationId: Organization ID of the asset
:groupId: Group ID of the asset
:assetId: Asset ID of the asset
:version: Version of the asset.

Each review has the following content properties. They should be modified after the -d tag:
title: Title of the review
text: The text content of the review
rating: Rating of the review. It is an integer between 1-5

Note: only one review can be done by a minor version and user. That means, if a user did a review for the version 1.0.2, then the review will apply for the minor of the asset 1.0 and no other review can be done for another version of the same minor (1.0.3 for example)

curl 'https://anypoint.mulesoft.com/exchange/api/v2/assets/:groupId/:assetId/:version/reviews' \
  -H 'accept: application/json' \
  -H 'authorization: bearer ANYPOINT_TOKEN' \
  -H 'content-type: application/json' \
  -d '{"rating":5,"title":"Title","text":"review content"}'

A response like this will be retrieved:

  {
    "id":"6ae60a6e-3785-4fbe-8bbe-f44dc46c9138",
    "userId":"2ade6aee-ae1c-44f5-badc-68b6cf2f9345",
    "organizationId":":organizationId",
    "groupId":":groupId",
    "assetId":":assetId",
    "versionId":":version",
    "text":"review content",
    "title":"Title",
    "rating":4
  }

Where the id of the response will be used as reviewId to edit and delete reviews.

How to edit a created review of an asset

To edit a review, the fields explained in how to create a review should be specified (rating, title or text). They should be modified after the -d tag.
Also, the reviewId of the created review should be replaced in the URI.

curl 'https://anypoint.mulesoft.com/exchange/api/v2/assets/:groupId/:assetId/:version/reviews/:reviewId' \
  -X 'PATCH' \
  -H 'accept: application/json' \
  -H 'authorization: bearer ANYPOINT_TOKEN' \
  -H 'content-type: application/json' \
  -d '{"rating":2,"title":"new title","text":"new content"}'

How to delete a created review of an asset

To delete a review, the reviewId of the created review should be replaced in the URI.

curl 'https://anypoint.mulesoft.com/exchange/api/v2/assets/:groupId/:assetId/:version/reviews/:reviewId' \
  -X 'DELETE' \
  -H 'accept: application/json' \
  -H 'authorization: bearer ANYPOINT_TOKEN'

Reviews

DU
Deleted UserApr 4, 2023, 10:15 PM
Relative URLs to other pages
How can we add relative URLs on the Home page that go to other pages of the API specifications that work on both Exchange and Developer Portal? For example, I'd like to add a link to the Summary page. I tried to use ../../console/summary, but it would fail if I click on this without clicking on Home first. In Dev Portal: first time clicking on asset arrives at: https://anypoint.mulesoft.com/exchange/portals/:organizationId/:groupId/:assetId/ clicking on Home: https://anypoint.mulesoft.com/exchange/portals/:organizationId/:groupId/:assetId/minor/1.0/pages/home/ Summary page: https://anypoint.mulesoft.com/exchange/portals/:organizationId/:groupId/:assetId/minor/1.0/console/summary/ similarly in Exchange https://anypoint.mulesoft.com/exchange/:groupId/:assetId/minor/1.0/ https://anypoint.mulesoft.com/exchange/:groupId/:assetId/minor/1.0/pages/home/ https://anypoint.mulesoft.com/exchange/:groupId/:assetId/minor/1.0/console/summary/
DU
Deleted UserAug 15, 2022, 3:41 PM
Categories API Documentation
https://anypoint.mulesoft.com/exchange/api/v2/organizations/{organizationId}/categories example provided in documentation is not correct, it returns 400 bad request with following. { "status": 400, "message": "Must provide acceptedValues for an enum dataType", "details": {} } the correct example could be { "displayName": "Medical Discipline", "acceptedValues": [ "Salesforce" ], "assetTypeRestrictions": ["custom"] }
DU
Deleted UserOct 25, 2021, 12:32 PM
Useful API Documentation
THanks for documenting this , really useful!