Since this is GET method, you can construct URL using script mediator.

eg:
if(count!="")
            {
                apiUrl=apiUrl+'count='+count;
            }

            var startId=mc.getProperty('uri.var.startId');
            if(startId!="")
            {
                apiUrl=apiUrl+'&start_id='+startId;
            }

            var startIndex=mc.getProperty('uri.var.startIndex');
            if(startIndex!="")
            {
                apiUrl=apiUrl+'&start_index='+startIndex;
            }


On Tue, Feb 18, 2014 at 3:13 PM, Jay <janaka.n.ranathu...@gmail.com> wrote:

> Hi,
>
> We are currently developing an ESB connector for Linkedin API, and having
> an
> issue in handling optional parameters for one of the API calls.  I have
> mentioned the reference for the API call below.
>
> http://developer.linkedin.com/documents/company-search#
>
> This method is having seven optional parameters and four of them which are
> mentioned below, do not have default values.
>
> *       facet
> *       start
> *       count
> *       sort
>
> The problem we are facing is that, if those parameters with no default
> values are appended to the url, but values are not sent, then the API gives
> a validation error. Therefore we need to check whether the user has passed
> a
> value to a particular parameter (Which do not have a default value) and
> then
> form the endpoint accordingly.
>
>        <filter xpath="not(get-property('uri.var.facet') = '') and
> not(get-property('uri.var.start') and not(get-property('uri.var.count') and
> (get-property('uri.var.sort')">
>               <then>
>                      <call>
>                            <endpoint>
>                                   <http method="get"
>
>
> uri-template="{uri.var.apiUrl}/v1/companies/universal-name={uri.var.universalName}?oauth2_access_token={uri.var.accessToken}&amp;keywords={uri.var.keywords}&amp;hq-only={uri.var.hqOnly}&amp;facets={uri.var.facets}&amp;sort={uri.var.sort}&amp;format=json"
> />
>                            </endpoint>
>                      </call>
>               </then>
>        </filter>
>
> If we follow the aforementioned methodology, we will have to use sixteen
> filters to filter out the optional parameters with no default values and
> form the endpoint accordingly. With sixteen filters, the synapse file will
> become bulky. Is there an alternative way to handle this issue?
>
> Thank you.
>
>
>
>
> --
> View this message in context:
> http://wso2-oxygen-tank.10903.n7.nabble.com/Handling-Optional-Parameter-Issue-in-LinkedIn-Connector-tp92339.html
> Sent from the WSO2 Development mailing list archive at Nabble.com.
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to