wso2 api manager 1.6.0 query parameters not accepted - rest

I am using wso2 API manager 1.6.0 and would like to create an API which accepts any POST
on /users resource followed by any query parameter such as "clientid" (as described below)
restserver.com:8280/context/1/users?clientid=333
I have created an API in API publisher as follow :
URL Prefix URL Pattern HTTP Verb
/context/1 /users/* POST
Any POST on /users is accepted but as sson as I add a query paramter /users?clientid=333 , the request is rejected by the API Manager gateway with 403 error.
Could someone advice me on this and what should be the correct url-mapping format ?
The resulting url-mapping in synapse config file is as follow : (synapse-configs/default/api/)
Thanks a lot.
JS

For this you need to define uri-template instead of uri-mapping. This blog post explains more about this.
For your case I got it working as following.
Open your API configuration source which can be found at AM_HOME\repository\deployment\server\synapse-configs\default\api folder.
In the resource tag change url-mapping="/users/*" attribute to uri-template="/users/*"
But you will have to invoke the API as follows with additional context because when you say /users/* it means anything can come after users/. So you need to have a / after users context.
restserver.com:8280/context/1/users/usr?clientid=333

Related

Add protocol mapper to client via keycloak REST API

By the latest Keycloak's REST API documentation https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_protocol_mappers_resource, I can't find enough information to add a new protocol mapping with mapper type 'Audience' by REST API. I am able to do it by Keycloak UI (See attached) and now I would like to automate it to our DevOps pipeline.
I wonder if the only way to find out the json content is to look at the request payload of the POST Request suggested by this post:
Where are all of the Keycloak Protocol Mapper Config Options documented?
There are also some information on keycloak ui : in the browser's debugger console (mapper types)
You need to issue an HTTP POST request to http://<host>:<port>/admin/realms/<realm_name>/clients/<client_id>/protocol-mappers/models
with a payload like this
{
"protocol":"openid-connect",
"config": {
"id.token.claim":"false",
"access.token.claim":"true",
"included.client.audience":"admin-cli",
"included.custom.audience":"custom_audience"
},
"name":"Audience Mapper",
"protocolMapper":"oidc-audience-mapper"
}

How to call REST API related to Azure Search through postman?

I am trying to call REST API related to Azure Search through postman.
Here is the API link: (Check Step 1: Create a data source)
https://learn.microsoft.com/en-us/azure/search/search-howto-indexing-azure-blob-storage
Have sent parameter api-key: [admin key] in form-data and other through jSON object.
I am getting 403 error.
Whats the correct way to get required output?
Update :
Changed position of api-key. Still getting the error as :
Is there any additional setting for postman to work with Azure's REST APIs?
Please make sure that you pass api-key in Headers instead of form-data and also all the headers should be selected. Once you do that, things should work just fine.

How to hit SAP HANA rest APIs through postman?

I am trying to hit SAP HANA's rest APIs but unable to get started because i didn't get any proper document that specifies the steps that i can use to hit APIs through POSTMAN(or any other rest client). Do i need to install anything before using the resp APIs or are they available to be used directly? Also what all are the parameters that i need to mention while hitting the API and what is the base URL that is to be used?
Ok, the HANA XS API is documented: SAP HANA XS JavaScript API Reference
For the error: most likely, you're not using any authentication in Postman. When you e.g. switch to "Basic Auth" and key in your HANA username and password, something like this
https://<hostname>:43<instance no>/sap/hana/xs/dt/base/info
should work.
Below is sample Request in to Hit REST API Using Postman :
1. http://localhost:8080/my-rest-api/progress-report?name=shekhar&region=east&address=India
Add Headers Info if any : like
accept : application/json;v=1
contentType : application/json;v=1

Route defined in Swagger specification (/sales) but there is no defined get operation

I am creating APIs with importing existing APIs from swagger JSON file to a Bluemix API Connect environment. When I use Invoke to test a post API I get the following error:
405 Method Not Allowed Content-Type: text/html Error: Route defined in
Swagger specification (/sales) but there is no defined get
operation. at send405
(/home/vcap/app/node_modules/swagger-tools/middleware/swagger-router.js
Any experience with POST request with Bluemix API Connnect?
There are several reasons why this can happen.
Here are some:
you need to define a tag for each operation.
this tag is not allowed to have special characters, such as -.

What's the correct uri for QBO v3 API update operation?

I'm trying to use the QBO v3 API object update function described here. The API explorer shows a different uri.
I'm trying to update an account with Id 42. Both of the following URIs get me a 401:
As the documentation would suggest:
https://quickbooks.api.intuit.com/v3/company/0123456789/account?requestid=42
(the above at least gives me a json blob with the 401)
As the api explorer would suggest:
https://qb.sbfinance.intuit.com/v3/company/0123456789/account?operation=update
(here I don't even get the json, just a plain 401)
My request body is successful when I use the api explorer, so I don't believe that's the problem. I also don't believe authentication is the problem, because I can successfully create objects and also make queries with the same headers.
What might I be missing?
Don't put the Account object's ID into the URL. The [?requestid=] from the documentation you mentioned apparently refers to an id related to the request (not the object in question). The API Explorer's URI appears to simply mislead (although I could certainly be missing something here).
In your example, just use this:
https://quickbooks.api.intuit.com/v3/company/0123456789/account
Let the headers and request body do the rest.
Correct BASE URI: https://quickbooks.api.intuit.com/v3/company/
you can refer example request/response section of any entity doc.
Ref -https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/bill
To debug(401 authentication issue), you can use any standard RestClient.
In the following thread, I've explained how to use RestClinet plugin of Mozilla to test any QBO V3 endpoint.
InvalidTokenException: Unauthorized-401
You can download IPP's devkit and using that devkit you can call any endpoints easily.
https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits
Hope it will be useful.
Thanks