Use API to get mail address for given username


(Robert) #1

Hello,

I want to hack a script that routes incoming mails @association.org from the server to the private mail accounts of the association members. I assume that all members have a forum account and want to reuse the already approved mail address from the forum db.

I checked the data that is returned from the forum API for a given username, but I cannot find the mail address. How do I get it?


Intense API use floods staff log?
(Régis Hanol) #2

Have you tried to PUT /users/<username>/emails.json?


(Robert) #3

I tried and I just get a html page saying content would not exist or is private. I used the api key generated for all users and the api_user system or the username of my admin account.


(Régis Hanol) #4

I edited my previous post. This route uses the PUT verb but shouldn’t :frowning: Will fix.


(Robert) #5

I was studying the file discourse/routes.rb at master · discourse/discourse · GitHub but did not realised that it was PUT. Now it works. :slight_smile:


(Régis Hanol) #6

There you go :ear_of_rice:


(Régis Hanol) #7

(Kane York) #8

The point of that being non-GET is that it causes a staff action log, so it shouldn’t be triggereable from an img or an idempotent request retry thing.