Nue Knowledge Center

Nue Docs navigation

search
clear
/

Query Nue Objects using GraphQL

Introduction

Nue offers a dual-platform, which means Nue’s platform stores and manages data from 2 different SaaS Platforms - Salesforce & Nue’s Cloud Services.  

 

If your Nue instance is connected to a Salesforce org, all the objects that support products and pricing have Salesforce as the only data source.

 

You can use Nue’s graphQL service to access the data of any objects in Nue.  If the object has Salesforce as the data source, the data will be queried from Salesforce.  Otherwise, the data will be retrieved from Nue’s AWS Services.

 

You can login to Nue and navigate to Settings > Business Objects, and see a list of objects in Nue.  For any object in the list, if Salesforce API Name is not empty, the object has Salesforce as the data source.

 

Postman Collection

Users can import and run GraphQL Postman Collection.  

 

Generate graphQL Query

Login to Nue, and navigate to the Settings, and search with keyword ‘graph’ and select the result ‘GraphQL Generator’.  The GraphQL Generator will be automatically launched.  

 

In the GraphQL generator, you can select a number of fields, and create filters if necessary.  The fields and filtering conditions will be automatically generated as part of the GraphQL query.  Once you are ready, you can click ‘Copy to Clipboard’.  

 

For example, the following GraphQL query is generated to find all active, non-bundle, standalone products. 

 

query {
 Product(where: {_and: [{configurable: {_eq: false}}, {status: {_eq: "Active"}}]}) {
   autoRenew
   Ruby__ProductCost__c
   billingPeriod
   billingTiming
   bundleTemplate
   configurable
   createdById
   createdDate
   defaultRenewalTerm
   defaultSubscriptionTerm
   defaultUomId
   description
   endDate
   freeTrialType
   freeTrialUnit
   id
   imageUrl
   lastModifiedById
   lastModifiedDate
   longDescription
   name
   priceBookId
   priceModel
   productCategory
   recordType
   referenceProductId
   showIncludedProductOptions
   sku
   soldIndependently
   startDate
   status
 }
}

Run GraphQL Query using GraphQL API

Now you can copy the graphQL query generated in the last step in to the API Request Body to run the query.

POST https://api.nue.io/async/graphql

 

For example: 

 

curl --location --request POST 'https://api.nue.io/async/graphql' \
--header 'apiAccessKey: {{apiAccessKey}}' \
--header 'Authorization: Bearer {{accessToken}}' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query {\n  Product(where: {_and: [{configurable: {_eq: false}}, {status: {_eq: \"Active\"}}]}) {\n    autoRenew\n    Ruby__ProductCost__c\n    billingPeriod\n    billingTiming\n    bundleTemplate\n    configurable\n    createdById\n    createdDate\n    defaultRenewalTerm\n    defaultSubscriptionTerm\n    defaultUomId\n    description\n    endDate\n    freeTrialType\n    freeTrialUnit\n    id\n    imageUrl\n    lastModifiedById\n    lastModifiedDate\n    longDescription\n    name\n    priceBookId\n    priceModel\n    productCategory\n    recordType\n    referenceProductId\n    showIncludedProductOptions\n    sku\n    soldIndependently\n    startDate\n    status\n  }\n}\n","variables":{}}'