Google Reader API HTTP Response parsing (Objective C) - objective-c

Using the API, trying to get items in a specific feed returns this:
{“direction”:”ltr”,”id”:”feed/http://arstechnica.com/index.rssx”,”title”:”Ars Technica”,”description”:”The Art of Technology”,”self”:[{"href":"http://www.google.com/reader/api/0/stream/contents/feed/http://arstechnica.com/index.rssx?ot\u003d1273193172856169\u0026r\u003dn\u0026xt\u003duser/-/state/com.google/read\u0026n\u003d4\u0026ck\u003d1273193873\u0026client\u003diPadReader"}],”alternate”:[{"href":"http://arstechnica.com/index.php","type":"text/html"}],”updated”:1273193873,”items”:[]}
They look like key/value pairs but it’s plain text with UTF8 String encoding and won’t encode into a dictionary. I’m using Objective-C and I’m not sure where to go from here. So far I’ve been able to parse the XML response for unread items, but parsing the plain-text doesn’t look feasible. What is your practice?

It looks like JSON markup. You'll want to use a JSON parser for Objective-C.

Related

REST API method that accepts multiple file uploads and additional arguments

I'm attempting to create a REST API method that accepts multiple file uploads with some additional arguments. This API method will be called from both web forms, web services or mobile apps.
Is there a standard I should be following with regards to how the method takes these parameters in?
So far, I've considered the following two approaches:
JSON body: file data to be included as base64 encoded fields within the JSON object. Fine if being called from other web services, but troublesome when calling from a HTML form?
multipart/form-data: easy to use with HTML forms, but problematic when calling from web services or mobile apps?
I know that either of the two approaches would work, but I'd like to implement this the correct way (if there is one) according to current standards. Any ideas?
Do modern JS libraries/frameworks make it easy to POST HTML forms to web APIs as JSON objects
Yes, we have a lot of library to convert the file into base64.
In my opinion, choose what is based on your requirement. Firstly, exchanging data in multipart format should be more efficient than base64 json string. But this article show, the term of the size is little.
But if we use json, you could pass multiple other variable in the json format and we could read it easily.
Besides, if your file is image, the browser understand data URIs (base64 encoded images), there is no need to transform these if the client is a browser.

How do I use Google's Vision API to convert a PDF (non-searchable) to a searchable PDF?

From what I've seen, Google's Vision API lets you perform OCR on a PDF, but it returns only the detected text in a JSON format. What I need is a searchable (OCR'd) PDF file in return. Is this possible?
Notice that the OutputConfig type doesn't have any metadata field to configure the resulting file's format. As you are already aware, the API returns a JSON response. You could either first get the JSON data with the API and explore the use of any of the following repositories for JSON to PDF conversion or directly use any specialized module such as OCRmyPDF that specifically serves this purpose on your source PDF and avoid the use of the API altogether.

Proper media-type for a Twitter tweet?

What is the proper media type to use for a status update (aka "Tweet") from the Twitter API?
For some background, I am writing an API that will accept an array of documents, each with a media type (e.g. image/jpeg, text/html, application/pdf, etc). I want Tweet JSON to be in the array of accepted types.
I was hoping for a vnd. type but didn't see one on the huge list I found. Am I approaching this correctly?
My best stab would be: application/vnd.twitter.status+json

Twitter API Strange Encoded Chars Returned

I'm building a little app that uses the twitter search api: http://search.twitter.com/search.json?q=funny
Now everything is working great, but sometimes it messes up my PHP script when the tweets contain chineze chars. Now on my site I use UTF-8 meta headers. Can someone tell me how to convert the following chars which were outputted by the Twitter API to a readable format?
EXAMPLE OUTPUT:
\u525B\u624D\u5728igfw.tk\u770B\u5230\u6709\u4E00\u500B\u535A\u5BA2\u63D0\u4F9B\u6BCF\u534A\u5C0F\u6642\u6539\u5BC6\u78BC\u7684ssh,\u62FF\u4F86\u7DF4\u7FD2\u4E00\u4E0Bbash\u8173\u672C\uFF0C\u65B7\u958B\u5F8C\u6703\u81EA\u52D5\u91CD\u65B0\u9023\u63A5\uFF0C\u4F7F\u7528Ctrl-C\u9000\u51FA,Cygwin\u4E0A\u7DE8\u5BEB\uFF0CLinux\u8A72\u6C92\u554F\u984C\uFF0CMAC\u81EA\u884C\u6E2C\
the \uXXXX are unicode codes for the characters
you could use a table of values pairing with the utf. or pack the string as json and use json_decode that already has that behavior.
you can see an example of how to do the conversion in the Service_json.json_decode() source, as one implementation that comes to my mind now
http://pear.php.net/package/Services_JSON/redirected

Getting text information from the Internet into my app

I learning Objective C, and I am going to develop some apps. I have a general question: How to get text information from the Internet into your app. Say you want the current title of Yahoo News. Do I need to use some PHP, or are there Objective-C specific classes to choose from?
Help is appreciated (code as well!), just anything that can help me take te step to exploring the new possibilities!
If I understand your question, I'd say the best way to do it would be to get the HTML source from the URL of your choosing as a string, then parse it to grab an attribute such as the title. Have a look at NSString and NSXMLDocument; they both let you instantiate them from a URL.
Here's a great way to do it:
Go to Yahoo Pipes, and create your "pipe" (basically a feed of one or many different data inputs on the web).
Publish: Select a format for Yahoo to host, for example as an RSS feed or in JSON.
UIWebView can then point to your pipe's URL. (Here's a tutorial on UIWebView)
Done.
Note that you can choose to get the feed as RSS, JSON, and other formats as well. Here is an example of a pipe I set up for the National Vulnerabilities Database as RSS, and the same feed as JSON.
ASIHttpRequest Will keep you sane.