API for document format conversion - web-services

I am looking for a RESTful web service to which I can send a document (doc, docx, xls, xlsx, ppt, pptx, and tiff at a minimum) for conversion to pdf and swf.
The reason I need swf in addition to pfd is so that I can display the document in the browser using a flash-based document viewer such as FlexPaper.
I basically want transloadit.com for documents.
One option is to use the Scribd API, download the pdf, and use swftools to convert the pdf to swf. However I am interested in alternatives.

doxument.com might be what you looking for. They do offer some kind of REST API. I'm not sure about the formats though.

I am developing on http://webservices.io which is in beta and offers document conversion via a REST API.
While it also doesn't do all the conversions you are asking for, it does have docx and xlsx support. See matrix with supported conversions

Aspose library is best of the best http://www.aspose.com/ Use it for create your own service

Although it's an old question, however just want to share another solution for future reference.
GroupDocs.Conversion Cloud REST API is another option to convert back and forth between over 65+ types of documents and images, including all Microsoft Office and OpenDocument file formats, PDF documents, HTML, CAD, raster images and much more.
cURL sample Code:
### Retrieve access token
### TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
curl --request POST https://api.groupdocs.cloud/connect/token
--header "Content-Type: application/x-www-form-urlencoded"
--data "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]"
### Convert and Add Watermark
curl --request POST "https://api.groupdocs.cloud/v2.0/conversion"
--header "authorization: Bearer [ACCESS_TOKEN]"
--header "accept: application/json"
--header "Content-Type: application/json" --data "{ "FilePath": "test_doc.docx", "Format": "pdf", "ConvertOptions": { "FromPage": 1, "PagesCount": 1, "WatermarkOptions": { "text": "Watermark" } }, "OutputPath": "Output"}"
I work with Aspose as developer evangelist.

Related

Getting "invalid_payload" and 400 response when trying to send data to a slack channel through Postman

I'm using postman to trigger a message using the slack channel's incoming webhook url. I tried the following curl and it works:
curl --location --request POST 'https://hooks.slack.com/services/T026NT2D4/B02UM3G1D35' \
--header 'Content-type: application/json' \
--data-raw '{"text":"Hello world"}'
I need to send aws S3's presigned URL to this channel but no matter how I try sending the data, I always get invalid_payload as the response. I tried sending it as Json message, Raw text and even tried x-www-form-urlencoded. Nothing seems to work.
I need some implementation example for this. Also, I'll be using spring boot to generate and send the message, so any resources on beautifying the message would be really helpful.
I've seen examples where the slack channel has some text and "more" option, which, upon clicking downloads a file(I'm assuming this "more" is a hyperlink of the presigned URL)
EDIT:
I was trying out a few more stuff. When I send the Json with only one field and specifically naming that filed "text", I'm able to send the message.
So my payload looked liked this:
{
"text": "*Presigned URL*"
}
The headers had Content-type as application/json.
Even if I changed "text" to "Message" I'm getting a 400 response. Is that what no_text means? that there is no "text" field in the payload
Just putting it here in case someone needs this.
That is the case, a "text" field should be there in the json message.
Link to slack guide
Found this implementation in case anyone wants to use slack SDK in spring boot : Implementation Link

How to upload files(png and txt files) using raw in POSTMAN?

The postman works in the below format to upload an attachment.
set method type to POST.
Then select Body -> form-data -> Enter your parameter name
and on right side next to value column, there will be dropdown "text, file", select File. choose your image file and post it:
I succeed with form-data, how do achieve via RAW text or Json because the image which is uploaded is dynamic.The image and txt file is stored in my local.
I am trying to upload png and .txt file to JIRA Rest endpoint(Subtask). My goal is create subtask, once subtask is created add attachment to it, attachment can be dynamic.
curl -X POST \
https://host/rest/api/3/issue/pos-14108/attachments \
-H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-H 'Postman-Token: c2b02ef1-4b81-4e8e-bb02-fb697bb2680e,1c20aa55-27c5-44c3-9f08-7efc41f25576' \
-H 'X-Atlassian-Token: no-check' \
-H 'cache-control: no-cache,no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F file=#/Users/nmane/Desktop/harry.png
According to this article on the Jira forums, to add an attachment, you should do the following:
curl -D- -u {username}:{password} -X POST -H "X-Atlassian-Token: nocheck" -F "file=#{path/to/file}" http://{base-url}/rest/api/2/issue/{issue-key}/attachments
according to Using curl to upload POST data with files
That fits with your comments and experiences, as far as I can tell.
I have not encountered anything about attaching files to a "raw" JSON request. The only way to do something like that would be to base 64 encode it (see Is it possible to attach file in POST Json? ) but I do not think that the Jira REST API supports it.
I hope that I have understood your issue correctly. if not, and you actually (for some reason) want to run everything from postman/newman, please update your question.

