IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  facing issue while implement Post call using Rest Adapter in ITX

    Posted Tue January 25, 2022 11:45 PM
    Hi , 

    I am Implemented rest adapter using GET call as below

    =GET("REST","-TV -METHOD post -URL http://rest-dev-price.com/v3.0/price/token -HEADERS Authorization=Basic am9obkBleGFtcGxlLmNvbTphYmMxMjM= Content-Type=text/plain")

    i also need to pass the body  "grant_type=client_credentials" and Basic Auth in header header section, but the adapter trace shows a error while i run the map

    <24508-7780-01/25/22 22:33:33>: [connect]
    <24508-7780-01/25/22 22:33:33>: | Caught exception: com.hcl.hip.adapters.m4base.MBaseException
    Specified value :Authorization=Basic am9obkBleGFtcGxlLmNvbTphYmMxMjM= Content-Type=text/plain is not in correct property format: key1=value1 key2=value2 key3=value3.
    com.hcl.hip.adapters.m4base.MBaseException: Specified value :Authorization=Basic am9obkBleGFtcGxlLmNvbTphYmMxMjM= Content-Type=text/plain is not in correct property format: key1=value1 key2=value2 key3=value3.
    at com.hcl.hip.adapters.m4rest.Utilities.getTableProperties(Utilities.java:136)
    at com.hcl.hip.adapters.m4rest.MConnectionImpl.setMembers(MConnectionImpl.java:53)
    at com.hcl.hip.adapters.m4rest.MConnectionImpl.connect(MConnectionImpl.java:128)
    at com.hcl.hip.tools.adapterdriver.MConnectionImpl.connect(MConnectionImpl.java:59)

    Note :- The space between Basic and encode string is causing the issue and tried to escape with a back slash , but that did not help.

    Please let me know how this can be fixed.

    ------------------------------
    Narendra Chimakurthi
    ------------------------------

    #DataExchange
    #IBMSterlingTransformationExtender


  • 2.  RE: facing issue while implement Post call using Rest Adapter in ITX

    Posted Thu January 27, 2022 02:28 PM
    Edited by System Admin Sun July 23, 2023 11:00 PM
    I ran it by others, this is what they suggest:

    =PUT("REST",

                "-TV -METHOD post -URL http://rest-dev-external.xxx.com/v3.0/price/token -HEADERS 'Authorization: Basic MkZEN0JBNkI0Mjk4NDExNThGMTVCRjYxODczMEFEQTU6MUY3MjVGQjRGOTQ2NDc0OUE1NUFCNkMxN0RCNTZFNDg=' ", "grant_type=client_credentials" )

     

    Your original rule:

    =GET("REST","-TV -METHOD post -URL http://rest-xxx.com/v3.0/price/token -HEADERS Authorization=Basic am9obkBleGFtcGxlLmNvbTphYmMxMjM= Content-Type=text/plain")

     



    ------------------------------
    Rex Chan
    ------------------------------



  • 3.  RE: facing issue while implement Post call using Rest Adapter in ITX
    Best Answer

    Posted Mon February 07, 2022 09:31 AM
    A slight variation:

    =PUT("REST",

                "-TV -METHOD post -URL http://rest-dev-external.xxx.com/v3.0/price/token -HEADERS 'Authorization=Basic<<22>>am9obkBleGFtcGxlLmNvbTphYmMxMjM=' ", "grant_type=client_credentials" )

    ...as headers cannot include spaces.



    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------



  • 4.  RE: facing issue while implement Post call using Rest Adapter in ITX

    Posted Mon February 14, 2022 08:48 AM
    Hi Paul,

    I tried below..

    =GET("REST","-TV -METHOD post -URL https://rest-dev-external.xxx.xxx.com/v3.0/price/products -H 'content-type=application/json' authorization=Bearer<<22>>f372ecc596734be5829de956f22bb198", "{""CustomPageKey"": ""0"",""SessionKey"": ""SessionKey"",""edc"":[1112221],""companycode"": ""C""}")


    <49164-24236-02/10/22 11:41:57>: [connect]
    <49164-24236-02/10/22 11:41:57>: | Caught exception: com.hcl.hip.adapters.m4base.MBaseException
    Specified value :content-type=application/json authorization=Bearer f372ecc596734be5829de956f22bb198 is not in correct property format: key1=value1 key2=value2 key3=value3.
    com.hcl.hip.adapters.m4base.MBaseException: Specified value :content-type=application/json authorization=Bearer f372ecc596734be5829de956f22bb198 is not in correct property format: key1=value1 key2=value2 key3=value3.
    at com.hcl.hip.adapters.m4rest.Utilities.getTableProperties(Utilities.java:136)
    at com.hcl.hip.adapters.m4rest.MConnectionImpl.setMembers(MConnectionImpl.java:53)
    at com.hcl.hip.adapters.m4rest.MConnectionImpl.connect(MConnectionImpl.java:128)
    at com.hcl.hip.tools.adapterdriver.MConnectionImpl.connect(MConnectionImpl.java:59)

    ------------------------------
    Narendra Chimakurthi
    ------------------------------



  • 5.  RE: facing issue while implement Post call using Rest Adapter in ITX

    Posted Tue February 15, 2022 02:31 PM

    Hi Narendra,


    Please use the Hex <<22>> for the double quote around the value with the space character and use single quotes at the beginning and end of all headers.

    Example:

    =GET("REST","-TV -METHOD post -URL https://rest-dev-external.xxx.xxx.com/v3.0/price/products -H 'content-type=application/json authorization=<<22>>Bearer f372ecc596734be5829de956f22bb198<<22>>' ", "{""CustomPageKey"": ""0"",""SessionKey"": ""SessionKey"",""edc"":[1112221],""companycode"": ""C""}")



    ------------------------------
    Greg McEachern
    ------------------------------



  • 6.  RE: facing issue while implement Post call using Rest Adapter in ITX

    Posted Tue February 15, 2022 03:42 PM
    Change:

    =GET("REST","-TV -METHOD post -URL rest-dev-external.xxx.xxx.com/v3.0/price/products -H 'content-type=application/json' authorization=Bearer<<22>>f372ecc596734be5829de956f22bb198", "{""CustomPageKey"": ""0"",""SessionKey"": ""SessionKey"",""edc"":[1112221],""companycode"": ""C""}")

    to:

    =GET("REST","-TV -METHOD post -URL rest-dev-external.xxx.xxx.com/v3.0/price/products -H 'content-type=application/json authorization=Bearer<<22>>f372ecc596734be5829de956f22bb198'  ", "{""CustomPageKey"": ""0"",""SessionKey"": ""SessionKey"",""edc"":[1112221],""companycode"": ""C""}")

    Note that the ' has moved position!

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------