API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#API Connect
#Applicationintegration
#APIConnect
 View Only
  • 1.  JSON Fields assigned Null

    Posted Wed July 27, 2022 12:14 PM
    it is json to json mapping in gateway script policy to filter fields for the final response message in API Connect v5  ,when mapping fields are not populated  from invoke call( backend call) . the final response will not have those fields ,where as in API connect v10 , it is assigning null. i gave example below .could you please guide what value can i set in gateway script to not to populate fields which are not coming from backend in the final response. it is sample only. we have huge mappings.


    APICONNECT V5

     

    Response from backend

    Final response

    {

    Eid : 1234

    Ename : suresh

    }

    {

    Eid : 1234

    Ename : suresh

    }

     

    We mapped eaddress which is not populated as it is not coming from backend

     

     

     

    APICONNECT V10

    Response from backend

    Final response

    {

    Eid : 1234

    Ename : suresh

    }

    {

    Eid : 1234

    Ename : suresh

    Eaddress :NULL

    }

     

    We mapped eaddress which is not populated as it is not coming from backend



    ------------------------------
    santhoshkumar surisetty
    ------------------------------


  • 2.  RE: JSON Fields assigned Null

    Posted Wed July 27, 2022 05:11 PM

    Hi Santhoshkumar,

    if (backendResponse.Eaddress !== undefined) {

      finalResponse.Eaddress = backendResponse.Eaddress;

    }

    etc ...

    Regards,
    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 3.  RE: JSON Fields assigned Null

    Posted Fri July 29, 2022 09:33 AM
    Hi Linn,

    As mentioned above, we have huge payloads. writing conditions for each field is not possible.


    Thanks & Regards,
    Manoj

    ------------------------------
    manoj dusa
    ------------------------------



  • 4.  RE: JSON Fields assigned Null

    Posted Fri July 29, 2022 11:37 AM

    Hi Manoj,

    Perhaps I misunderstood the original post.

    > it is json to json mapping in gateway script policy to filter fields for the final response message in API Connect v5  ,when mapping fields are not populated  from invoke call( backend call) . the final response will not have those fields ,where as in API connect v10 , it is assigning null. 

    Exactly how in v5 were you filtering these fields that is assigning null in v10?  All I had to go on above was the input data and the v5/v10 results.  I thought you had written your own gateway script policy, but could you be using the map policy instead?  If the latter, what v10 version is being used?

    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 5.  RE: JSON Fields assigned Null

    Posted Tue August 02, 2022 11:01 AM
    Hi Linn,

    we are currently doing  migration  from API Connect v5 to API Connect v10  . My Environment is running on openshift and  Apiconnect version is
    10.0.3.0-ifix1.t. the below output from  APIC V10  but  whatever the fields  have null value are not populated in v5 with same code,  could you please advise 
    how can i get output like v5 . we have this kind of mappings in 100 APIS  having 100s fields. it is very big effort to make changes in APIS.
    code
    ============


    'billingEntity': {
    'entityType': billingSTGEntityDetails[j].EntityType,
    'sourceSystemEntityCode': billingSTGEntityDetails[j].SourceSystemEntityCode,
    'fullName': billingSTGEntityDetails[j].FullName,
    'addressLineOne': billingSTGEntityDetails[j].Address1,
    'addressLineTwo': billingSTGEntityDetails[j].Address2,
    'city': billingSTGEntityDetails[j].City,
    'countyCode': billingSTGEntityDetails[j].County,
    'stateCode': billingSTGEntityDetails[j].State,
    'postalCode': billingSTGEntityDetails[j].ZipCode,
    'country': billingSTGEntityDetails[j].Country,
    'primaryEmailAddress': billingSTGEntityDetails[j].PrimaryEmailId,
    'primaryTelephoneNumber': billingSTGEntityDetails[j].PrimaryPhoneNo
    }


    APIC V10 output
    ===============
    "billingEntity": {
    "entityType": "INSURED",
    "fullName": "suresh",
    "addressLineOne": "Hyderbad",
    "addressLineTwo": null,
    "city": "Hyderbad",
    "countyCode": null,
    "stateCode": "AK",
    "postalCode": "502319",
    "country": "USA",
    "primaryEmailAddress": null,
    "primaryTelephoneNumber": null


    APIC V5 output
    ===============
    "billingEntity": {
    "entityType": "INSURED",
    "fullName": "suresh",
    "addressLineOne": "Hyderbad",
    "city": "Hyderbad",
    "stateCode": "AK",
    "postalCode": "502319",
    "country": "USA",

    ------------------------------
    santhoshkumar surisetty
    ------------------------------



  • 6.  RE: JSON Fields assigned Null
    Best Answer

    Posted Tue August 02, 2022 05:16 PM

    Hi Santhoshkumar ,

    Just looking at the results isn't sufficient to understand your issue.  Please open a PMR and include your v5 and v10 yaml files, your input to the map and the v5/v10 results you note above.  It would appear that your input that is present is being mapped properly, but for those input properties that are not present, the mapping of  those properties are creating the null values.  I've not seen that in v10, so a detailed look and recreate will be needed to properly diagnose the issue.
    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------