i am using apiconnect microgateway (available on github) to connect with any existing webservice and add some policies, i figured i have to create yaml files for my existing apis and add them to api connect's directory. here is a sample yaml file they have given.
# sample_1.0.0.yaml
#
info:
version: 1.0.0
title: sample
description: sample laptop yaml
basePath: /sample
swagger: '2.0'
paths:
/echo:
get:
responses:
'200':
description: 200 OK
x-ibm-configuration:
assembly:
execute:
- javascript:
title: write a small json object
source: |
message.body = { text : 'Hello World' };
schemes:
- http
my question is how do i invoke my existing rest service in this file and define policies like authentication, hit limits etc.
here is the link of micro-gateway github
https://github.com/strongloop/microgateway
Creation of REST service in API Connect is straightforward. Follow the instructions provide by IBM
In API Connect, the configuration or the scripts what we write in Assembly section will automatically populate in the swagger file(Source section in API Designer). So we don't need to manipulate any swagger file.
To invoke the existing rest service in API COnnect. Please follow the steps which you can find in the above link.
For the creation of REST service invoking SOAP service please follow this link
Thanks
SP
Related
Please help .i am new to cloud endpoint and not able to authenticate my nodejs api using cloud endpoint and api key .
My nodejs api:https://iosapi-dot-ingka-rrm-ugc-dev.appspot.com is working perfectly .However it's not working after authenticate with cloud endpoint and Api key.
For fetching data(get), i am using routing in my api like :
https://iosapi-dot-ingka-rrm-ugc-dev.appspot.com/ugc/iosreviewratings/20200611 : 20200611 : is any date range i have to pass .
https://iosapi-dot-ingka-rrm-ugc-dev.appspot.com/ugc/iosreviewratings/20200611?Limit=2&Offset=1
after endpoint deployment ., whenever i am acessing my api with api key , i am getting error " "message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
"
My Cloud endpoint has been deployed successfully .The below are my openapi.yaml .(ingka-rrm-ugc-dev : is my project id)
openapi.yaml
swagger: "2.0"
info:
description: "A simple Google Cloud Endpoints API example."
title: "Endpoints Example"
version: "1.0.0"
host: "ingka-rrm-ugc-dev.appspot.com"
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
paths:
"/ugc/iosreviewratings/*":
get:
produces:
- application/json
operationId: "auth_info_google_jwt"
parameters:
- name: Limit
in: query
required: false
type: string
x-example: '200'
- name: Offset
in: query
required: false
type: string
x-example: '2'
responses:
'200':
description: Definition generated from Swagger Inspector
# This section requires all requests to any path to require an API key.
security:
- api_key: []
securityDefinitions:
# This section configures basic authentication with an API key.
api_key:
type: "apiKey"
name: "key"
in: "query"
app.yaml
========--
runtime: nodejs
env: flex
service: iosapi
# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
# [START configuration]
endpoints_api_service:
# The following values are to be replaced by information from the output of
# 'gcloud endpoints services deploy openapi-appengine.yaml' command.
name: ingka-rrm-ugc-dev.appspot.com
rollout_strategy: managed
# [END configuration]
Please help me finding where is issue exactly and why api is not working with end point and api key
already enabled all service for for endpoint
gcloud services enable servicemanagement.googleapis.com
gcloud services enable servicecontrol.googleapis.com
gcloud services enable endpoints.googleapis.com
gcloud services enable ingka-rrm-ugc-dev.appspot.com
.
I'm trying to publish app from Azure DevOps to appcenter.ms
I have code building and artifacts are being generated. However, step to upload the app to appcenter always fails with the same error:
2019-01-28T14:40:34.0252515Z ##[error]"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST //apps//company/appname//release_uploads</pre>\n</body>\n</html>\n"
http response code: 404
I have added a service connection under Azure DevOps:
Name: api
Server URL: https://api.appcenter.ms
API Token: XXXXX
I'm using App Center Distribute step to publish.
Under build config I got app slug set correctly. What API endpoint I should use?
You can use this endpoint. I've got this issue too and stuck up for days trying to find the right answer but no reference says they change the endpoint.
Server URL: https://api.mobile.azure.com/v0.1
Although the instructions currently suggest otherwise I had success in using the org style APP SLUG setting and it fixed my issue.
{user}/{appname} is the format that worked for me.
I need to consume API in Logic App using API Management Action. I added API Management Action to Logic App with Echo Create Resource (POST) operation. According to the screenshot below I can pass Authentication object and Subscription key only.
I figure out how to add Query Parameters in Swagger API description and use them in Logic App.
How can I pass Body Parameters to API Post operation using API Management Action in Logic App?
You seem to consume the Echo API - I was able to reproduce. In this the POST operation has no body defined.
When I integrate one of my own APIs with a body definition I can see and use it in Logic App Designer
Sample
/mail:
post:
operationId: Send Email
parameters:
- name: mailMessage v3
in: body
schema:
$ref: '#/definitions/MailMessage v3'
consumes:
- application/json
responses:
'202':
description: ''
I'm trying to setup a NodeJS REST API using Google Cloud Endpoints and Google App Engine. I've cloned the offical sample project from GitHub and set up Google Cloud Endpoints using the Quickstart. Out of the box, it works fine,but I tried adding another API endpoint for a GET request at /, but the response I get after I deploy and make the request is as follows:
{
"code": 5,
"message": "Method does not exist.",
"details": [
{
"#type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": [],
"detail": "service_control"
}
]
}
The APIs which came pre-configured works fine, but only new ones which I add aren't working.
I've configured the new endpoint properly in my NodeJS app (it works fine locally). The corresponding code I've added is:
app.get('/', function (req, res) {
res.status(200).json({ message: 'Hello, world!' });
});
I've added the following to my openapi.yaml file:
paths:
"/":
get:
description: "Returns the message \"Hello, World\""
operationId: "root"
produces:
- "application/json"
responses:
200:
description: "Hello"
schema:
$ref: "#/definitions/helloMessage"
definitions:
helloMessage:
properties:
message:
type: "string"
After running gcloud service-management deploy openapi.yaml from a terminal to deploy and configure Google Cloud Endpoints, I got the service name and the service configuration ID, which I've replaced in app.yaml, in the format specified by the QuickStart
endpoints_api_service:
name: echo-api.endpoints.[YOUR-PROJECT-ID].cloud.goog
config_id: YOUR-CONFIG-ID
(That's the format, I've replaced YOUR-PROJECT-ID and YOUR-CONFIG-ID with the right ones)
I deployed the app to Google App Engine using gcloud app deploy. I can see the app running properly, via the Google App Engine console.
Yet, the GET method on / is not being identified as a valid endpoint and I get the response as stated above.
Am I missing something? I searched a lot about this problem, but didn't come across anything useful/similar!
P.S: By added, I mean, it is the code which I've added to the corresponding GitHub cloned files
EDIT:
I changed the API endpoint from / to /hello and it works fine!! Unable to understand why the same functionality on / is not working on Google Cloud Endpoints (works locally though!)
Google Cloud Endpoints does not currently support the root path at "/". This is something that is being looked into.
I was able to successfully create a test API and host in Azure. However when I try to create the proxy client, I receive the following error.
[Fatal]Error generating service model: The operation 'Get' has a body
parameter, but did not have a supported MIME type ('application/json')
in its Consumes property.
Exception: There was an error during code
generation when trying to add a client for the Microsoft Azure API App
Generating client code and adding to project failed
I checked the Swagger file and the Contains node was empty. When I change it to
"consumes": [
"application/json",
"application/xml"
]
the proxy creation works. Why did the auto-generated Swagger json not have the Contains property set? I went with the default SwaggerConfig when I created the API app. Am I missing some configuration? Any help will be greatly appreciated.
As I found out from the comments, the solution is to to remove the HttpRequestMessage as parameter of the Action. This will enable the API App Client to generate the code OK.
If you need to mock the object, please follow the documented way from here or another example here.