Retrieving Company Information
Edit on GitHubSpryker 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.
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 GLUE: 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:
Request sample: GET http://glue.mysprykershop.com/companies/mine
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.
Sample Response
{
"data": [
{
"type": "companies",
"id": "88efe8fb-98bd-5423-a041-a8f866c0f913",
"attributes": {
"isActive": true,
"name": "BoB-Hotel Mitte",
"status": "approved"
},
"links": {
"self": "http://glue.mysprykershop.com/companies/88efe8fb-98bd-5423-a041-a8f866c0f913"
}
}
],
"links": {
"self": "http://glue.mysprykershop.com/companies/mine"
}
}
Information on a Specific Company
To retrieve information on a specific company, send a GET request to the following endpoint:
Request sample: 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.
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.
Sample Response
{
"data": {
"type": "companies",
"id": "59b6c025-cc00-54ca-b101-191391adf2af",
"attributes": {
"isActive": true,
"name": "BoB-Hotel Jim",
"status": "approved"
},
"links": {
"self": "http://glue.mysprykershop.com/companies/59b6c025-cc00-54ca-b101-191391adf2af"
}
}
}
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. |
Thank you!
For submitting the form