MuleSoft Training: API Design
- Recent Activity
- Created Date
- All Questions
- Questions with an Accepted Answer
- Unanswered Questions
- Questions with No Accepted Answer
this is the error, Please help to resolve this
Anurag Sharma (Nagarro) Forum Ambassador
Apr 17, 2023, 3:41 PM hello @Rosie Grath
this is very common issue when you unzip the Anypoint studio in a nested folder location
please unzip in a folder location like this - C:\Users\AnypointStudio
I am Designing a RAML and in that RAML I need to validate a field that it should be an email ?
I built a regex already but not sure what property i should use in RAML to use regex validation.
Anurag Sharma (Nagarro) Forum Ambassador
Mar 12, 2022, 7:44 PM Hello,
to use regex in RAML you have to use a poperty - "pattern". Look at the below example
fieldName:
displayName: fieldName
type: string
pattern: ^[a-zA-Z0-9]*$
here filedName is type of String with a validation (alphanumeric) using regex. same way you can give regex for email.
I have two fields in a JSON request and from those two fields at least one should be in the incoming request.
requirement is that requests should not enter into the API. I am confused about how to restrict/block the request without entering in the API
Anurag Sharma (Nagarro) Forum Ambassador
Mar 8, 2022, 5:49 AM Hello,
You can do it By RAML validations (if you dont have Any idea about RAML),
Please use this links - https://docs.mulesoft.com/api-manager/1.x/tutorial-design-an-api
https://docs.mulesoft.com/api-manager/1.x/design-raml-api-task
request will not enter to you main flows of API , api kit router will throw the error after RAMlL validation if it didnt pass.
use this link for apikit router based API's- https://docs.mulesoft.com/apikit/4.x/apikit-4-raml-flow-concept
Now, create a JSON schema in RAML and appply a validation rule there
let's suppose you have the request as below , create a JSON file with Name (requestValidation.json )
{
field1: "",
field2: ""
}
Then for this create a schema validaiton file (requstValidation.json)as below
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"field1": {
"type": "string"
},
"field2": {
"type": "string"
}
},
"anyOf": [{
"required" : ["field1"]
}, {
"required" : ["field2"]
}]
}
you can validate this schema using this - https://www.jsonschemavalidator.net/
test it by tweaking your input.After this include schmea file in you resource as below example
/account:
post:
body:
application/json:
schema: !include requestValidation.json
example: !include requestValidation.json
for more understanding on desiginig the RAML go thorugh these links also
https://github.com/raml-apis/Uber/blob/staging/api.raml
https://github.com/mulesoft/raml-tutorial-200/blob/master/jukebox-api.raml
I have attached a zip file that you can use to undersatnd RAML designing kind of best practices. (I created this for other user who asked to design a RAML).it doesnt have JSON schema validation but you will get some knowledge.
Happy Learning !!
Regards,
Anurag Sharma
we have two RAML files in the Design center with the same name (small difference)
abc-system-service
abcsystemservice
and both have the same content.in Exchange, we can see it as abc system service.
how do find out that the API published in exchange is related to which RAML in the design center?
Anurag Sharma (Nagarro) Forum Ambassador
Mar 7, 2022, 7:51 PM Hello,
there is an option as below in exchange that you can see when you enter into the abc system sevice there click on view code and it will route you to the design center RAML.
Regards,
Anuarg Sharma
How we can convert iso8583 to json?
Anurag Sharma (Nagarro) Forum Ambassador
Mar 8, 2022, 9:10 AM @Arsh Singh those are the modules that you can import in Mule (i am not sure how to do that) and then it can covert to JSON
I 'm trying to connect to Anypoint Mulesoft's API and I 'm needing a sourceProfileId or sourceXmlBookingId to apply body's json. How can I find it?
Thank you for your consideraion
When I try to deploy the application to Cloudhub it gives me 2 errors:
1- Your trial has recently ended. If you would like to learn more about subscribing to Anypoint Platform, please contact our sales team by answering a few questions at www.mulesoft.com/contact
2- Application training4-american-ws-******** failed to deploy to CloudHub
Organization is expired and cannot perform this action.
Mar 26, 2024, 9:22 AM Hi @Karim Mahmoud,
The trial account is only valid for 30 days, and can't be extended. You can sign-up for a new trial account using the same email address (or a different one if you'd like). You would need to either transfer the assets from the old trial account to the new one, using download and import menu items, or import the solutions from the student files. Then you would need to add the new Anypoint credentials to Studio and update the API reference made in module 4.
I haven't the choice to create a new mule app on the design center. See in attachment the screenshot.
It was working well 6 months ago. Have I something to do to resolve this issue ?
Aug 23, 2023, 11:52 AM Hey,
It's frustrating when something that was working fine suddenly throws a curveball, right?
Based on my experiences, I'd suggest checking if there have been any updates or changes to the deployment process. I've read a few points here: https://www.tellerreport.com/tech/2023-04-03-how-5g-technology-is-revolutionizing-app-development.SJG_vqDdWh.html. And started to figure it out. It sounds like you're trying to deploy applications from the now-deprecated Flow Designer in Design Center. That might be causing the hiccup. Nowadays, you should consider creating a new Mule app directly in Design Center and go through that route. It's likely that the old process might not be fully compatible with the current system.
Remember, applications can now only be deployed to the Design environment from the Design Center. Once deployed, you can manage them in Runtime Manager. If you haven't tried this approach yet, give it a shot and let us know how it goes!
I Am a fresher and working On mule Projects. I have a requirement that I need to create RAML more reusable so fewer code lines will be there. I need to create a Resource Type with all HTTP methods like POST GET DELETE.
someone can help me on this with some details?
Anurag Sharma (Nagarro) Forum Ambassador
Mar 8, 2022, 2:00 PM Hello,
You can use it like this
/accounts:
type:
collection:
exampleReference1: !include /examples/account.json
exampleReference2: !include /examples/account1.json
first example is refering to GETand second to POST