moegoapis

🏒 Company API Documentation (moego.business.company.v1)

πŸ“Œ 1. Functional Overview

The Company module provides APIs to manage business entities in the system. Each company represents a top-level organizational unit that can contain multiple business locations, staff members, and service offerings.

This interface enables:

Useful for scenarios such as company management, multi-location administration, and integration with third-party systems.


🎯 2. Design Goals

Applicable to scenarios like company onboarding, configuration management, and enterprise-level reporting.


🧩 3. Core Concepts

1. Company

Represents a business entity in the system.

Field Name Type Description
id string Unique identifier (e.g., "cmp_001"), obfuscated ID string
name string Legal name used in official communications and documents.
country string ISO 3166-1 alpha-2 country code indicating where the company is registered.
timezone TimeZone Primary timezone for company operations (used for scheduling and reporting).

Example JSON

{
  "id": "cmp_001",
  "name": "Moego Pet Care Inc.",
  "country": "US",
  "timezone": {
    "id": "America/New_York"
  }
}

πŸ“ˆ 4. Typical Usage Flow

βœ… Scenario: User Integrates and Debugs Company API

Here is a typical integration flow:

  1. Get Company
  1. List Companies
  1. Monitoring & Maintenance

πŸ› οΈ 5. API Interface Descriptions

1. Get Company (GetCompany)

βœ… Functionality:

Retrieves detailed information about a specific company.

🎯 Use Cases:

πŸ”§ Request Parameters:

Field Name Type Required Description
id string Yes Unique identifier of the company, obfuscated ID string

πŸ“Œ Return Value:

Field Name Type Description
company Company The retrieved company object

⚠️ Error Codes:

Error Code Description
NOT_FOUND Specified company ID does not exist
PERMISSION_DENIED Permission denied

2. List Companies (ListCompanies)

βœ… Functionality:

Lists companies based on specified criteria.

Results are paginated and can be used for system administration and multi-company management scenarios. Companies are returned in alphabetical order by name.

🎯 Use Cases:

πŸ”§ Request Parameters:

Field Name Type Required Description
pagination Pagination Yes Pagination info: pageSize, pageToken

⚠️ pageToken is optional. Leave empty for the first page. Obtain from previous response for subsequent pages.

πŸ“Œ Return Value:

Field Name Type Description
nextPageToken string Token for retrieving the next page
companies Array(Company) List of companies matching criteria

⚠️ Error Codes:

Error Code Description
INVALID_ARGUMENT Invalid pagination parameters
PERMISSION_DENIED Permission denied

πŸ§ͺ 6. Usage Examples

βœ… Example 1: Retrieve a Specific Company

Request

GET /v1/companies/cmp_001

Response

{
  "id": "cmp_001",
  "name": "Moego Pet Care Inc.",
  "country": "US",
  "timezone": {
    "id": "America/New_York"
  }
}

βœ… Example 2: List Companies with Pagination

Request

POST /v1/companies:list
Content-Type: application/json

{
  "pagination": {
    "pageSize": 20,
    "pageToken": "1"
  }
}

Response

{
  "nextPageToken": "CBAQAA==",
  "companies": [
    {
      "id": "cmp_001",
      "name": "Moego Pet Care Inc.",
      "country": "US",
      "timezone": {
        "id": "America/New_York"
      }
    },
    {
      "id": "cmp_002",
      "name": "PetCare Australia Pty Ltd",
      "country": "AU",
      "timezone": {
        "id": "Australia/Sydney"
      }
    }
  ]
}

⚠️ 7. Usage Limitations

TODO


πŸ“Ž 8. FAQ

Question Answer
How to verify if a company exists? Use GetCompany to check if the company ID returns a valid response.
Can I list all companies at once? No. Results are paginated. Use pageToken to fetch next set.
Why does listing companies return β€œpermission denied”? Ensure you have the correct access rights for this operation.
How to handle large result sets efficiently? Use pagination via pageSize and pageToken.

πŸ“Œ 9. Common Error Codes

Error Code Description
NOT_FOUND The requested company ID does not exist.
PERMISSION_DENIED Caller lacks access rights to perform operation.
INVALID_ARGUMENT Invalid request parameters provided.
INTERNAL Internal server error occurred.