Skip to main content
Solved

Web connector vs HTTP connector

  • September 24, 2024
  • 4 replies
  • 124 views

Freddy
Forum|alt.badge.img+16
  • Thinkwise Local Partner Brasil

I changed an existing HTTP connector to a web connector so we can change API key in IAM. Unfortunately there seems to be a difference in how the request body is forward. I have a generated request body that worked in the HTTP connector, type application/json 

In the web connector I've translated this in body type JSON and one input parameter that gets the generated body json. 

The API provider gives back a JSON parsing error on the web connector.

Best answer by Freddy

@Mark Jongeling the scenario.  Customer integration with Klippa. 

In the demo we used the HTTP connector.  Where I generate the request body from a documents table with documents I need to scan. 

select crd.document_data as [data]
      ,crd.document_upload as [filename]
      ,crd.document_page_ranges as [page_ranges]
  from credit_request_document crd
 where crd.credit_request_id          = @credit_request_id 
   and crd.credit_request_document_id = @credit_request_document_id
   for json path, root('documents')

With the HTTP connector the result of the query is the request_body towards the klippa API. 

Now I want to have this API as a web connector so I can differentiate API keys per environment. 

I put everything in place and we end up setting up the body.  Type JSON. 

option 1) I put variable in Body {request_body} results in non parsable body (whilst with HTTP connector this works.  There I also put the variable as body. 

option 2) I put in the json structure and fill every element with data from the table. Fails with unparsable content. I tried all options to also have input parameters pre processed.. (although I find it very unclear what it does exactly) 

{ documents: [
  { data : {document_data},
    filename : {document_upload},
    page_ranges : {document_page_ranges}
   )
  ]
} 

option 3) this one finally worked..  I put the body request JSON root element and just made the array a variable.  I really have not idea why only this one worked and did not result in a non-parsable document.  

{
    "documents": {document_array}
}

 

When I read the documentation, I can read it, but don't understand it.  On the pre-processing part: "so that Indicium can use it"…  ???  It really doesn't help me to understand when to use it or not to use it.  

https://docs.thinkwisesoftware.com/docs/sf/web_connections#web-connection-for-a-branch

View original
This topic has been closed for comments

Freddy
Forum|alt.badge.img+16
  • Thinkwise Local Partner Brasil
  • September 24, 2024

I got it working, but please create better documentation on the web connector and what all the options actually do. And the way the request body is treated is different between HTTP connector and WEB connector.   @Arie V 


Mark Jongeling
Administrator
Forum|alt.badge.img+23

Hey Freddy,

Great you got it working. What was the exact problem you were running into? As in, what was treated differently?

We're all for improving the documentation on this but we would love to hear what part was unclear or missing.


Freddy
Forum|alt.badge.img+16
  • Thinkwise Local Partner Brasil
  • September 26, 2024

@Mark Jongeling the scenario.  Customer integration with Klippa. 

In the demo we used the HTTP connector.  Where I generate the request body from a documents table with documents I need to scan. 

select crd.document_data as [data]
      ,crd.document_upload as [filename]
      ,crd.document_page_ranges as [page_ranges]
  from credit_request_document crd
 where crd.credit_request_id          = @credit_request_id 
   and crd.credit_request_document_id = @credit_request_document_id
   for json path, root('documents')

With the HTTP connector the result of the query is the request_body towards the klippa API. 

Now I want to have this API as a web connector so I can differentiate API keys per environment. 

I put everything in place and we end up setting up the body.  Type JSON. 

option 1) I put variable in Body {request_body} results in non parsable body (whilst with HTTP connector this works.  There I also put the variable as body. 

option 2) I put in the json structure and fill every element with data from the table. Fails with unparsable content. I tried all options to also have input parameters pre processed.. (although I find it very unclear what it does exactly) 

{ documents: [
  { data : {document_data},
    filename : {document_upload},
    page_ranges : {document_page_ranges}
   )
  ]
} 

option 3) this one finally worked..  I put the body request JSON root element and just made the array a variable.  I really have not idea why only this one worked and did not result in a non-parsable document.  

{
    "documents": {document_array}
}

 

When I read the documentation, I can read it, but don't understand it.  On the pre-processing part: "so that Indicium can use it"…  ???  It really doesn't help me to understand when to use it or not to use it.  

https://docs.thinkwisesoftware.com/docs/sf/web_connections#web-connection-for-a-branch


Jeroen van den Belt
Administrator
Forum|alt.badge.img+8

Hi @Freddy

I'll make sure to pass this information to our Documentation team.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings