2
0

patrick.net api


 invite response                
2022 Dec 9, 4:36pm   7,696 views  6 comments

by Patrick   ➕follow (61)   💰tip   ignore  

I've created a basic patrick.net api.

First, you must create an account via the browser and email loop. There is no api for that. If you already have an account, you're all set there.

Then, you get your user id, hashed password, and key like this:


curl -X POST https://patrick.net/post_login \
--data-urlencode email='me@email.com ' \
--data-urlencode password='supersecret' \
--header "Accept: application/json"


The response will be like this:

{
"patricknetuser": 135861,
"patricknetpass": "f517f69dc60fd1f25a24e31e791fca34",
"key": "ce019db42c81608fd4fb093c781ecccd"
}


Then most of the functions on the site will return json instead of html if you hit them with an "Accept: application/json" header like this:


curl 'https://patrick.net/accept_comment?key=ce019db42c81608fd4fb093c781ecccd' \
-H 'Accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Cookie: patricknetuser=135861; patricknetpass=f517f69dc60fd1f25a24e31e791fca34' \
--data-raw 'comment_content=testing+the+api&comment_post_id=1345899'


Please let me know if you might use this api and I'll document it better and fill in more of the routes. I have api-ified most of the routes, the most notable exception being image upload, which does not work via the api yet.

If you're familiar with the browser dev tools, you can look at the network requests and just add 'Accept: application/json' and most of them should work as an api.

Please regard the api so far as UNSTABLE and don't build anything too important on it. Any part could change at any time.

Comments 1 - 6 of 6        Search these comments

1   Hircus   2022 Dec 10, 6:19pm  

The login call seems to work and I get back the expected json.

If I call the homepage, I get back json.
curl 'https://patrick.net/?key='$pkey \
-H 'Accept: application/json' \
-H "Cookie: patricknetuser=$puser; patricknetpass=$ppass"


But if I try to get my own comments, I get back html.
curl 'https://patrick.net/comments?a=Hircus&start=2720&key='$pkey \
-H 'Accept: application/json' \
-H "Cookie: patricknetuser=$puser; patricknetpass=$ppass"


Is this url apiified? I tried borking the credentials on purpose via nulling the patricknetuser, and got back json "please log in" message.
2   Patrick   2022 Dec 10, 7:06pm  

@Hircus You are right, I missed that one.

Should be fixed now. Please try again.
3   Hircus   2022 Dec 10, 7:21pm  

Works :)
4   Hircus   2022 Dec 14, 11:13am  

Same problem for threads - I get back html

curl -i 'https://patrick.net/user/Hircus?page=1&order=new&key='$pkey \
-H 'Accept: application/json' \
-H "Cookie: patricknetuser=$puser; patricknetpass=$ppass"
5   Patrick   2022 Dec 14, 11:48am  

You're right. OK, fixed now. Let me know if not.
6   Hircus   2022 Dec 14, 11:52am  

That fixed it

Please register to comment:

api   best comments   contact   latest images   memes   one year ago   random   suggestions   gaiste