wso2 api manager 1.6.0 publisher - published api call to addAPI silently fails - rest

WSO2 API Manager 1.6.0 introduced a new problem, a REST Post to addAPI returns success but the added API record is incomplete, thus unusable. Inspecting the log file, I traced the issue to /publisher/site/themes/default/templates/overview/template.jag#3, a change in the jaggery file template.jag causes a java null pointer exception on line 3 with the following code 'var endpoint_config = parse(api.endpointConfig);'
With API Manager 1.5.0 this same REST API call worked but it took 3 min to complete on a VMWare box running SLES 11 SP2. Adding an API via the web interface also took 3 min. Trying both on Mac OS X and Windows, it took about 3 secs to run. With API Manager 1.6.0 on the same environments, the web interface now runs under 6 secs and the added API is correct. Now adding an API via the REST call results in an incomplete record being created, tested on both VMWare with SLES 11 SP2 and Mac OSX Mavericks.
Anyone experienced this issue?

It seems documents related to publisher APIs have not been updated yet. With API Manager 1.6.0 there has been a change in the way endpoints are stored. To make the REST API call working can you try with a request similar to following;
curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d"action=addAPI&name=YouTube1&context=%2Fyoutube1&version=1.0.0&tier=Gold&responseCache=disabled&visibility=public&endpoint_config=%7B%22production_endpoints%22%3A%7B%22url%22%3A%22http%3A%2F%2Fgdata.youtube.com%2Ffeeds%2Fapi%2Fstandardfeeds%2Fmost_popular%22%2C%22config%22%3Anull%7D%2C%22endpoint_type%22%3A%22http%22%7D&endpointType=nonsecured&subscriptions=current_tenant&resourceTemplate=%2F*&resourceCount=0&resourceMethod-0=POST&resourceMethodAuthType-0=Application&uriTemplate-0=%2F*&resourceMethodThrottlingTier-0=Unlimited&tiersCollection=Gold"
When decoding the request you can see that endpoint is now defined as a JSON
endpoint_config={"production_endpoints":{"url":"http://gdata.youtube.com/feeds/api/standardfeeds/most_popular","config":null},"endpoint_type":"http"}

Related

IBM Watson Studio API suddenly started throwing an error when trying to upload a model

I'm using the latest ibm_watson_machine_learning SDK (python)
Until a few days/weeks ago my code was working fine but now I get an error when running
client.repository.store_model(model='./model.tar.gz', meta_props=model_metadata)
Here is some sample code:
https://github.com/IBMDecisionOptimization/oplrunonwml
Exception has occurred: IndexError
list index out of range
File "C:\Temp\oplrunonwml\oprunonwmlv2.py", line 126, in main
model_details = client.repository.store_model(model='./model.tar.gz', meta_props=model_metadata)
File "C:\Temp\oplrunonwml\oprunonwmlv2.py", line 215, in <module>
main(sys.argv[1:])
I get this error while using various different models (OPL/Cplex/Docplex) and they all fail with this error.
What's strange, is that the model is uploaded correctly in the Deployment Space and I can use it without problems in deployment/jobs on the UI or on other scripts.
The code was working fine without any changes a few weeks ago so I assume something's changed on the API side
Update:
I'm using a Cloud Lite account.
I'm also using the latest version of the SDK
client = APIClient(wml_credentials)
print(client.version) # 1.0.29
print(client.version_param) #2020-08-01
I deleted all my IBM services (ObjectStorage,WatsonStudio) and created new ones but I still get the same error.
I would suspect the WML v2 instances deployement.
*** With V2 plan, user need to use updated Python SDK (ibm-watson-machine-learning 1.0.38) ***
If you had a v1 iunstance before and according to your plan, it might have been keeping working withoutmirgation for a while.
May be you reached the end of this compatibility period.
Can you clarify your plan type?
See https://medium.com/#AlainChabrier/migrate-your-python-code-for-do-in-wml-v2-instances-710025796f7
Alain

Not Found http://localhost:3000/openapi.json -loopback 3

