Retrieving Company Information

Spryker provides the Company Account feature that allows purchasing goods and performing other actions on behalf of a user's company. The endpoints provided by the Company API allow retrieving information on companies.

Authentication
The endpoints provided by this API cannot be accessed anonymously. To access them, you need to impersonate users as Company Accounts and pass the authentication tokens received. For details on how to authenticate and retrieve such a token, see Logging In as Company User.

In your development, the API can help you to provide information on the company that the authenticated user belongs to.

Installation

For detailed information on the modules that provide the API functionality and related installation instructions, see Company Account Feature Integration.

Retrieving Company Information

Information on the User's Company

To retrieve information on the company a user belongs to, send a GET request to the following endpoint:

/companies/mine

Sample request: GET http://glue.mysprykershop.com/companies/mine

You can use the Accept-Language header to specify the locale.
Sample header: [{"key":"Accept-Language","value":"de, en;q=0.9"}]
where de, en are the locales; q=0.9 is the user's preference for a specific locale. For details, see 14.4 Accept-Language.

Response

The endpoint responds with a collection of RestCompanyResponse consisting of a single item that represents the user's company.

Response Attributes:

Attribute* Type Description
name String Specifies the name of the Company.

isActive

Boolean Indicates whether the Company is active.
status String Specifies the status of the Company. Possible values: Pending, Approved, or Denied.

*The attributes mentioned are all attributes in the response. Type and ID are not mentioned.

Information on a Specific Company

To retrieve information on a specific company, send a GET request to the following endpoint:

/companies/{{company_id}}

Sample request: GET http://glue.mysprykershop.com/companies/59b6c025-cc00-54ca-b101-191391adf2af

where 59b6c025-cc00-54ca-b101-191391adf2af is the ID of the company you need.

The endpoint provides information only on the companies a user has access to. If an attempt is made to access a company that a user doesn't have access to, the endpoint will respond with a 404 Not Found error code.

You can use the Accept-Language header to specify the locale.
Sample header: [{"key":"Accept-Language","value":"de, en;q=0.9"}]
where de, en are the locales; q=0.9 is the user's preference for a specific locale. For details, see 14.4 Accept-Language.

Response

The endpoint responds with a RestCompanyResponse containing information on the requested company.

Response Attributes:

Attribute* Type Description
name String Specifies the name of the Company.

isActive

Boolean Indicates whether the Company is active.
status String Specifies the status of the Company. Possible values: Pending, Approved, or Denied.

*The attributes mentioned are all attributes in the response. Type and ID are not mentioned.

Possible Errors

Code Reason
401 The access token is invalid.
403

The access token is missing.
- OR -
The current Company Account is not set.

This can occur if you didn't properly impersonate the user as a Company User Account. For details on how to do so, see Logging In as Company User.

404

The specified company was not found, or the user does not have access to it.

See also:

 

Last review date: July 17, 2019