Search code examples
androidxmlsynchronizationpastebin

Syncing a PasteBin paste


I am making an Android app one of whose features is to sync PasteBin pastes for a logged-in user. Going over the API, they have an option to list the pastes created by a user. The response will be as follows:

<paste>
    <paste_key>0b42rwhf</paste_key>
    <paste_date>1297953260</paste_date>
    <paste_title>javascript test</paste_title>
    <paste_size>15</paste_size>
    <paste_expire_date>1297956860</paste_expire_date>
    <paste_private>0</paste_private>
    <paste_format_long>JavaScript</paste_format_long>
    <paste_format_short>javascript</paste_format_short>
    <paste_url>http://pastebin.com/0b42rwhf</paste_url>
    <paste_hits>15</paste_hits>
</paste>  

Now, the paste should be downloaded and stored onto the local device is in two cases:
1. The paste does not exist on the local device
2. The paste exists but has been modified

So, what does the <paste_date> show? Does it show when the paste was last modified?
Last modified date will be the same as creation date if the paste was never modified


Solution

  • No, it shows when the paste has been created.

    There is no official way to check if the paste has been changed but you could always execute an HTTP request to the paste page and get that value by analyzing the html response but it will became a nightmare

    (well, I was creating an alternative pastebin api by analyzing their html code, but I used XPath which is not the perfect tool for the job I suppose)