Invoking wso2greg Artifcat Rest API via wso2api manager is not working - any ideas to fix - api

UPDATED QUESTION to clarify more.
I have two servers : wso2greg containing custom artefacts and wso2am (api manager).
The gouvernance register is intended to be used internally (intranet) and some of it's feature are intended to be exposed externally and acceded via it's rest API.
In order to manage wso2greg API accesss, we used an wso2am (api manager) server, where we did define an API that act as a proxy for the wso2greg API.
In our experiments, we found the strange behaviour described below :
Successfully direct calling wso2greg artefact rest api (the exact url is
https://localhost:9443/resource/1.0.0/artifact/_system/governance/myartifact/art1 and i'm following the documentation of this REST API from here https://docs.wso2.com/display/Governance520/Resources+with+REST+API ) using postman. The API reacts as described in the documentation.
Error 500, reported on wso2greg server, when calling the same REST API, but via API manager (using publisher application).
So as a summary :
Directly calling wso2greg rest API woks fine and a got results back
Adding this working API, in wso2am and than calling it gives always error 500.
As extra information:
Tested with other wso2greg REST API , such as "rating" or "comments" and I was able to call it successfully either directly or throw Api manager.
Tried to get information related to default wso2greg artifacts such as restservice, but i got exactly the same pb when (error 500) interagting with API manager.
Working with the last version of both products : wso2greg version 5.2.0 and wso2am version 1.10.0
Please advice, or clarify how could i debug this internal error in wso2greg.
Regards,

I hope your not using G-Reg + APIM feature installed version. I presume your using separate G-reg 5.2.0 and APIM x.x.x. Since your using the second option you can't use G-Reg REST API with APIM, therefore you have to use APIM REST API instead.
Get an API
Description: Get details of a specific API.
URI: http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag
URI Parameters: action=getAPI&name=xxx&version=xxx&provider=xxx
HTTP Methods: POST
Example:
curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag -d "action=getAPI&name=PhoneVerification&version=1.0.0&provider=admin"
Please follow this link to see all the api usage.

Thanks #thusharaK for providing help.
The solution was to add Message Mediation Policies which forces json header on output.
Now i got my correct response from API manager (in fact, i got a binary response in test console and a json response in postman) .

Related

Attempting to connect to Oro 4.1.1 Web API via the OAuth

I am trying to utilize the OroCommerce Web API which was introduced to interact with my clients.
The first step of oauth2-token seems to be working well, but he consequent requests to the api's such as customers GET, customerusers GET etc all end up with 401-Unauthorized Error.
I am trying to test the whole flow through the POSTMAN.
I have checked the Web API access is enabled and also verified that the guest users are enabled.
What's strange is the the /api/doc seems to be working well, but when I try to mimic the same via POSTMAN, it always ends up with 401 -Unauthorized Access.
Any idea why it could be failing?
Make sure you included Content-Type and Bearer prefixed Authorization headers in the request built using POSTMAN. Like explained in the OroCommerce documentation.
The authentication with Bearer header also explained in POSTMAN documentation.

WSO2 API Manager doesn't respond correctly to the APIs

I've got installed the manager, and put it on some APIs, the problem comes when I try to make a call to the API and the result is always the same. It shows:
https://localhost:9443/carbon/admin/login.jsp
I really don't know why is that.
Version: WSO2 API Manager 2.2.0
Try following the Invoking the API section of the below document. If you are going to try with CURL, this will show the CURL request format too.
https://docs.wso2.com/display/AM220/Quick+Start+Guide#QuickStartGuide-InvokingtheAPI

Extract custom report via API

I'm trying to extract a custom report from activecollab via API as a CSV file to be imported into a visualization tool.
I've requested the activecollab API key with:
curl -k --data "api_subscription[email]=****#*****.com&api_subscription[password]=********&api_subscription[client_name]=****&api_subscription[client_vendor]=****" https://*************/api.php
This works successfully and returns the API key in plain text.
How do I request the report after that?
Report URL:
https://*****************/public/index.php?path_info=timereportsplus%2Frun&export_format=csv&async=1&filter%5Bshow_time_records%5D=1&filter%5Btype_filter.....[lots of filters]
I get this URL by copying the link address of the 'Export CSV' link at the bottom of the report.
I can successfully get the report if I feed the cookies from the first interaction with the login page to the report generation URL(above). But I want to avoid using cookies.
Is there a way to authenticate with the API key and return the report in a single call?
Other details:
activecollab version: 5.0.100
What you have there is not Active Collab 5. Version 5 does not support third party modules (and that request is clearly targeting Reports Plus plugin). You are probably using version 4 or older.
In versions older than Active Collab 5, not all resources that are available to the web interface are available via API. Particular resource that you are trying to fetch is clearly intended for web interface only because it response well to web interface requests (where you auth with a cookie), but rejects API requests.
All API resources that Active Collab 4 supports are listed here:
https://activecollab.com/help-classic/books/api/
Please consult third party module vendor and see if they can make that resources available to API.

API connect published api in developer portal can't work

https://new-console.ng.bluemix.net/docs/services/apiconnect/apic_tutorial.html#apic_tutorial_01
Follow previous link to do create loopback project named ibmsvt and do test locally, we can post and get.
then publish this api as running api app on bluemix and we will get api target url and tls file.
type url and tls in api designer invoke, and publish api product again.
check api connect service and we can find that published api product has been published, configure developer portal, and invite developers
login developer portal and register one app
subscribe app to api product and run post command.
We will see that we only get can't post error information...
Please see attachment info for error info and api file.
From the screen capture provided, it looks like you're displaying the logs for the loopback application deployed on bluemix. It also looks like the POST request from APIConnect hit the Bluemix application as well. However, I'm unable to see the exact message of the error. What error did you get when you execute the POST from APIConnect? I suspect the POST did not include the $(request.path), what did you change the invoke url to be ? Can provide the x-ibm-configuration section in your yaml file? It will be located in your /definitions.
Thanks and best regards,
I am just have the exact problem, and struggled for days on redoing the tutorial several times, but still met with the same problem until found the upper reply, and gave me a hint.
In the tutorial, it says like the following:
Update the following fields with the values you copied previously:
Invoke URL: Insert the API target URL. You must specify the secure protocol HTTPS. For example:
apiconnect-ca3283b0-525c-488d-993b-3ab72fca78d0.youremail-dev.apic.mybluemix.net
TLS Profile: Insert the API invoke tls-profile.
For example:
client:Loopback-client
The origininal URL is $(runtime-url)$(request.path)$(request.search).
And the correct URL after updating is like following:
https://apiconnect-ca3283b0-525c-488d-993b-3ab72fca78d0.youremail-dev.apic.mybluemix.net$(request.path)
no slash before $(request.path), and $(request.search) should be deleted.
I also checked a tutorial video, it also do like this, but the screen for this step is passed away very quickly, you will not pay attention to this detail normally.
https://www.youtube.com/watch?v=Qku71JLv8vA&list=PLFa8jnU0KqE2eW5E449ziaurv8obSbcou&index=3&cm_mc_uid=24774488665514672571374&cm_mc_sid_50200000=1468400063

Yodlee Rest API (coblogin) doesn't work with simple Rest Client

I'm trying to implement the Rest API for Yodlee using Spring RestTemplate.
For starter I'm trying to use the simple chrome extenuation to test the API but it doesn't seem to work.
(see image url here)
https://www.evernote.com/shard/s3/sh/3c42d3fb-e69f-49c4-ab80-e4b607aca13e/03aea0e891c1f2c40414fcc992f2c307
The content type needs to be application/x-www-form-urlencoded and the request needs to be properly formatted.For example:
cobrandLogin=yourCobrandLogin&cobrandPassword=yourCobrandPassword
I've noticed that the error messages for the rest api are extremely unhelpful.