Master Data Documentation
Master data is a GraphQL based API which provides details of the master data.
Currently this API supports the following masters:
• accOperInstruc
• accountNumType
• accountStatus
• accountType
• addressType
• annualIncome
• applicationType
• branch
• branchCode
• businessSegment
• businessType
• citizenship
• citizenshipDec
• clientcategory
• clientSubType
• constitutionType
• contactType
• corporateCode
• countryOfBirth
• custAccountRel
• custCategory
• custPrefix
• custType
• education
• fatcaCompliant
• flag
• flagOther
• gender
• identityType
• industryNature
• isoCountry
• kycStatus
• maritalStatus
• merOfferType
• minorFlg
• minorGuadianRel
• natureOfProfess
• noOfYrsForeign
• officeLocation
• officeTypes
• partnerSegment
• pin
• politicalExposure
• portfolioCode
• prefCategory
• prefTypeId
• prefValue
• productCode
• productType
• profession
• religion
• relWListedComp
• residenceType
• residentStatus
• riskCategory
• riskScore
• riskType
• rmType
• signatoryType
• sourceOfFunds
• splStatusCust
• state
• stmtFrq
• transactionType
• visa
• branchLocator
• productSavingAccount
• customerProfiles
• customerTransactions
• benefits
• documents
• employedWith
• insurance
• ChequeStopReason
All these masters can be accessed using a single API.
Query for accessing all the available masters list:
{
__type(name: "Query") {
name
fields {
name
}}}
Query for accessing all possible argument types and output type along with the query
lists
{
__type(name: "Query") {
name
fields {
name
description
args{
name
type{
name
kind
ofType {
name}}}
type{
name
kind
ofType {
name}}
}}}
Query to access all the fields of a type:
{
__type(name: "VisaType") {
name
fields {
name
args{
name
}
type {
name,
kind,
ofType {
name
}}
}}}
Example query to get the master data for luVisaType :
query {
luVisaType {
code
desc
longDesc
fcr
dps
wms
fatca
ckyc
}}
Applying for different options with Query:
Depending on your needs, data can be fetched in different ways.
1: limited fields:
In the query only, limited fields can be passed to get data for those fields
I.e.
query {
luVisaType {
code
}
}
It will only return the data for visaTypeCode.
{
"data": {
"luVisaType": [
{ "code": 1},
{ "code": 2},
{"code": 3}
]}}
2: Pagination:
You can restrict the result by providing offset and limit on the query
query {
luVisaType (offset: 5, limit: 10) {
code
desc
}
}
It will return the data from offset up to the limit provided.
In the example above it will skip the first 4 records and return 10 results after that.
Default: If you don’t provide the offset and limit it will take the default value of 0 and 100 respectively.
The minimum offset value is 0 and the minimum limit is 1 to get the paginated data.But if you provide the
offset as -1 it will give you all the data irrespective of the limit.
3: Ordering
If you need to get the data in a certain order of the key. You can use sortBy object to get the data in
sorted order of the provided key.
You need to provide the sortBy object using graphQL variables.
Example:
Query:
query luVisaType ($sortBy: SortBy) {
luVisaType (sortBy: $sortBy) {
code
desc
}
}
variable:
{
"sortBy": {
"key": "code"
}}
It will return the result in the ascending order of code.
For getting the data in descending order, variables will look like the following:
{
"sortBy": {
"key": "code",
"order": "DESC"
}}
4: Filtering:
For getting data based on keys, filter criteria can be applied.
Example:
query filter ($filterCriteria: [FilterCriteria]) {
luVisaType (filterCriteria: $filterCriteria) {
code
desc
longDesc
fcr
dps
wms
fatca
ckyc
}}
Variable
{
"filterCriteria":[ {
"key": "code",
"filterInput": {
"filterType": "eq",
"filterValues": [
"1"
]}},
{
"key": "desc",
"filterInput": {
"filterType": "eq",
"filterValues": [
"Tourist"
]}
}]}
In the example above the data will be return for code = 1 and desc = Tourist
All of these filters can also be applied together.
Support types:
FilterCriteria : Type to provide filter criteria for query
input FilterCriteria {
key: String!
filterInput: FilterInput!
}
Properties Type Mandatory Default value Possible values Example
key String Y NA Any of the property visaTypeDesc
available in the return
type of the specific query
filterInput FilterInput Y NA
FilterInput:
input FilterInput {
filterType: FilterType!,
filterValues: [String]!
}
Properties Type Mandatory Default value Possible values
filterValues List of String Y NA Values of the property for
which filter needs to be
applied
filterType FilterType Y NA
FilterType : Type of filter. It defines how to apply filtering on a certain key
Possible Description
values
eq Checks if value for a
property is one of the given
values
nq Checks if value for a
property is none of the given
values
contains Checks if value for a
property contains given the
value
notContains Checks if value for a
property does not contain
the given value
gte Checks if the value for a
property greater than equals
the given value. The filter can
take only one value and apply
only for number
lte Checks if the value for a
property less than equals the
given value. The filter can
take only one value and apply
only for number
SortBy: Object to define sorting order for a key
input SortBy {
key: String!
order: SortOrder=ASC
}
SortOrder: Defines the order of sorting
enum SortOrder {
ASC
DESC
}
Possible Description
values
ASC Returns the
result in
ascending
order of a
property value
DESC Returns the
result in
descending
order of a
property value
API Limitation on a query per Request:
For considering the query performance there is a limit set on the no of queries that can be added in a
single API call. This is set for 15. If more than 15 queries are passed on the API call it will fail to respond.
Calling APi in the form of REST:
Though it is not preferred but if still if you don’t have any option to call the API using graphQL client,
you can still call the API using rest client.
Rest body:
{
"query": "query pin ($filterCriteria: [FilterCriteria], $sortBy: SortBy) {\n pin (filterCriteria: $filterCriteria,
sortBy: $sortBy) {pinCode\n city\n district\n state\n country\n }\n}",
"variables": {
"filterCriteria": {
"key": "country",
"filterInput": {
"filterType": "eq",
"filterValues": [
"India"
]
}
},
"sortBy": {
"key": "pinCode",
"order": "ASC"
}
}
}
How to use API from postman:
UAT URL: https://ms.uat.genie.yesbank.in/api/master-data/graphql
1: Import the schema file in postman by selecting GraphQL option for upload
2: Find query listing from the queries section
3: Update URL for a specific environment
4: Add Authentication header for the client (get the token for the genie-backend client by calling keycloak
token api)
5: Update filter variables for your required filter criteria
6: Remove the filter if you want to call the API without a filter:
BranchLocator: Find six nearest branch for specific postal code
query filter ($f1: [FilterCriteria]) {
branchLocator(filterCriteria: $f1, offset:0, limit:12) {
postalCode
latitude
longitude
addId1
addAddress1
addName1
addCity1
distance1
addId2
addName2
addAddress2
addCity2
distance2
addId3
addName3
addAddress3
addCity3
distance3
addId4
addName4
addAddress4
addCity4
distance4
addId5
addName5
addAddress5
addCity5
distance5
addId6
addName6
addAddress6
addCity6
distance6
}}
Product Saving Account:
1. Get all details of saving account without variables:
query {
productSavingAccount {
code
name
description
image
benefits {
benefit
minInitialDeposit
descMinAmount
debitCardName
debitCardImage
debitCardBenefits
debitCardCost
documents {
documentName
2. Get all details of saving account with variables:
query filter ($f1: [FilterCriteria]) {
productSavingAccount(filterCriteria: $f1, offset:0, limit:12) {
code
name
description
image
benefits {
benefit
}
minInitialDeposit
descMinAmount
debitCardName
debitCardImage
debitCardBenefits
debitCardCost
documents {
documentName
}
}
}
Varibales:
{
"f1":[ {
"key": "code",
"filterInput": {
"filterType": "eq",
"filterValues": [
"987"
]}}
]}