how does posting with APIs work?

comments

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.

Error 404?

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

Are you making a POST request or a GET request?

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))

POST, also the URL for that is /session

perfectly working now, thanks!

See more replies

+1, these are very useful