When I'm executing a curl request to publish an api in API Manager-Publisher it shows it is added ... but not able to change its status.. !!! Not able to open that API as well !!!
My Request:
curl -X POST -b cookies http://my.api-site.com:9763/publisher/site/blocks/item-add/ajax/add.jag \
-d "action=addAPI&name=TwitterAPI&context=/twitter&version=1.0.0&tier=Bronze&tier=Gold&transports=http&http_checked=http&transports=https&https_checked=https&description=Twitter&visibility=public API&tags=twitter,api&resourceCount=0&resourceMethod-0=GET,PUT,POST,DELETE,OPTIONS&resourceMethodAuthType-0=Application & Application User,Application & Application User,Application & Application User,Application & Application User,None&uriTemplate-0=/*&resourceMethodThrottlingTier-0=Unlimited, Unlimited, Unlimited, Unlimited, Unlimited&tiersCollection=Bronze,Gold,Silver,Unlimited" \
-d 'endpoint_config={"production_endpoints":{"url":"http://search.twitter.com","config":null},"endpoint_type":"http"}'
Responce:
{"error" : true, "message" : " null"}
Can anyone help !!!
The parameters are passed in curl as key1=value1&key2=value2...
format. So, if the key1, key2, value1, value2 contains any special character like =
, &
, ?
then should be urlencoded.
Your problem is with this parameter:
resourceMethodAuthType-0=Application & Application User,Application & Application User,Application & Application User,Application & Application User,None
You have lots of &
character in your value. It should be urlencoded
. For example this & should be replaced with %26
So the string will be:
resourceMethodAuthType-0=Application %26 Application User,Application %26 Application User,Application %26 Application User,Application %26 Application User,None
Another thing, if you are running the command from windows, the use double quotes always, not single quote. For example:
-d "endpoint_config={\"production_endpoints\"...}"