pico — 12/10/2023, 9:40:03 PM

how does posting with APIs work?

♥ 4 ↩ 0 💬 9 comments

comments

oren:

Send a request to https://api.wasteof.money/posts with these parameters:

method: POST

headers: Authorization: "<token>"

body: {"post": "<p>content here</p>", repost: "repost id (can be null if you dont want to repost)"}

requirements: if your post contains any HTML elements, their tag must match one within the list of allowed tags below:

- p

- b

- strong

- i

- em

- u

- s

- li

- ul

- ol

- mark

- code

- blockquote

- pre

- img

any element that doesn't have a tag that matches one of these will simply be removed from the post.

any images in a post must have it's source come from one of the domains in the whitelist below:

- wiki.wasteof.money

- api.wasteof.money

- u.cubeupload.com

- i.ibb.co

if you want to repost a post, you can add in the "repost" key with it's value being a post's id into your request's body. bug: having a mention be outside of a paragraph (p) element will NOT mention the user.

12/11/2023, 1:17:56 AM
pico:

Error 404?

Response Body: {"error": "endpoint not found"}

12/11/2023, 8:20:05 AM
oren:

Are you making a POST request or a GET request?

12/11/2023, 2:16:12 PM
pico:

I first want to get my auth token, how do I get that? POST or GET?

Python code:

import requests

import json

url = "https://api.wasteof.money/login"

body = {"username": "dea", "password": "ThisIsMyWorld"}

response = requests.post(url, json=body)

# Beautify the output result

print("Status Code:", response.status_code)

print("Headers:")

print(json.dumps(dict(response.headers), indent=2))

print("Response Body:")

print(json.dumps(response.json(), indent=2))

12/12/2023, 10:11:32 AM
oren:

POST, also the URL for that is /session

12/12/2023, 2:54:15 PM
pico:

perfectly working now, thanks!

12/13/2023, 7:24:25 AM
oren:

no problem!

12/13/2023, 3:01:44 PM
radi8:

https://github.com/wulliy/wasteof-docs/

12/10/2023, 10:01:42 PM
lily:

+1, these are very useful

12/10/2023, 10:17:44 PM