Skip to main content

#MuleSoft Design Center / API Designer0 discussing

Questions and answers about MuleSoft Design Center/API Designer, best practices, and use cases.

Hi,

 

When editing files in the API Design Center, files keep getting autosaved and auto committing to our GitHub-connected repo. How do I disable that by default, so the developer gets to personalize their commit message and etc?

 

Thanks

1 answer
0/9000
3 answers
  1. Manish Kumar Yadav (Hitachi Energy) Forum Ambassador
    Jan 13, 11:29 PM
    Yes,Anypoint platforms provide 30 days trial access . Make sure if your account did not got expired else you will get same error.
0/9000

what i did :

 

anypoint > designcenter > create app >

* add http listener with path : /hello and method GET

* add logger

 

deploy application at the top

after it's deployed i click the dots at the right and copy-link

in the new browser window past the url and add the path /hello to it.

 

this gives the next error :

502 Bad Gateway

We couldn't find any Cloudhub application listening on this API.

 

when i test the application with a non-existing path :

http://my-app.cloudhub.io/hellotest

error : No listener for endpoint: /hellotest

 

so something is deployed

at the bottom-left i also don't see anything weird in the log

 

at management center > runtime manager i also see the app deployed

 

default environment is sandbox.

 

anyone knows what could be going wrong ?

and maybe even more usefull, any place where i could error track these kind of situations ?

5 answers
  1. Jan 6, 2018, 11:39 PM

    Hello Rajeev,

     

    This gives me the same error.

    The application url over there is the same as the copy-link i used.

     

    In the runtime manager the app is deployed in DESIGN and status is started.

    I already stop/started it, doesn't help either

     

    I do see in the log it has worked for 1 invoke, after that i constantly gives me the same error again.

0/9000

I am creating REST API for that i designed a RAML file which just get the details from database and post/insert the new contacts into it.My issues are:

1. I am getting all the table details but unable to get specific user details.

2. Unable to insert the new contact details to the database using post method.

3. Need a query so that i can insert the data into DB.

4 answers
  1. May 12, 2016, 7:19 PM

    Please post your flow xml

0/9000

how to call a mule flow from java web application. My requirement is i have a form requesting for something when i submit the form i need to trigger the mule application how i need to trigger the application.

 

please help me out ASAP..

 

thanks in advance.

3 answers
  1. Nov 19, 2018, 8:20 PM

    @tharunvfx This is very simple to implement.

    You can expose your mule application as an API which will get the data as an input and get triggered.

    Whenever you submit the web form, you will post the data to the mule application with the service url and the mule application will automatically be called and triggered.

    For example, let us assume, your Mule API has following url:

     

    https://abcTest/yourPath

    Now you can POST and submit the data to this url from the web form and the Mule application will be triggered and received the form data as input payload

0/9000

I am unable to decide how to use the design center. There are 3 options

Mule app

API specification

API fragment (trait, resource type, liberary, data type, user documentation, example, annotation type, security scheme)

 

I do not know which of these would give the editor options in the define api in the api designer explained here

https://training.mulesoft.com/user/consume/course_pathway/0e22fabf-65c0-31df-b82e-6ee8e88e9370/3191/8a6464b4-62ba-33ab-87aa-46e5d361487f?complete=0&tab=overview

3 answers
0/9000

We are trying to use free jars of mule and host it in a standalone java web application (hosted on an in-house tomcat server). The web-application has some web-pages, apis. In one api call, we would like to call a mule flow with passed values. We are able to host the mule flow as a war, but when we try to package them with the existing web-app, we can not find how to call it. Sample simple flow is like this -

 

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"

xmlns:spring="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd

http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">

<flow name="SampleFlow">

<logger message="===============Logging from Mule Flow =================== # [payload]" level="INFO" doc:name="Logger"/>

</flow>

</mule>

 

And we want to call this `SampleFlow` inside a java method so that when `executeFlow()` is called, the `logger` component prints the message with the given `inputValue` as a payload. What we were trying is like this -

 

import org.mule.api.MuleContext;

import org.mule.api.MuleException;