Please help me,I'm stuck at this point.
Steps done succesfully,
1)Install loopback 3
2)datasource is created ,generated models from mysql and generator script
3)updated model-config.json
4)loopback has run with no errors
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
---This was command prompt
5)when trying to access that Not Found http://localhost:3000/openapi.json
LoopBack 3 does not support OpenAPI v3, we support the older v2 specification only (it's usually referred to as Swagger).
The API spec in Swagger JSON format is available at the following URL:
http://0.0.0.0:3000/explorer/swagger.json
Please check out the recently announced LoopBack 4 version if you are interested in OpenAPI v3: the announcement and the new website.
I faced same error
Clear your browser cache then run URl
http://localhost:3000/explorer

Couchbase 4.1 - N1QL by endpoint

I use Reactive Couchbase (this is Scala port for Java SDK - https://github.com/ReactiveCouchbase/ReactiveCouchbase-core)
And for query this use http endpoint (http:// mycouchbaseadress:8093 /query?q=N1QL Comand) but response for server is "Unrecognized parameter in request: q".
I Find in stackoverflow to start cbq-engine so try to launch 'cbq-engine -couchbase http:// mycouchbaseadress:8093 /' but have error ''flag provided but not defined: -couchbase"
My couchbase version is 4.1 community
Do you know how I can send my n1ql query to server by endpoint?
It seems like there is a bug in ReactiveCouchbase, or at least its N1QL support was developed against an outdated beta version of the feature.
With Couchbase Server 4.0 GA and above, you don't need to run cbq-engine (this was the process used during N1QL's beta).
The problem is that in the code, the q= parameter is used where it should now be statement= (or a JSON body).
There is a open pull-request that happens to fix that issue among other things, but it's been opened a long time.

Can ASP.NET Web API methods be called from a Windows CE app / CF 3.5?

We were thinking about doing something like WCF / REST - I think the techn[ique,ology] was called ADO.NET Data Services in VS 2008 / .NET 3.5 - anyway, something like a RESTful receiving and transmitting of data from a CF 3.5 app and a desktop .NET 4 app to simplify the client / Windows CE app so that it simply sends and receives XML or JSON data, rather than connecting to a remote database or so.
However, according to Where to start REST web service in C# or ASP.Net:
"REST in WCF no longer supported - now it points to ASP"
From the same link:
"ASP.NET Web API is now the Microsoft framework for creating RESTful services.
http://www.asp.net/web-api"
Okay, I think we can do that (WebAPI) - the plan is to host the server/service in IIS; however: Can ASP.NET Web API methods be called from CF 3.5? Does anybody have examples of such?
As long as CF 3.5 can make http requests, then you should be able to make rest calls. Look for HttpWebRequest in CF.
http://msdn.microsoft.com/en-us/library/aa446517.aspx
Look at Microsoft's article Calling WCF Services.
To create your service, you are going to need to Power Toys for .NET Compact Framework 3.5, then turn around after installing that to Download the New NetCFSvcUtil (that is a direct download).
I've created Batch files that I store in my Services folder of my Windows Mobile Project (that way, I can't lose them). The batch file is like this:
** create.bat **
NetCFSvcUtil.exe /l:cs /o:Employee.cs /cb:ServiceModelBase http://cpweb2/mainframe/AcpEmployee.svc?wsdl
pause
NetCFSvcUtil.exe /l:cs /o:Packout.cs /cb:ServiceModelBase http://cpweb2/mainframe/AcpPackout.svc?wsdl
pause
That creates 2 Proxy files for me: One for Employees and one for my Packout service. They both create the same base file, ServiceModelBase, which is just a way for services to throw exceptions.
Adding the pause between steps enables you to read any error messages that are thrown up on the screen before running the next command.

Sending events to the dev version of a ruleset via HTTP

I've been writing an endpoint that sends events to a KRL ruleset via HTTP GET (based on the documentation here), in this format:
http://cs.kobj.net/blue/event/{domain}/{eventname}/{appid}
That works great when the version of the app I want to test is the same one that's deployed. I don't always want to deploy before testing it, though. Using the stated format for calling the dev version doesn't work. It still calls the deployed version of my ruleset:
http://cs.kobj.net/blue/event/{domain}/{eventname}/{appid}:kynetx_app_version=dev
What am I doing wrong?
{appid}:kynetx_app_version=dev
is a query parameter so it needs to come after a '?' or a '&'
Changing your query to the following should get it to work
http://cs.kobj.net/blue/event/{domain}/{eventname}/{appid}/?{appid}:kynetx_app_version=dev