Web API: Send POST Request SAP Fieldglass Error

I'm in the process of configuring an integration between Catalytic and SAP Fieldglass (FG) where we'll be posting custom field values that are collected via webform. I found the API references via FG documentation and have validated my JSON via JSON LINT however, I keep getting the following error message: Cannot invoke "java.util.HashMap.size()" because the return value of "insite.web.integration.translator.bean.TranslatorBean.getHeaderColumnMap()" is null

If my JSON is valid and it aligns with the parameters outlined by FG, any idea what the issue could be? The request body I'm using is attached (the data are field references):

Best Answer

  • Sean_510793
    Sean_510793 Posts: 69 admin
    Answer ✓

    That's great! Hopefully, they improve the error code too!

Answers

  • Sean_510793
    Sean_510793 Posts: 69 admin

    Hi @Carolyn_139866 , it looks like the Fieldglass parser is hitting a problem parsing the content. Like it's looking for headers that it's not finding so throwing an exception. Can you point to a URL or doc that outlines the API?

  • Hi @Sean_510793 ,

    Thank you so much for the quick response! Yes, please see the below URL where I obtained the API references. The Overview section houses the actual connector doc.

    https://api.sap.com/api/customFieldUpdateUpload/resource

  • Sean_510793
    Sean_510793 Posts: 69 admin

    In the actual payload, are you using the actual work order ID in the Object ID field?

  • Hi Sean,

    I set a field reference for the Object ID because I gather it along with the custom field value via a webform at the start of the flow. Below is the link to the action within my workflow.

    https://impellamtraining.pushbot.com/process/31b8a452-c953-4577-bd17-8fab89c941af/steps/upload-file-to-fg

  • Sean_510793
    Sean_510793 Posts: 69 admin

    Could you change the POST URL to postman-echo (https://postman-echo.com/post) and then look at the return result? I want to make sure that the "Gender" and "Fieldglass Work Order ID" are being replaced as field references correctly.

    The postman-echo endpoint just takes what you post to it and returns it exactly. You can read more about it here => https://www.postman-echo.com. It's a great tool for when you are trying to figure out if the content or the API is having issues.

  • Hi Sean,

    Ok, this is amazing! I saw you mention postman in the Web API doc you posted here but I didn't realize i had to change my endpoint to run it. Please see the result below. It does look like it's pulling the correct values for Gender and WO ID.

    {"args":{},"data":{"headers":{"Type":"Custom Field Update","Comments":"OFCCP Updates","Language":"English (United States)","Transaction":"False","Hide Custom Field value changes":"True","Update only when value changes":"False","Buyer":"CNH","Module":"Work Order"},"data":[{"[c] Gender":"Female","Object ID":"CNHWO00000000"}]},"files":{},"form":{},"headers":{"x-forwarded-proto":"https","x-forwarded-port":"443","host":"postman-echo.com","x-amzn-trace-id":"Root=1-60f73c2a-0d811aca5dbb0bd06ef3678d","content-length":"396","user-agent":"pushbot/v2.1.0","accept":"application/json,/","authorization":"Bearer YWVzQG9MRFVPamY1d3ByeGJYaG1zSkN5MGl1aUNDYmttallBY3lXQXZ0dHpGSDBOWkhocGR6eUNTT3RIRFg3VXZUb1h0MkFLam1aVWdUaEJ4aTBKeE95WWxNcWNtSUw4c01xNy9STDNXRHRGTm95ZXdIQTliTWpHNDlaWTJESHk4UlFqSXZERG0yc1hrYlBZdmVqNXdCU2lTT0FsNjJZWm90czBGS2VNOEFkdXN2VT0=","content-type":"application/json"},"json":{"headers":{"Type":"Custom Field Update","Comments":"OFCCP Updates","Language":"English (United States)","Transaction":"False","Hide Custom Field value changes":"True","Update only when value changes":"False","Buyer":"CNH","Module":"Work Order"},"data":[{"[c] Gender":"Female","Object ID":"CNHWO00000000"}]},"url":"https://postman-echo.com/post"}

  • Sean_510793
    Sean_510793 Posts: 69 admin

    Hi @Carolyn_139866 , it does look correct to me too. The error message seems to indicate that the Fieldglass system isn't finding the headers, even though it's there in the payload. What error code are you getting?

    You may want to report it to Fieldglass as a potential bug in the parsing. At the very least, the error message could be improved.

  • Hi Sean,

    I get 400 for bad request, then code 106. I'll report to FG and see what happens. Is this my only avenue for automating the transmission of data? Is there any way to pass the actual upload file itself?

  • Hi @Sean_510793 & @Kalin_126161 ,

    FG responded re: this error. It's because the connector is only configured for CSV, they need to enable the JSON translator on the back end. I've submitted that request and will let you know the results of my testing.

  • Hi @Sean_510793 & @Kalin_126161 ,

    The update worked! Once they enabled the translator, the records updated as expected!