import org.mule.api.config.ConfigurationException;

import org.mule.api.lifecycle.InitialisationException;

import org.mule.config.spring.SpringXmlConfigurationBuilder;

import org.mule.context.DefaultMuleContextFactory;

public class ......

{

.....

public executeFlow(String inputValue)

{

String wsStatus = "Received";

....

DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();

SpringXmlConfigurationBuilder configBuilder;

MuleContext muleContext = null;

try {

configBuilder = new SpringXmlConfigurationBuilder("SampleFlow.xml");

muleContext = muleContextFactory.createMuleContext(configBuilder);

muleContext.start();

 

[Something would be here to call SampleFlow]

} catch (InitialisationException | ConfigurationException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (MuleException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

 

We do put the following lines in the `web.xml`.

 

<context-param>

<param-name>org.mule.config</param-name>

<param-value>http_test.xml</param-value>

</context-param>

<listener>

<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>

</listener>

10 answers
  1. Feb 19, 2017, 7:23 PM

    @plymouth_rock You need to get the flow name in your Java class :-

     

    muleContext.getRegistry().lookupFlowConstruct("Your flow name");

     

    Then you can call and process the flow in your java class:-

     

    MuleEvent muleEvent= new DefaultMuleEvent(new DefaultMuleMessage(null,muleContext),MessageExchangePattern.REQUEST_RESPONSE,flowCon);

    muleEvent.getMessage().setPayload("your payload");

    response = flow.process(muleEvent);

0/9000

I have an API Specification designed in YAML using OAS 3.0.3. One field ex: customerId is defined as array of strings as below.

​

I want to pass comma separated values in the customerId field as part of query parameters. Ex: ?customerId='594918104','037833100','023135106'

​

That is the reason, style is set to "form" and explode to "false".

Reference from here: Describing Parameters (swagger.io)

​

name: customerId

in: query

description: Customer ID

required: false

schema:

type: array

items:

type: string

pattern: "^[A-Z0-9]+$"

minLength: 9

maxLength: 9

maxItems: 100

style: form

explode: false

example: ['594918104','037833100','023135106']

​

APIKit throws an error when I pass comma separated values in the customerId field. It works only if I repeat the query parameter name for each value. Same behavior when I test it using Mocking Service in Design Center.

ex: ?customerId=594918104&customerId=037833100&customerId=023135106

​

I do not want to repeat the key since the URL will get too long and it can potentially contain 100 values. That's why I am looking for passing the values with comma separated.

​

​Expected Behavior: ?customerId='594918104','037833100','023135106'

​

​

Appreciate for any help you can provide.

​

​

2 answers
  1. Apr 24, 2023, 3:43 PM

    thank you @Manish Yadav​ for checking.

0/9000

Exists in RAML definition any naming convention for the values in a enum definition?

 

Looking for the same information in Open API, it seems in examples provided that the convention is lower case and in Google API or GIT Hub API, seems to be upper underscore definition.

 

Thanks

1 answer
  1. Anurag Sharma (Nagarro) Forum Ambassador
    Oct 29, 2023, 7:32 AM

    Hello @RAUL DEL RIO LOPEZ​ 

     

    RAML (RESTful API Modeling Language) and OpenAPI are both specifications for defining APIs. They provide ways to describe resources, methods, parameters, and responses so that both client-side and server-side developers have clear and standardized documentation. When it comes to enum naming conventions, neither RAML nor OpenAPI enforces a specific naming convention for enum values. The naming often relies on the conventions used within the organization or the specific use case.

    However, here are some common practices:

     

    Lowercase- As you observed, many examples in OpenAPI use lowercase for enum values. This might be influenced by some programming languages or JSON standards where lowercase is a common convention for string literals.

    Example:

    parameters:

    name: status

    in: query

    schema:

    type: string

    enum: [active, inactive, archived]

    Similarly you can use UPPER_SNAKE_CASE and Camel Case.

    When deciding on a naming convention for your enum values in RAML or OpenAPI:

    • Consistency is Key. Whatever convention you choose, be consistent across your API definitions. This helps consumers of your API understand and predict the possible values.
0/9000