I have gone through this document and created an API , mapped to my lambda function and its working fine .Now i need to add more path parameter to my URL rather than '/mydemoresource' (Eg :-/mydemoresource/sub-resource.json) but AWS not allowing to give / as resource name.Any suggestion ,thanks in advance
/ is automatically setup as the root resource when setting up a new API Gateway. You can create a new method at the root level.
When published, the API Gateway includes the stage as part of the URL. In case you're referring to that, you can use custom domain names and add an API mapping to avoid the stage name to be included in the client visible URL.
Related
I am tasked to pull the data for Method: vitals.crashrate.get programatically.
Please refer to the reference document here
https://developers.google.com/play/developer/reporting/reference/rest/v1beta1/vitals.crashrate/get
the required scope mentioned in the document is "https://www.googleapis.com/auth/playdeveloperreporting"
when i try to check the scope it says as below:
You are receiving this error either because your input OAuth2 scope name is invalid or it refers to a newer scope that is outside the domain of this legacy API.
This API was built at a time when the scope name format was not yet standardized. This is no longer the case and all valid scope names (both old and new) are catalogued at https://developers.google.com/identity/protocols/oauth2/scopes. Use that webpage to lookup (manually) the scope name associated with the API you are trying to call and use it to craft your OAuth2 request.
when i checked the https://developers.google.com/identity/protocols/oauth2/scopes
i could not find any relevant scopes that can be used to fetch the data from Method: vitals.crashrate.get
Please point me to any updated document, or the new scope that you know off.
I have two types of URL patterns as below.
/gateway/secure/api/user/getUser
/gateway/nonsecure/api/user/getUser
(Context root of zuul gateway application is gateway)
Using zuul filters I'm trying to implement two different logics based on secure and nonsecure URL patterns. I've written a pre-filter and seems it's not even executing that filter for above URL patterns. I could see gateway is throwing 404. When I try to access microservice without secure or nonsecure its working as expected. Below are the property changes I've done so far.
Context root of downstream microservice is api/user
zuul.prefix=/secure
zuul.routes.user.path=/api/user/**
zuul.routes.user.service-id=user
zuul.prefix=/nonsecure
zuul.routes.user.path=/api/user/**
zuul.routes.user.service-id=user
I've already tried by giving zuul.prefix and it seems prefix is setting as globally and cant apply only for specific routes. How can I achieve this? Can anyone please advice.Thanks
As you noted, the zuul.prefix property affects all mappings and can only be defined once. So, drop the zuul.prefix property and add the corresponding prefix to each zuul.routes.*.path properties:
zuul.routes.user.path=/secure/api/user/**
zuul.routes.user.service-id=user
zuul.routes.user.path=/nonsecure/api/user/**
zuul.routes.user.service-id=user
Note that, according to the documentation:
zuul.stripPrefix only applies to the prefix set in zuul.prefix. It does not have any effect on prefixes defined within a given route’s path.
I have a requirement to send the folder details in the URL for POST method, some thing like this
http:///{directory}/{filename}
I am using Spring API to create the service. Using #PathVariables to two variables in the URI.
Problem : Directory can have "/" slashes in it.
Now how can I create my API, please help me.
POST http://example.com/api/files/path/to/my/file/filename
Stick a controller on /api/files. Scrape the URL starting after /files. Use that to locate the file.
P.S. This has the potential to be a Very Bad Idea. Make sure you secure the controller to only expose those parts of your filesystem you don't mind random internet strangers to be able to operate on.
To update the resource i have exposed following reset web api url -
http://server.com/api/v1/{companyid}/resources/{resourceid}
and request body contains the resource to be updated.
I have also exposed a seperate API to update a property of same resource. From business rule perspective this is special property and cannot be updated/retrieved along with normal resource api.
So using following url to expose separate api as below -
http://server.com/api/v1/{companyid}/resources/{resourceid}/property?propertyKey=propertyValue
this does not sound good. Is there better approach?
Answer from the comments for others
PUT api/v1/{companyid}/resources/{resourceid}/{property} with the Body containing the value of the property is one way.
PUT api/v1/{companyid}/resources/{resourceid}/{property}/{propertyvalue} is another way if you want the value entirely in the URL.
Of course, http://server.com/api/v1/{companyid}/resources/{resourceid}/property?propertyKey=propertyValue is also probably fine.
As #David-Brabant mentioned don't version your API's in the URL
I'm using the following moviefone web service in one of my Android applications:
http://gateway.moviefone.com/
The user enters his zip code, and the following XML data is used to get his nearby movie theaters and movies.
http://www.moviefone.com/search/19087?format=xml
My question is, how do you add the parameter for changing the date of the showtimes? That XML only contains movie information for the current date. The web service gateway page says: "params: zip/id= count= date=YYYYMMDD"
I tried adding "date=20120208" to the end of the URL but it didn't work.
Use a & to separate multiple parameters:
http://www.moviefone.com/search/19087?format=xml&date=20120208
Separate parameters with an &