HI Madusanka,

We have referred that document and it contains how to add inline document,
 its working fine, problem is how to add a .txt file or a .pdf using  the
REST API.

Thanks and Best Regards,

Saneth Dharmakeerthi
Senior Software Engineer
WSO2, Inc.
Mobile: +94772325511

On Wed, Sep 16, 2015 at 1:04 PM, Madusanka Premaratne <madusan...@wso2.com>
wrote:

> Hi Bhagya,
> Did you try WSO2 Publisher APIs[1]. Find Add/Update API Document in the
> link
>
> [1] - https://docs.wso2.com/display/AM191/Publisher+APIs
>
> Thanks,
> Madusanka
>
> On Wed, Sep 16, 2015 at 12:11 PM, Bhagya Dimenguwari <bha...@wso2.com>
> wrote:
>
>> Hi,
>>
>> I tried to add new document to an API with the Source Type "File". I used
>> the requested parameters as [1] referring firebug  information [2] and it
>> does not allow to add the document and got the exception [3].
>>
>> I am going to test Integration test by referring test case - *APIM2-622:Add
>> documentation to an API [ sample & SDK | File ] through the publisher REST
>> api* in test link
>>
>> *.*
>> Are there any document to refer for add a new file through the REST Api?
>>
>>
>> [1]
>>
>>
>> action=addDocumentation&provider=admin&apiName=APIM620PublisherTest&version=1.0.0&docName=APIM622PublisherTestHowTo-File-summary&docType=samples&sourceType=file&docUrl=http://=&summary=Testing&docLocation;filename="filters.txt";
>> Content-Type: text/plain -org.wso2.carbon.caching.core.identity.*
>> -org.wso2.carbon.caching.core.permissiontree.*
>> -org.wso2.carbon.caching.infinispan.*
>> -org.wso2.carbon.event.core.internal.delivery.jms.*
>> -org.wso2.carbon.event.core.qpid.*
>> -org.wso2.carbon.registry.synchronization.* -org.wso2.throttle.*
>> -org.wso2.carbon.apimgt.hostobjects.AssetStoreHostObject.java
>> -org.wso2.carbon.apimgt.gateway.handlers.security.thrift.*
>> -org.wso2.carbon.apimgt.keymgt.service.thrift.*
>> -org.wso2.carbon.apimgt.impl.workflow.* -org.wso2.carbon.apimgt.usage.*
>> -org.wso2.carbon.throttle.module.utils.*
>> -org.wso2.carbon.throttle.module.utils.impl.*
>> -org.wso2.carbon.throttle.module.handler.*
>> -org.wso2.carbon.throttle.core.impl.domainbase.*
>> -org.wso2.carbon.throttle.module.*
>> -org.wso2.carbon.throttle.core.impl.ipbase.*
>> -org.wso2.uri.template.parser.*&mimeType=text/plain&optionsRadios=samples&optionsRadios1=file
>>
>> [2]
>>
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="mode"
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="docUrl" http://
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="sourceType" file
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="summary" add new doc
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="docType" samples
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="docName" filterdoc
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="version" 1.1.2
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="apiName" APIM1234
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="action" addDocumentation
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="provider" admin
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="mimeType" text/plain
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="optionsRadios" samples
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="optionsRadios1" file
>> -----------------------------95753468186848783342988543
>> Content-Disposition: form-data; name="docLocation"; filename="filters.txt"
>> Content-Type: text/plain -org.wso2.carbon.caching.core.identity.*
>> -org.wso2.carbon.caching.core.permissiontree.*
>> -org.wso2.carbon.caching.infinispan.*
>> -org.wso2.carbon.event.core.internal.delivery.jms.*
>> -org.wso2.carbon.event.core.qpid.*
>> -org.wso2.carbon.registry.synchronization.* -org.wso2.throttle.*
>> -org.wso2.carbon.apimgt.hostobjects.AssetStoreHostObject.java
>> -org.wso2.carbon.apimgt.gateway.handlers.security.thrift.*
>> -org.wso2.carbon.apimgt.keymgt.service.thrift.*
>> -org.wso2.carbon.apimgt.impl.workflow.* -org.wso2.carbon.apimgt.usage.*
>> -org.wso2.carbon.throttle.module.utils.*
>> -org.wso2.carbon.throttle.module.utils.impl.*
>> -org.wso2.carbon.throttle.module.handler.*
>> -org.wso2.carbon.throttle.core.impl.domainbase.*
>> -org.wso2.carbon.throttle.module.*
>> -org.wso2.carbon.throttle.core.impl.ipbase.* -org.wso2.uri.template.parser.*
>>
>> [3]
>>
>> hPublisherRestAPITestCase.testAddDocumentToAnAPIHowToFile ----
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -
>> [2015-09-16 11:24:34,175] ERROR - APIProviderHostObject Error while
>> creating an attachment for Document-
>> APIM622PublisherTestHowTo-File-summary-1.0.0. Empty File Attachment.
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -
>> org.wso2.carbon.apimgt.api.APIManagementException: Empty File Attachment.
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject.jsFunction_addDocumentation(APIProviderHostObject.java:2990)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> java.lang.reflect.Method.invoke(Method.java:597)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.publisher.modules.documentation.c2._c_anonymous_1(/publisher/modules/documentation/add.jag:6)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.publisher.modules.documentation.c2.call(/publisher/modules/documentation/add.jag)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.publisher.modules.documentation.c0._c_anonymous_1(/publisher/modules/documentation/module.jag:5)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.publisher.modules.documentation.c0.call(/publisher/modules/documentation/module.jag)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.site.blocks.documentation.ajax.c0._c_anonymous_1(//site/blocks/documentation/ajax/docs.jag:38)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.site.blocks.documentation.ajax.c0.call(//site/blocks/documentation/ajax/docs.jag)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.site.blocks.documentation.ajax.c0._c_script_0(//site/blocks/documentation/ajax/docs.jag:4)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.site.blocks.documentation.ajax.c0.call(//site/blocks/documentation/ajax/docs.jag)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.site.blocks.documentation.ajax.c0.call(//site/blocks/documentation/ajax/docs.jag)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.rhino.site.blocks.documentation.ajax.c0.exec(//site/blocks/documentation/ajax/docs.jag)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:541)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:378)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] - at
>> java.lang.Thread.run(Thread.java:662)
>>
>> INFO
>> [org.wso2.carbon.automation.extensions.servers.utils.ServerLogReader] -
>> [2015-09-16 11:24:34,200] ERROR - docs:jag
>> org.wso2.carbon.apimgt.api.APIManagementException: Error while creating an
>> attachment for Document- APIM622PublisherTestHowTo-File-summary-1.0.0.
>> Empty File Attachment.
>>
>> --
>> Thanks & Regards,
>> Bhagya
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Madusanka Premaratne* | Associate Software Engineer
> WSO2, Inc | lean. enterprise. middleware.
> #20, Palm Grove, Colombo 03, Sri Lanka
> Mobile: +94 71 835 70 73| Work: +94 112 145 345
> Email: madusan...@wso2.com | Web: www.wso2.com
>
> [image: Facebook] <https://www.facebook.com/maduzanka> [image: Twitter]
> <https://twitter.com/rmmpremaratne> [image: Google Plus]
> <https://plus.google.com/u/0/+MadusankaPremaratnemaduz/about/p/pub> [image:
> Linkedin] <http://lk.linkedin.com/in/madusanka/> [image: Instagram]
> <http://instagram.com/madusankapremaratne> [image: Skype]
> <http://@rmmpremaratne>
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to