Hi Laksman,

It seems API url is wrong. It should be
"/publisher/api/asset/get/uuid/mobileapp/"+provider+"/"+name+"/"+version;
instead
of  "/publisher/api/asset/get/uuid/mobileapp"+provider+"/"+name+"/"+version;


*API code for your reference. *

//get uuid of given asset for-> provider,name,version
routeManager.register('GET', 'publisher',
'/publisher/api/asset/get/uuid/{type}/{provider}/{name}/{version}',
        function (context) {
            var assetProvider = context.params.provider;
            var assetName = context.params.name;
            var assetVersion = context.params.version;
            var shortName = context.params.type;
            var artifactManager = rxtManager.getArtifactManager(shortName);

            var fn = function (asset) {
                var cond1 = (asset.attributes.overview_provider ==
assetProvider ) ? true : false;
                var cond2 = (asset.attributes.overview_name ==
assetName ) ? true : false;
                var cond3 = (asset.attributes.overview_version ==
assetVersion ) ? true : false;
                return (cond1 && cond2 && cond3);
            }

            var artifact = artifactManager.find(fn, null);
            if (artifact && artifact != null && artifact.length > 0) {
                var artifactId = artifact[0].id;
                var res = {error: false, uuid: artifactId};
                response.contentType = "application/json";
                print(res);
            } else {
                var res = {error: false, uuid: null , message :'Could
not find UUID for given webapp'};
                response.contentType = "application/json";
                print(res);
            }


        });


*Sajith Abeywardhana* | Software Engineer
WSO2, Inc | lean. enterprise. middleware.
#20, Palm Grove, Colombo 03, Sri Lanka.
Mobile: +94772260485
Email: saji...@wso2.com | Web: www.wso2.com

On Wed, Feb 24, 2016 at 9:34 PM, Lakshman Udayakantha <lakshm...@wso2.com>
wrote:

> Hi,
>
> I have called using below code snippet a store rest API.
>
> var serviceURL = 
> "/publisher/api/asset/get/uuid/mobileapp"+provider+"/"+name+"/"+version;
> invokerUtil.get(
>     serviceURL,
>     function (data) {
>         console.log("call succeeded...............!");
>     },
>     function (data) {
>         console.log("error occured.................!!!");
>     }
> );
>
>
> This call is done in a javascript method from emm to publisher jaggery
> app. But this call will fail with 401 unauthorised error. How do I get
> authenticate this call?
>
> Thanks
> --
> Lakshman Udayakantha
> WSO2 Inc. www.wso2.com
> lean.enterprise.middleware
> Mobile: *0714388124*
>
>
> _______________________________________________
> 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