momijizukamori: Green icon with white text - 'I do believe in phosphorylation! I do!' with a string of DNA basepairs on the bottom (Default)
[personal profile] momijizukamori
Hello friends! It's been a while since the last API update, but I finally got some bugs fixed, and am now at the point of needing testers to help me find the rest of them so we can get this thing going! If you are interested in helping, you don't need any real coding experience, but you do have to be okay at reading docs.

Instructions:
1) Go to http://www.momiji.hack.dreamwidth.net/create and create an account

2) Go to http://www.momiji.hack.dreamwidth.net/api/

3) Paste the bolded token into the box in the authenication section

4) Click on paths to expand them and use the fields to try the requests out.

5) Report errors or unexpected behavior here!

Note 1: Tropospherical layout CSS is not loading properly for reasons unrelated to the API code that I haven't sorted out yet. Other themes work, and site functionality is fine, just kind of ugly

Note 2: The API demo stuff doesn't match the rest of the styling, and will probably only work on relatively recent browsers (the last year or so). This isn't the final form, I'm just using a third-party package so I can get all the backend stuff working before spending time on making the page pretty and matching to out site styles

Note 3: I'm going to try to get the content-importer going for people who want to import some test data, but the workers are fussy to run in development

Stuff what needs fixing
- /journals/{username}/entries claims to return information about the new entry when you post to it, but currently just returns success or failure
- Editing an entry successfully returns no useful information
- Requesting a non-existent entryid on a journal returns confusing error
- Posting entries currently missing music and location attributes
- Posting entries currently missing mood and preformatted attributes

API things

May. 11th, 2019 10:55 am
momijizukamori: Grey tabby cat with paws on keyboard and mouse. The text reads 'code cat is on the job', lolcats-style (CODE CAT)
[personal profile] momijizukamori
I kept meaning to write this up but [personal profile] kaberett's volunteer weekend was a good extra nudge, heh.

Expandwhat is live )

Expandwhat is in progress )

Expandwhat really needs to be done )
ari_linn: (warrior - normal)
[personal profile] ari_linn

Can anyone tell me/point me to the source code where thread ids in comment links are generated? Especially if all I have is data from export_comments.bml page? For example, when I visit https://www.dreamwidth.org/export_comments.bml?get=comment_body&startid=1 , I can see the following comment:

<comment id="123" jitemid="234" posterid="345" parentid="456">
    <body>My Comment</body>
    <date>2018-06-08T00:58:54Z</date>
</comment>

But if I go to the actual post page, this comment will be displayed with a link to it. The link looks like this: https://ari-linn.dreamwidth.org/%POSTID%.html?thread=%SOMERANDOMNUMBER%#cmt%SOMERANDOMNUMBER%. Where does %SOMERANDOMNUMBER% come from?

ari_linn: (warrior - normal)
[personal profile] ari_linn
I have about 100 files that I want to upload to Dreamwidth. I want to do it with a script, if it's possible. I checked what happens in my browser when I'm logged in and uploading a file at https://www.dreamwidth.org/file/new , and it was pretty much the following request:

POST https://www.dreamwidth.org/api/v1/file/new 
Content-Type: multipart/form-data
Cookies: ljuniq=THISTOKENCHANGESWITHEVERYREQUEST;
BMLschemepref=celerity-local;
__utma=SOMETOKEN;ljmastersession=YETANOTHERTOKEN;
ljloggedin=FINALTOKEN

FILE BODY
My problem now is: how do I get the whole cookies/authorization stuff, or at least THISTOKENCHANGESWITHEVERYREQUEST token (other stuff seems to be reused? can I hijack my current session and simply use cookies from it in my script?) Is there any way to do it programmatically?
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)
[personal profile] sophie
Next week's code push will see the removal of the /misc/interestdata script and the addition of its replacement, a journal-side /data/interests API that outputs in JSON format. (note: This is not part of the XML-RPC API.)

Currently, interest data can be obtained using an URL like http://www.dreamwidth.org/misc/interestdata?user=sophie , which uses a custom format that has to be parsed specially. For example, here are my first five interests in this custom format:

# Note: Polite data miners cache on their end.  Impolite ones get banned.
# <intid> <intcount> <interest ...>
10847 2 #!/usr/bin/perl
867 294 80's music
741 284 80s music
296200 5 a11y
273 118 acceptance
After the code push, this interest data will be obtainable from http://sophie.dreamwidth.org/data/interests instead (obviously, the username will be different depending on who you want the interest data for), and will be in JSON format. The five interests above will be represented by the equivalent of the following JSON (note that the interests will be in no particular order, which I am simulating by putting the interests in a random order):

{
    "interests": {
        "296200": {
            "count": 5,
            "interest": "a11y"
        },
        "867": {
            "count": 294,
            "interest": "80's music"
        },
        "273": {
            "count": 118,
            "interest": "acceptance"
        }
        "10847": {
            "count": 2,
            "interest": "#!/usr/bin/perl"
        },
        "741": {
            "count": 284,
            "interest": "80s music"
        }
    },
    "name": "sophie",
    "account_type": "P",
    "account_id": "324"
}
The actual JSON will not be beautified, and you can see an example of actual parseable output on my Dreamhack at http://sophie.sophie.hack.dreamwidth.net/data/interests . (Note that my Dreamhack is very empty and all of the interest counts are therefore 1. If you'd like an account on my Dreamhack to test this new API before it goes live, let me know and I'll give you an invite code. If you already have a Dreamhack, you can also pull the newest code and test it yourself.)

Notice that the new JSON also includes basic user metadata - the username, account type and account ID. This should save people the bother of having to obtain this information from elsewhere.

The former /misc/interestdata script had an additional mode of operation where you could give it a single interest name and it would return the count of that interest. For now, this functionality will no longer exist after the next code push. (It was only of very limited use and as far as I know was never widely used.) If this is an issue for you, let me know; I'm thinking of ways to expand on that functionality, and while I can make no promises, I have Ideas.

If you have any questions or comments about this, please feel free to ask in the comments!

Profile

dw_dev: The word "develop" using the Swirly D logo.  (Default)
Dreamwidth Open Source Development

June 2025

S M T W T F S
1234567
89101112 1314
15161718192021
22232425262728
2930     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

Expand All Cut TagsCollapse All Cut Tags
Page generated Jul. 5th, 2025 05:14 am
Powered by Dreamwidth Studios