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?
- this url doesn't change
- 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?
- eg. { homeLoans ( limit: 10) { additionalRepayments}}
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
Manish Kumar Yadav (Hitachi Energy) Forum Ambassador
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