User Management
Create Additional User
Create a User for an Organization
Add a new user to an existing organization.
Endpoint: POST /api/oem-api/user
{
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"grantType": "client_credentials",
"scope": "vendor_manage",
"data": {
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"vendorUserId": "5678",
"vendorOrganizationId": "1234"
}
}Response (201 Created):
{
"status": 201,
"message": "Successfully created a user for the organization",
"organizationOemToken": "your-organization-oem-token"
}
Note: If organizations are created withoutvendorOrganizationId, users will be added to organizations based on email domain matching. Otherwise, they'll be added to organizations with matchingvendorOrganizationId.
Remove User
Removes a User from an Organization
Remove an existing user from an organization.
Endpoint: DELETE /api/oem-api/user
{
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"grantType": "client_credentials",
"scope": "vendor_manage",
"organizationOemToken": "your-organization-oem-token"
}Response (201 Success):
{
"status": 201,
"message": "Success: User Deleted"
}Possible Errors:
400 Bad Request- Malformed request body401 Unauthorized- Invalid client ID or client secret403 Unauthorized- Invalid organization token404 Not Found- User not found
Error Handling
All endpoints use standard HTTP status codes. Common error responses include:
| Status Code | Description |
|---|---|
400 | Bad Request - Malformed request body |
401 | Unauthorized - Invalid client credentials |
403 | Forbidden - Invalid organization token |
404 | Not Found - Resource not found |
409 | Conflict - Resource already exists |
Quick Start Example
Here's a complete example of creating an organization and setting up authentication:
// 1. Create organization
const createOrgResponse = await fetch('/api/oem-api/organization', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
grantType: 'client_credentials',
scope: 'vendor_manage',
data: {
name: 'Example Corp',
email: '[email protected]',
firstName: 'John',
lastName: 'Doe',
vendorOrganizationId: '12345'
}
})
});
const orgData = await createOrgResponse.json();
const orgToken = orgData.organizationOemToken;
// 2. Create authentication session
const sessionResponse = await fetch('/api/oem-api/organization/session', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
grantType: 'client_credentials',
scope: 'vendor_manage',
organizationOemToken: orgToken
})
});
const sessionData = await sessionResponse.json();
// 3. Redirect user to application
window.open(sessionData.redirectUrl, '_blank');Updated 9 months ago
