Skip to main content

#Anypoint Studio0 discussing

Hi All,

I am hoping someone can help me as I have no idea where to start! 

I have been tasked with extracting data from a company (MOZO) that provides API endpoints via graphQL into our Salesforce org.

I can use Altair and Postman to send the POST method to get the data, but am stuck when it comes to doing this in Anypoint Studio so that I can insert it in Salesforce.

Some details:

  • url provided by MOZO is the following: https://marketview.mozo.com.au/graphql/{access token}
    • this url doesn't change
      • How can I reference this as an endpoint to send a payload of the graphQL quey to it in Anypoint? 
  • Payload is sent as POST method (which is fine) and sent as a graphQL query
    • eg. { homeLoans ( limit: 10) { additionalRepayments}}
      • How can I send this as the body of the payload to then get the response?

I am so stuck as I have only ever built applications that create the endpoint for someone to send ME the payload, not needing to send a payload to a pre-existing endpoint url, and I have never used graphQL before so i am not sure if there are extra complexities involved?

 

Any help would be much appreciated! #Anypoint Studio #MuleSoft #GraphQL #Help

4 answers
  1. Manish Kumar Yadav (Hitachi Energy) Forum Ambassador
    Nov 4, 2023, 7:48 AM

    Thanks @Sabrina Barnes for notifying me,

     

    Hello Melissa,

     

    Please follow the below steps,

     

    • First build the GraphQL query using DataWeave like below and store it into some variable and then use that variable in the HTTP requester payload body while calling the GraphQL API

    %dw 2.0

    output application/json

    ---

    {

    "query": "{ homeLoans (limit: 10) { additionalRepayments }}"

    }

    Thanks,

    Manish Yadav

    MuleSoft Forum Moderator

0/9000

When I click run project, the error shows: #Anypoint Studio

Failed to execute goal org.mule.tools.maven:mule-maven-plugin:4.0.0:process-classes (default-process-classes) on project training4-american-ws: Execution default-process-classes of goal org.mule.tools.maven:mule-maven-plugin:4.0.0:process-classes failed: There was '1' error while parsing the given file 'training4-american-ws.xml'.

 

Please help me on this issue.

2 answers
  1. Manish Kumar Yadav (Hitachi Energy) Forum Ambassador
    Nov 19, 2023, 2:00 PM

    Hello,

    Please open training4-american-ws.xml and check the red cross to find the solution! it seems you have a xml parsing error!

0/9000

Hi All,

I am hoping someone can help me as I have no idea where to start! 

I have been tasked with extracting data from a company (MOZO) that provides API endpoints via graphQL into our Salesforce org.

I can use Altair and Postman to send the POST method to get the data, but am stuck when it comes to doing this in Anypoint Studio so that I can insert it in Salesforce.

Some details:

  • url provided by MOZO is the following: https://marketview.mozo.com.au/graphql/{access token}
    • this url doesn't change
      • How can I reference this as an endpoint to send a payload of the graphQL quey to it in Anypoint? 
  • Payload is sent as POST method (which is fine) and sent as a graphQL query
    • eg. { homeLoans ( limit: 10) { additionalRepayments}}
      • How can I send this as the body of the payload to then get the response?

I am so stuck as I have only ever built applications that create the endpoint for someone to send ME the payload, not needing to send a payload to a pre-existing endpoint url, and I have never used graphQL before so i am not sure if there are extra complexities involved?

 

Any help would be much appreciated! #Anypoint Studio #MuleSoft #GraphQL #Help

1 answer
  1. Nov 2, 2023, 2:30 PM

    @Melissa Marsh,

    You can use Http requestor to call the Graph ql similar to rest endpoint call in anypoint studio. 

     

    Pass following http parameter 

    URL -https://marketview.mozo.com.au/graphql/{access token}

    Method - POST

    Content-Type - application/json

    payload -

    { "query": "{ homeLoans ( limit: 10) { additionalRepayments}}" }

0/9000

After our full sandbox was upgraded to Winter '22 our Mulesoft Anypoint connected app is getting a OAuth Error - "We can't authorize you because of an OAuth error. For more information, contact your Salesforce administrator.  OAUTH_APPROVAL_ERROR_GENERIC: An unexpected error has occurred during authentication. Please try again. "  

 

This connection was working prior to the Winter '22 upgrade.

The connected app has access to ALL scopes.

 

Anyone else having an issue in Winter '22 ?

 

#Winter '22

#MuleSoft

#Anypoint Studio

4 answers
  1. Sep 1, 2021, 12:18 PM

    Here was the answer:

     The Salesforce Technology team became aware of the service disruption impacting your sandbox instance. During the service disruption, customers can’t login to Salesforce and access any of their services. Upon investigating, the Technology team noted a recent Winter '22 Preview Release on Patch 3.6 version as the potential cause of the incident and decided to roll back to Winter’ 22 Patch 3.2. 

     

    #MuleSoft

    #Winter22

    #Release Readiness

0/9000

I have an idea for a MuleSoft Trailblazer Community Webinar:

 

Create simple text2speech API for Alexa.

 

  • Discover a foreign API with e.g. https://www.programmableweb.com/
  • Design API specification in  Design Center
  • Import spec in Anypoint Studio and implement the logic
  • Use RestClient like ARC to test the solution

 

That could be an interesting example and show the core parts: exploring an existing API, do the spec in Design Center and do the implementation in Anypoint Studio.

0/9000