Curl reports user created, but it didn't really work

I’ve been working on a process to import users, and am getting close. I’m getting a response from curl saying it sent an invite, but no email was sent and as far as I can tell no invite was logged in the database.

Here’s the curl command:

curl -X POST -H “Content-Type: multipart/form-data;” -H “api-key=secret” -H “api-username=system” -F “username=1002-nolan” -F “email=mnolan@tssi.com” -F “password=secret” -F “name=Mike Nolan” -F “staged=true” -F “active=true” -F “approved=true” “https://mysite/users.json/

Here’s the response:

“success”:true,“active”:false,“message”:“\u003cp\u003eYou’re almost done! We sent an activation mail to \u003cb\u003emnolan@tssi.com\u003c/b\u003e. Please follow the instructions in the mail to activate your account.\u003c/p\u003e\u003cp\u003eIf it doesn’t arrive, check your spam folder.\u003c/p\u003e”}

Also, I thought setting active=true would avoid sending a confirmation email.

I don’t think you want staged=true. That’s what I’d try next.

At some point, you had to create the user in one step and activate in another.

You might take a step back and say more about what you’re trying to do. Do you want to import a bunch of users once (so an import script would be better) or do this continually (so DiscourseConnnect might be better).

1 Like

Problem solved, I had to make sure the headers were properly formatted with a colon rather than an equals sign.

I tried looking at the mbox import script, but it seems to be missing a bunch of stuff, as noted in this post:

Anyway, I wanted to play with creating the user IDs (mailman doesn’t use them) because what I’m doing is importing 20 years worth of archives and a lot of those users are no longer around or using different email addresses. I’ve got around 700 users from the old system in the database now, adding 100,000 posts might present some other issues.

I dropped the staged=true field, it didn’t appear to be working anyway.

It took me an evening to write some PHP tools that parsed all those Mailman pipermail archives and built a set of user IDs, which wasn’t too bad.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.