I am using APIM 1.10 to add new APIs via the REST-API (see: https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIsApi#apisPost)
If I add my first version of an api it works fine. The new API is listed in Publisher.
But if I use the same add-methode with the same data (except the version- and the endpoint-element). I receive the message: "Resource Already Exists"
Question: Which is the best way to add a new version of a existing API via REST?
Should I use update-methode instead, but it is not an update?!?!
Please help me!
Thx, in advance
Marty
Question: Which is the best way to add a new version of a existing API
via REST?
You have to use Copy API and provide new version as query parameter like below.
curl -H "Authorization: Bearer b0982cd2aacd463ff5f63cd5ebe58f4a" -X POST "http://127.0.0.1:9763/api/am/publisher/v0.9/apis/copy-api?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&newVersion=2.0.0"
My final solution looks like this:
read all existing apis
cluster the apis via name, context, versions in a hashmap
before adding a new api i check if a other version of this api exists
if yes, i use the copy rest-methode with addition update-methode
if no, i can use the add-methode
Regards
Marty
Related
I need to add a WebRootContext to all the calls in the WSO2 Identity Server's Implicit Flow so that I can make calls through an API Gateway. I have managed to do this for all the calls I need by changing the
<WebContextRoot>/wso2-is<WebContextRoot>
property as well as changing the name of my webapp folders: wso2-is#authenticationendpoint and wso2-is#oauth2 endpoints. I can now successfully call http://localhost:9443/wso2-is/oauth2/authorize.
I also changed the endpoints in repository/conf/identity/identity.xml to include the wso2-is root context, specifically the OAuth2AuthzEPUrl, so that in the management console this shows up under identity:
However, after I login, the application calls http://localhost:9443/wso2-is/commonauth which has a return location of http://localhost:9443/oauth2/authorize?sessionDataKey=... and I can't figure out how to add my context root to the returning call. Where does the commonauth endpoint get the location it returns to? I'm assuming there is some property I need to set to make that happen, but I can't find it.
I also tried re-seeding the database with all my changes and this did not solve my issue either.
I looked in the source code here in github and couldn't find any references to commonauth or oauth2/authorize that stood out as to where this call is being formed. Any additional details would be greatly appreciated.
As per the official documentation, using a reverse proxy is the recommended way to add a custom context path to wso2 products.
However, as I wrote in another question, I could complete the implicit flow with local auth successfully with the mentioned configs in my answer.
I guess, what you are missing here is ProxyContextPath.
I am using APIM 1.10 to add new APIs via the REST-API (see: https://docs.wso2.com/display/AM1100/apidocs/publisher/#!/operations#APIsApi#apisPost) and it works fine but:
I want to add the security-scheme: "Basic Auth" for the api endpoint.
But I have no idea how to do this, because the endpointConfig-config is not described.
I need something like this: endpointSecured:true, endpointAuthDigest:"Basic", endpointUTUsername:"usN", endpointUTPassword:"pass"
Any ideas?
C ya,
Marty
Following steps will help you to achieve the requirement.
Edit the API and go to the implementation tab.
Click on "Show More Options".
Select "Secured" for Endpoint Security Scheme.
Provide the credentials and save.
When you create API using rest API, you can add secure endpoint details by adding following part. &endpointType=secured&epUsername="admin"& epPassword="admin"
Here is a sample command
curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=SampleAPI&context=/country&version=1.0.0&visibility=public&thumbUrl=&description=Check Country by Code&tags=country&endpointType=secured&epUsername="admin"& epPassword="admin"&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://services.groupkt.com/country/get/iso2code/IN","config":null},"endpoint_type":"http"}';
Im trying to use the cloud kit web service but i keep getting 'Method not allowed'
Why is this?
curl "https://api.apple-cloudkit.com/database/1/iCloud.nl.igeni.MYIDHERE/development/users/current?ckAPITokenMYTOKENHERE"
Method Not Allowed
You forgot private or public. Also, caller is now preferred over current.
The correct url is:
https://api.apple-cloudkit.com/database/1/iCloud.nl.igeni.MYIDHERE/development/public/users/caller?ckAPITokenMYTOKENHERE
See the documentation at https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/FetchCurrentUserIdentity.html#//apple_ref/doc/uid/TP40015240-CH27-SW1
If I enable the option giving in Advanced Settings is gives me BAD Request or error code 400
If I enable this option, what is the required value of AppSecret_Proof parameter?
If you visit github and have a look at their PHP SDK's code, you'll find how they generate appsecret_proof's value.
This part was recently added so you have to refer to the latest version of PHP SDK. To activate/inactivate, as you already know, you have to visit App Dashboard > Setting > Advanced.
EDIT: 2013-08-09
Now they have official document.
From the documentation article Securing Graph API Requests:
The app secret proof is a sha256 hash of your access token, using the app secret as the key. Here's what the call looks like in PHP:
$appsecret_proof = hash_hmac('sha256', $access_token, $app_secret);
As the title says, what is the difference when doing a request with the php sdk, between api('/me') and api('/current_user_fbid')?
Adding to avs099's answer.
You cannot use me without an access token. But you can use an id without access token.
e.g.
http://graph.facebook.com/1137725463 works, but
http://graph.facebook.com/me will fail
as #Dhiraj Bodicherla said, "me" and "current_user_id" are the same - but there are exceptions when you cannot use "me" - for example, when you do requests using application or page tokens. So if you are writing a backend code which is dealing with multiple users/tokens etc - keep this in mind - you can't use "me" with app token.
Using me or current_user_id in graph api will yield the same result.
You should check Developer Tool Explorer
DEMO
Hope this helps