Using the Vimeo API, how do I replace all videos in a Vimeo album?

Using curl, I'm trying to create a working Vimeo API call that replaces the videos in a Vimeo album with a different set of videos. (The docs are here.) I am successfully deleting the existing videos from the album but my new video info seems to be invisible to Vimeo. Vimeo responds with a 201 ("created") instead of the 200 I'm looking for.
Here is my curl command (with subs for actual data):
curl -H "Authorization: bearer 123abc456def" -X PUT --data "videos=%2Fvideos%2F11111%2C%2Fvideos%2F22222%2C%2Fvideos%2F33333" "https://api.vimeo.com/me/albums/7777777/videos"
I don't know what I'm doing wrong and the Vimeo API docs & playground don't give me the answers I need. My questions and observations:
Should I be url encoding the new video URIs (e.g. 11111,22222, etc)? I have also tried without url encoding and it made no difference. But then the 201 might be telling me it didn't get as far as handling my replacement URIs.
a PUT is required for this operation. I have used PUT successfully to add a video to an existing album (in LiveCode, haven't tried it with curl)
I got the same results when I tried this PUT in LiveCode. I moved the request to curl because more people are familiar with curl.
This is my first rodeo using the Vimeo API. It's a great, vast resource and I've had no problems working with it until this. I'm just stuck on this item and really need it to work!
Thanks for any help you can offer.
This is an ancient, deprecated way of handling batch editing. I'm not sure how it still exists. We will move it to the proper batch creation standard in 3.4.
I think the existing system is supposed to be a comma separated list of video id's, so
curl -H "Authorization: bearer 123abc456def" -X PUT --data "videos=11111%2C22222%2C33333" "https://api.vimeo.com/me/albums/7777777/videos"
is likely the proper request.

converting curl api call into restful api call

i am very new to the java EE.
I have built some simple restful client for calling rest api's from java using jersey framework.
I have one curl request which i have to call from java
curl -i -X POST 'https://{url}' -H 'Content-Type: application/x-www-form-urlencoded' -H "Accept: application/vnd.newbay.dv-1.8+json" -H "X-HTTP-METHOD-OVERRIDE: DELETE" -H "X-Client-Platform: SERVICES" -H "X-Client-Identifier: IL" --insecure --data 'path=%2FMy+Samsung+GT-I9082%2F20130822_172409.jpg&path=%2FMy+Samsung+GT-I9082%2F20130905_085407.jpg'
Here the paths of file are passed as form post in curl using --data.
Can anyone tell me how to call this api from my java program using jersey framework? I am having difficulty because of this --data part? how exactly i will pass that in my restful java client that i cant understand.
Also can anyone tell me how to pass form post --data part while calling the same api from soapUI?
In your cURL command, --data provides post data in a classic html form format. You shoud alrealy be aware of that because the content-type is explicit : application/x-www-form-urlencoded
Jersey can handle this encoding for you, using MultivaluedMapImpl.
see Sending Name Value Pair in POST using Jersey Client

How do I use the --header option to send cookies with Siege?

I have just started to use Siege to do load/stressing test on a new web server. I am trying to test on my most resource/performance heavy script, but the script requires cookies. What is the proper format for using the --header option in siege?
I have tried this with no luck:
siege --header="Set-Cookie: PHPSESSID=--COOKIE--; iptoken=--COOKIE--" http://www.myurl.com/script.php,
There is no documentation on this that I could find, so any ideas/suggestions would be appreciated.
The answer is to use --header="Cookie: --COOKIE_DATA--" (ref. wiki.wsmoak.net/cgi-bin/wiki.pl?Siege).