Palbase Machines · API
/machines/{name}/test-usersMake test users with a template's data
Makes 1 to 10 test users (auth's: their tokens say test: true) and has the machine's own program write a template's data for each — the backend's seed for one account (palbase/backend's @TestUserTemplate), for a person or an agent to sign in and see a screen with its data. The platform calls the program for each user — POST /_palbase/test-user-templates/<template> on the machine's own port, with {"user": {"id", "email"}, "template"}, signed as a cron's call is, waking the machine for it; the program writes the template in one transaction and answers {"rows": {table: count}}, or refuses a user auth does not say is a test user (403). A user is made with its template or not at all: one whose template was not written is deleted again (deleted: true, no sign-in), its template answering its error by name — one the program may have written for all the same (it did not answer in time, its connection ended once made, or it answered what a template does not) has the template's undo asked first. One whose undo did not run, or that auth would not delete, is kept for now, its error saying so: the platform asks the undo again and deletes it within the hour. The work for the users made goes on to its end when the request is gone. Each template says the build whose program answered (build, commit). None is made while the machine's newest build is on its way — a build of its head asked for, queued, building, testing, or rolling out while the version before serves: 409 build_in_progress, naming the build, its commit and where it is; ask again once it serves. The same user and template asked again (POST …/test-users/{user}/templates/{template}) answers what was kept, the machine not asked again. The users' passwords (and with with_tokens their access tokens) are test fixtures, shown this once, as auth's test users' are. 409 test_users_refused when auth makes no more test users for the project; 429 quota_exceeded, and no user made, when the project's machines are not run now (its machine time for the period used up, or the project deleted).
Called by your server, with the project's secret key.
Path
namestring · requiredThe machine's name: lowercase letters, digits and dashes, starting with a letter and not ending with a dash, 32 at most.Request body
countinteger · optionaltemplatestring · requiredwith_tokensboolean · optionalcurl -X POST "https://<your-ref>.palbase.studio/machines/<name>/test-users" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"template":"string"}'Responses
201The users, each with its template
400Validation failed or a required field is missing
401Missing or invalid API key
403Not the project's secret key
404The project has no machine of this name
409build_in_progress: the machine's newest build is on its way and no test user was made, nor a template written — build names it (its id, commit and state; requested while a build of the head is asked for), retry_after when to ask again; or test_users_refused: auth makes no more test users for the project
429Over the project's request limit, or its machine time for this period is used up
503Temporarily unavailable; retrying is safe after Retry-After
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation MakeTemplatedTestUsers of machines's contract.