Bulk importing swagger files using wso2 API Manager - wso2-api-manager

I'd like to know if it's possible to automate the process of importing swagger files in wso2 api manager. If so how can it be done?
thanks

You write a script to create an API using Publisher's API.
You can add resources, including scopes, as a Swagger payload.
https://docs.wso2.com/display/AM210/Publisher+APIs#PublisherAPIs-AddAPI
curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=PhoneVerification&context=/phoneverify&version=1.0.0&visibility=public&thumbUrl=&description=Verify a phone number&tags=phone,mobile,multimedia&endpointType=nonsecured&tiersCollection=Gold,Bronze&http_checked=http&https_checked=https&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*&default_version_checked=default_version&bizOwner=xx&bizOwnerMail=xx#ee.com&techOwner=xx&techOwnerMail=ggg#ww.com" -d 'endpoint_config={"production_endpoints":{"url":" http://ws.cdyne.com/phoneverify/phoneverify.asmx","config":null},"endpoint_type":"http "}'

You can write a java/python client or create a script which will include the couple of hits to the APIs mentioned in the publisher api document.
Generate the token using scopes: apim:api_create apim:api_view apim:api_publish
Call the Update swagger definition
Change API-Status to Publish using the Change API Status

Related

Is the google cloud monitoring API for creating SLOs supported for cloud endpoints?

I'm following instructions here to get a list of services in my project from the google monitoring API: https://cloud.google.com/monitoring/service-monitoring/using-api#using-curl
curl --http1.1 --header "Authorization: Bearer ${ACCESS_TOKEN}" https://monitoring.googleapis.com/v3/projects/${PROJECT_ID}/services
I get back results for appEngine and clusterIstio objects within my project, but not for my Cloud Endpoints.
The documentation here suggests that Cloud Endpoints are supported: https://cloud.google.com/monitoring/service-monitoring/using-api#choosing-svcmon-api.
Are there any missing instructions here for maybe enabling the endpoints for monitoring?
You can use the API to create custom SLOs using just about any metrics in your project.
First, create a service using this call:
https://cloud.google.com/monitoring/service-monitoring/using-api#service-create
Then, create SLOs against that service:
https://cloud.google.com/monitoring/service-monitoring/using-api#slo-create
Here's a walkthrough (using an App Engine service, rather than a custom one):
https://medium.com/google-cloud/slos-with-stackdriver-service-monitoring-62f193147b3f

Firebase: 403 PERMISSION_DENIED (FirebaseError: Installations): Requests are blocked, after updating SDKs (FirebaseInstallationsService)

I updated the Firebase SDKs of my Firebase for Web application.
Since the update my application no longer starts and throws the following error:
Any idea what is going on?
Uncaught (in promise)
FirebaseError: Installations: Create Installation request failed with error "403 PERMISSION_DENIED: Requests to this API firebaseinstallations.googleapis.com method google.firebase.installations.v1.FirebaseInstallationsService.CreateInstallation are blocked." (installations/request-failed).
It turns out that new versions of Firebase SDKs depend on a new internal infrastructure service, called FIS (the Firebase Installations Service) for targeting identifiers ("FIDs" or "Instance-IDs").
If you are using API key restrictions for the API keys you use in your application, you will have to extend those restrictions to allow usage with the new Firebase Installations Service at firebaseinstallations.googleapis.com.
To allow your API key in question to be used with the new Firebase Installations API:
go to the Google Cloud Console
choose the relevant project (i.e. the project you use for your application)
open the menu and go to APIs & Services -> Credentials
click Edit API key for the API key in question
scroll down to API restrictions
from the dropdown, choose Firebase Installations API
click Save
wait a couple of minutes for Google servers to update and retry...
Note: If you cannot find the Firebase Installations API in the list of APIs, you might first have to enable the API for your project (to do so click here).
Note: If you are not sure which API key is used in your application, you can check the usage numbers of Firebase Installations API per API key.
Note: Verify your fix by checking if you can see successful 200 requests increasing on the Firebase Installations API request metrics page.
Test if your configuration works with the following CURL command:
api_key=<YOUR_API_KEY>;
project_identifier=<YOUR_PROJECT_ID>;
app_id=<YOUR_FIREBASE_APP_ID_SIMILAR_TO_1:12345678:android:00000aaaaaaaa>;
curl -H "content-type: application/json" -d "{appId: '$app_id', sdkVersion: 't:1'}" https://firebaseinstallations.googleapis.com/v1/projects/$project_identifier/installations/?key=$api_key;
If your API key uses App restrictions you will have to expand your CURL request with the respective HTTP headers identifying your application:
Android: -H "x-android-package: com.rayo.example.app" -H "x-android-cert: 1234567890ABCDEF1234567890ABCDEFAABBCCDD"
iOS: -H "x-ios-bundle-identifier: com.rayo.example.app"
Webapp: -H "Referer: https://www.your.webapp.com/page?p=1"

WSO2: APIM scope apim:subscribe can be added to WSO2 Identity Server

I have integrated WSO2 (IS-KM-5.6.0) with APIM 2.5.0.
I am using below command to generate access token with default scope
curl -u : -k -d "grant_type=password&username=ldapuser#local.com#carbon.super&password=password" -H "Content-Type:application/x-www-form-urlencoded" https://localhost:9445/oauth2/token
it gives me proper access token with scope as default. Below is the result of the above command:
{"access_token":"5218d614-e327-379f-819a-b9572daa106d","refresh_token":"4ed7484d-ca30-31c1-8bce-e778f4aab6fd","scope":"default","token_type":"Bearer","expires_in":2568}
But, I am unable to use this in invoking the rest APIs of APIM (publisher rest APIs) to perform below activities:
a) getting store application details
b) adding applications etc etc
I read in WSO2 documents that to use the store and publisher restAPIs, only scopes which are available for APIM store and publisher can only be used.
So,Can these store or publisher restAPIs be invoked without scopes (apim:subscribe) or is there any other way to do so?
Any help?
Thanks
The store or publisher restAPIs can't be invoked without scopes.
For publisher & store there are separate scope. Scope for store & for creating application is same apim:subscribe. Scope for publisher related apis is apim:api_view. You can get api specific scopes from store & publisher api documentation. FYI you can specify multiple scopes in one shot as well.

WSO2 API publisher and store issue

I need add multiple API publisher and store but I don't want to use WSO2 UI to add one by one.
How to use program to add all API publisher and store?
Thank you.
You can use the APIs published by WSO2. Take a look at their documentation.
Before you make an API calls, you to have call following APIs to receive scope & access_token:
Register your application using /register.(the client from which you will be making API call needs to be verified.)
Get access_token using /token API.

Manage subscriptions on WSO2 API Manager without API Store Interface

I am using WSO2 API Manager to expose few APIs. But I don't want that the consumer use the API store for the subscriptions. The creation of subscriptions/applications and Access tokens should be managed through by my custom web application.
I have checked the WSO2 API Manager docs https://docs.wso2.com/display/AM210/apidocs/store/ and imported the swagger in SoapUI. When I try to invoke the store api of my local API Manager I am getting the HTML content of API store page. see below screenshot.
Can anyone please help what I am doing wrong? Or is there any other way to the requirement.
You need to pass token which is generated by passing scope and client secret key and password as described in https://docs.wso2.com/display/AM210/apidocs/store/#guide

Resources