Loading

how to upload a RAML to Exchange via the API

Julkaisupäivä: Jul 25, 2025
Tehtävä

GOAL

This article goes over how to upload a RAML File and publish it to Exchange using the API Designer Experience API. If you are trying to automate using bash scripts with Design Center and Gitlab or Github, these cURL requests will help.

Vaiheet

All the calls below require the following information:

  1. Create a project using API Designer Experience API : 
curl 'https://anypoint.mulesoft.com/designcenter/api-designer/projects' 
-H 'Authorization: Bearer <token>' 
-H 'x-organization-id: <org-id>' 
-H 'x-owner-id: <owner-id>' 
-H 'accept: application/json' 
-H 'Content-Type: application/json' 
--data-binary '{"name":"myproject", "classifier":"raml"}' 
--compressed
 
  1.  List all branches (Operation necessary to obtain the IDs of the branches available).
     
curl 'https://anypoint.mulesoft.com/designcenter/api-designer/projects/<project-id>/branches' 
-H 'Authorization: Bearer <token>' 
-H 'x-organization-id: <org-id>' 
-H 'x-owner-id: <owner-id>' 
-H 'accept: application/json' 
--compressed
 

The <project-id> value is obtained on the response received from step 1. 
 

  1.  Acquiring the branch lock (Needed to perform operations over a branch). 
curl 'https://anypoint.mulesoft.com/designcenter/api-designer/projects/<project-id>/branches/<branch>/acquireLock' 
-H 'Authorization: Bearer <token>' 
-H 'x-organization-id: <org-id>' 
-H 'x-owner-id: <owner-id>' 
-H 'accept: application/json' 
-H 'Content-Type: application/json' 
--data-binary '{}' 
--compressed
 

If you want to modify the base RAML file created automatically with the project on step 1 or to create any additional RAML files, perform the step below.
 

  1. Creating a new RAML file or updating the content of an existing one. 
curl 'https://anypoint.mulesoft.com/designcenter/api-designer/projects/<project-id>/branches/<branch>/save' 
-H 'Authorization: Bearer <token>' 
-H 'x-organization-id: <org-id>' 
-H 'x-owner-id: <owner-id>' 
-H 'accept: application/json' 
-H 'Content-Type: application/json' 
--data-binary '[{"path":"/myproject.raml","type":"FILE","content":"#%RAML 1.0\ntitle: API title"}]' 
--compressed
 
  1. Publishing to Exchange.
curl 'https://anypoint.mulesoft.com/designcenter/api-designer/projects/<proejct-id>/branches/<branch>/publish/exchange' 
-H 'Authorization: Bearer <token>' 
-H 'x-organization-id: <org-id>' 
-H 'x-owner-id: <owner-id>' 
-H 'accept: application/json' 
-H 'Content-Type: application/json' 
--data-binary '{"name":"MyProjectName", "apiVersion":"'0.1'", "version":"1.0.0", "main":"api.raml", "assetId":"myasset", "groupId":"<group-id>","classifier":"raml"}' 
--compressed
 

<group-id> is represented by your organization id.
 

Disclaimer: this is provided as a reference for your own usage and it's subject to changes in future API's releases. This will be considered as a custom implementation made by the customer and supported as such

Knowledge-artikkelin numero

001114885

 
Ladataan
Salesforce Help | Article