Companies
Get All Companies
curl "http://example.com/api/v1/companies?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"companies":[
{
"id": 2,
"name": "Company"
}
]
}
This endpoint retrieves all associated companies.
HTTP Request
GET http://example.com/api/v1/companies
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Company
curl "http://example.com/api/v1/companies/2?token=API_TOKEN"
The above command returns JSON structured like this:
{
"company": {
"id": 2,
"name": "Company",
"no_notifications": null,
"supplier_limit": null,
"dummy": false,
"passive": false,
"terms_accepted_at": null,
"terms_accepted_by_user_id": null,
"terms_not_required": null,
"old_id": null,
"company_logo_file_name": null,
"company_logo_content_type": null,
"company_logo_file_size": null,
"company_logo_updated_at": null,
"created_at": "2016-07-08T00:37:30.911Z",
"updated_at": "2017-03-20T11:05:53.244Z",
"website": null,
"street": null,
"city": null,
"zip_code": null,
"phone": null,
"old_location_id": null,
"old_location_default": null,
"company_id": null,
"legal_type_id": null,
"country_code": null,
"nace_code": null,
"registered_office_address": { },
"disable_emails": false,
"corrective_task_categories": [ ],
"vat_id": null,
"global_location_number": null,
"commercial_register": null,
"tsv_name": null
}
}
This endpoint retrieves a company.
HTTP Request
GET http://example.com/api/v1/companies/5
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Corrective Tasks
Get All Corrective Tasks
curl "http://example.com/api/v1/corrective_tasks?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"corrective_tasks":[
{
"sender_company":{
"id": 2,
"name": "Company"
},
"receiver_company":{
"id": 1,
"name": "Receiver Company"
},
"document_type":{
"id": 1,
"name": "Environment policy document"
},
"description": "Description",
"corrective_task_template": { },
"corrective_subscribers": [ ],
"delivery_date": null,
"category": "Category",
"optional_fields": [ ],
"aasm_state": "draft",
"previous_state": null,
"created_at": "2017-04-10T13:24:19.627Z",
"updated_at": "2017-04-10T13:24:19.627Z",
"task_files": [ ]
}
]
}
This endpoint retrieves all corrective tasks.
HTTP Request
GET http://example.com/api/v1/corrective_tasks
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Corrective Task
curl "http://example.com/api/v1/corrective_tasks/1?token=API_TOKEN"
The above command returns JSON structured like this:
{
"corrective_task": {
"sender_company":{
"id": 2,
"name": "Company"
},
"receiver_company":{
"id": 1,
"name": "Receiver Company"
},
"document_type":{
"id": 1,
"name": "Environment policy document"
},
"description": "Description",
"corrective_task_template": { },
"corrective_subscribers": [ ],
"delivery_date": null,
"category": "Category",
"optional_fields": [ ],
"aasm_state": "draft",
"previous_state": null,
"created_at": "2017-04-10T13:24:19.627Z",
"updated_at": "2017-04-10T13:24:19.627Z",
"task_files": [ ]
}
}
This endpoint retrieves a corrective task.
HTTP Request
GET http://example.com/api/v1/corrective_tasks/1
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Document Tasks
Get All Document Tasks
curl "http://example.com/api/v1/document_tasks?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"document_tasks":[
{
"sender_company":{
"id": 2,
"name": "Company"
},
"receiver_company":{
"id": 1,
"name": "Receiver Company"
},
"document_type":{
"id": 1,
"name": "Environment policy document"
},
"aasm_state": "pending",
"task_file": { },
"previous_state": null,
"created_at": "2017-04-10T13:24:19.627Z",
"updated_at": "2017-04-10T13:24:19.627Z"
}
]
}
This endpoint retrieves all document tasks.
HTTP Request
GET http://example.com/api/v1/document_tasks
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Document Task
curl "http://example.com/api/v1/document_tasks/1?token=API_TOKEN"
The above command returns JSON structured like this:
{
"document_task": {
"sender_company":{
"id": 2,
"name": "Company"
},
"receiver_company":{
"id": 1,
"name": "Receiver Company"
},
"document_type":{
"id": 1,
"name": "Environment policy document"
},
"aasm_state": "pending",
"task_file": { },
"previous_state": null,
"created_at": "2017-04-10T13:24:19.627Z",
"updated_at": "2017-04-10T13:24:19.627Z"
}
}
This endpoint retrieves a document task.
HTTP Request
GET http://example.com/api/v1/document_tasks/1
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Document Types
Get All Document Types
curl "http://example.com/api/v1/document_types?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"document_types": [
{
"id": 761,
"name": " Accreditation certificate"
},
{
"id": 810,
"name": " Conformity Supplier"
}
]
}
This endpoint retrieves all document types.
HTTP Request
GET http://example.com/api/v1/document_types
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Groups
Get All Groups
curl "http://example.com/api/v1/groups?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"groups": [
{
"id": 340,
"name": "Group",
"created_by_user_id": 1,
"user": "User"
"created_at": "2016-11-30T10:14:41.185Z",
},
{
"id": 5,
"name": "My Suppliers",
"created_at": "2016-07-08T00:37:30.565Z",
"created_by_user_id": null,
"user": null
}
]
}
This endpoint retrieves all groups.
HTTP Request
GET http://example.com/api/v1/groups
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Group
curl "http://example.com/api/v1/groups/340?token=API_TOKEN"
The above command returns JSON structured like this:
{
"group": {
"id": 5,
"name": "My Suppliers",
"created_at": "2016-07-08T00:37:30.565Z",
"created_by_user_id": null,
"user": null,
"group_items": [
{
"company_id": 2,
"company_name": "Company",
"status": "ACTIVE",
"created_by_user": "User",
"approval_quality_status": 1,
"approval_quality_status_until": null,
"approval_purchasing_status": 0,
"approval_purchasing_status_until": null,
"created_at": "2016-07-13T14:58:33.738Z"
}
]
}
}
This endpoint retrieves a group.
HTTP Request
GET http://example.com/api/v1/groups/5
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Product Document Types
Get All Product Document Types
curl "http://example.com/api/v1/product_document_types?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"document_types": [
{
"id": 670,
"name": "Article specification"
},
{
"id": ,
"name": "Declaration for Packaging Marks"
}
]
}
This endpoint retrieves all document types.
HTTP Request
GET http://example.com/api/v1/product_document_types
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Product Groups
Get All Product Groups
curl "http://example.com/api/v1/product_groups?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"product_groups": [
{
"id": 33,
"name": "material"
},
{
"id": 34,
"name": "packaging"
},
{
"id": 37,
"name": "equipment"
}
]
}
This endpoint retrieves all product groups.
HTTP Request
GET http://example.com/api/v1/product_groups
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Product Group
curl "http://example.com/api/v1/product_groups/37?token=API_TOKEN"
The above command returns JSON structured like this:
{
"product_group":{
"id":37,
"name":"equipment",
"products":[
{
"id":10718,
"name":"Baumwollhandschuhe Gr. 10",
"code":"II3041"
},
{
"id":10719,
"name":"Baumwollhandschuhe Gr. 8",
"code":"II3039"
}
]
}
}
This endpoint retrieves a product group.
HTTP Request
GET http://example.com/api/v1/product_groups/37
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Create Product Group
curl --header "Content-Type: application/json"
--data '{"product_group": { "name": "Product Group" }}'
"http://example.com/api/v1/product_groups?token=API_TOKEN"
The above command returns JSON structured like this:
{
"id": 40,
"company_id": 1,
"name": "Product Group",
"created_at": "2017-04-20T17:36:02.109Z",
"updated_at": "2017-04-20T17:36:02.109Z",
"old_id": null
}
This endpoint creates a product group.
HTTP Request
POST http://example.com/api/v1/product_groups
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
name | nil | The product group’s name |
Update Product Group
curl --request PATCH
--header "Content-Type: application/json"
--data '{"product_group": { "name": "Group" }}'
"http://example.com/api/v1/product_groups/40?token=API_TOKEN"
The above command returns JSON structured like this:
{
"id": 40,
"company_id": 1,
"name": "Group",
"created_at": "2017-04-20T17:36:02.109Z",
"updated_at": "2017-04-20T17:58:29.488Z",
"old_id": null
}
This endpoint updates a product group.
HTTP Request
PATCH http://example.com/api/v1/product_groups/40
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
name | nil | The product group’s updated name |
Delete Product Group
curl --request DELETE
"http://example.com/api/v1/product_groups/40?token=API_TOKEN"
The above command returns HTTP Status 204 No Content
This endpoint deletes a product group.
HTTP Request
DELETE http://example.com/api/v1/product_groups/40
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Product Tasks
Get All Product Tasks
curl "http://example.com/api/v1/product_tasks?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"product_tasks":[
{
"sender_company":{
"id": 2,
"name": "Company"
},
"receiver_company":{
"id": 1,
"name": "Receiver Company"
},
"product_type":{
"id": 1,
"name": "Environment policy document"
},
"aasm_state": "pending",
"task_file": { },
"previous_state": null,
"created_at": "2017-04-10T13:24:19.627Z",
"updated_at": "2017-04-10T13:24:19.627Z"
}
]
}
This endpoint retrieves all product tasks.
HTTP Request
GET http://example.com/api/v1/product_tasks
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Product Task
curl "http://example.com/api/v1/product_tasks/1?token=API_TOKEN"
The above command returns JSON structured like this:
{
"product_task": {
"sender_company":{
"id": 2,
"name": "Company"
},
"receiver_company":{
"id": 1,
"name": "Receiver Company"
},
"document_type":{
"id": 1,
"name": "Environment policy document"
},
"aasm_state": "pending",
"task_file": { },
"previous_state": null,
"created_at": "2017-04-10T13:24:19.627Z",
"updated_at": "2017-04-10T13:24:19.627Z"
}
}
This endpoint retrieves a product task.
HTTP Request
GET http://example.com/api/v1/product_tasks/1
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Products
Get All Products
curl "http://example.com/api/v1/products?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"products": [
{
"id": 10605,
"name": "25LTR SQUARE ROUND BLUE",
"created_at": "2017-02-23T12:13:00.959Z"
},
{
"id": 10606,
"name": "26 LTR BUCKET BLUE",
"created_at": "2017-02-23T12:13:01.017Z"
}
]
}
This endpoint retrieves all associated products.
HTTP Request
GET http://example.com/api/v1/products
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific Product
curl "http://example.com/api/v1/products/10605?token=API_TOKEN"
The above command returns JSON structured like this:
{
"product": {
"id": 10605,
"company_id": 1,
"name": "25LTR SQUARE ROUND BLUE",
"code": "XP091",
"created_at": "2017-02-23T12:13:00.959Z",
"updated_at": "2017-02-23T12:13:00.959Z",
"archive": false,
"old_id": null
}
}
This endpoint retrieves a product.
HTTP Request
GET http://example.com/api/v1/products/10605
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Create Product
curl --header "Content-Type: application/json"
--data '{"product": { "name": "Small Bucket", "code": "SMB" }}'
"http://example.com/api/v1/products?token=API_TOKEN"
The above command returns JSON structured like this:
{
"id": 12705,
"company_id": 1,
"name": "Small Bucket",
"code": "SMB",
"created_at": "2017-05-25T00:07:30.343Z",
"updated_at": "2017-05-25T00:07:30.343Z",
"archive": false,
"old_id": null
}
This endpoint creates a product.
HTTP Request
POST http://example.com/api/v1/products
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
name | nil | The product’s name |
code | nil | The product’s code |
Update Product
curl --request PATCH
--header "Content-Type: application/json"
--data '{"product": { "name": "Sm. Bucket" }}'
"http://example.com/api/v1/products/12705?token=API_TOKEN"
The above command returns JSON structured like this:
{
"id": 12705,
"company_id": 1,
"name": "Sm. Bucket",
"code": "ICE",
"created_at": "2017-05-25T00:07:30.343Z",
"updated_at": "2017-05-25T00:13:40.553Z",
"archive": false,
"old_id": null
}
This endpoint updates a product.
HTTP Request
PATCH http://example.com/api/v1/products/12705
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
name | nil | The product’s name |
code | nil | The product’s code |
Archive Product
curl --header "Content-Type: application/json"
--data ''
"http://example.com/api/v1/products/12705/archive?token=API_TOKEN"
The above command returns JSON structured like this:
{
"id": 12705,
"company_id": 1,
"name": "Sm. Bucket",
"code": "ICE",
"created_at": "2017-05-25T00:07:30.343Z",
"updated_at": "2017-05-25T00:13:40.553Z",
"archive": true,
"old_id": null
}
This endpoint archives a product.
HTTP Request
POST http://example.com/api/v1/products/12705/archive
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Selected Document Types
Get All Selected Document Types
curl "http://example.com/api/v1/selected_document_types?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"document_types": [
{
"id": 761,
"name": " Accreditation certificate"
},
{
"id": 810,
"name": " Conformity Supplier"
}
]
}
This endpoint retrieves all selected document types.
HTTP Request
GET http://example.com/api/v1/selected_document_types
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Selected Product Document Types
Get All Selected Product Document Types
curl "http://example.com/api/v1/selected_product_document_types?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"document_types": [
{
"id": 761,
"name": " Accreditation certificate"
},
{
"id": 810,
"name": " Conformity Supplier"
}
]
}
This endpoint retrieves all selected product document types.
HTTP Request
GET http://example.com/api/v1/selected_product_document_types
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Users
Get All Users
curl "http://example.com/api/v1/users?token=API_TOKEN&page=1"
The above command returns JSON structured like this:
{
"users": [
{
"id": 68,
"email": "mery@pesto.com",
"first_name": "Mary",
"last_name": "Pesto",
"time_zone": "Madrid",
"picture": "/assets/mery@pesto.jpg",
"department": {},
"gender": null,
"admin": false,
"owner": false,
"active": true,
"position": null,
"created_at": "2016-09-27T13:40:32.311Z",
"updated_at": "2016-09-27T13:40:32.311Z"
}
]
}
This endpoint retrieves all associated company users.
HTTP Request
GET http://example.com/api/v1/users
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
page | 1 | The page of resources |
Get Specific User
curl "http://example.com/api/v1/users/68?token=API_TOKEN"
The above command returns JSON structured like this:
{
"user": {
"id": 68,
"email": "mery@pesto.com",
"first_name": "Mary",
"last_name": "Pesto",
"time_zone": "Madrid",
"picture": null,
"department": {},
"gender": null,
"admin": false,
"owner": false,
"active": true,
"position": null,
"created_at": "2016-09-27T13:40:32.311Z",
"updated_at": "2016-09-27T13:40:32.311Z"
}
}
This endpoint retrieves an associated company user.
HTTP Request
GET http://example.com/api/v1/users/68
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
Create User
curl --header "Content-Type: application/json"
--data '{"user": { "email": "mery@pesto.com", "first_name": "Mary", "last_name": "Pesto", "timezone": "Madrid", "locale": "Madrid" }}'
"http://localhost:3000/api/v1/users?token=API_TOKEN"
The above command returns JSON structured like this:
{
"user": {
"id": 68,
"email": "mery@spesto.com",
"first_name": "Mary",
"last_name": "Pesto",
"time_zone": null,
"picture": null,
"department": { },
"gender": null,
"admin": false,
"owner": false,
"active": true,
"position": null,
"created_at": "2017-05-24T22:01:16.451Z",
"updated_at": "2017-05-24T22:01:16.451Z"
}
}
This endpoint creates a company user.
HTTP Request
POST http://example.com/api/v1/users
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
nil | The user’s email | |
first_name | nil | The user’s first_name |
last_name | nil | The user’s last_name |
timezone | nil | The user’s current timezone |
locale | nil | The user’s current locale |
Update User
curl --request PATCH
--header "Content-Type: application/json"
--data '{"user": { "first_name": "Mery" }}'
"http://example.com/api/v1/users/68?token=API_TOKEN"
The above command returns JSON structured like this:
{
"user": {
"id": 68,
"email": "mery@pesto.com",
"first_name": "Mery",
"last_name": "Pesto",
"time_zone": "Madrid",
"picture": null,
"department": { },
"gender": null,
"admin": false,
"owner": false,
"active": true,
"position": null,
"created_at": "2016-09-27T13:40:32.311Z",
"updated_at": "2017-05-24T22:10:15.326Z"
}
}
This endpoint updates a company user.
HTTP Request
PATCH http://example.com/api/v1/users/68
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |
first_name | nil | The user’s first_name |
last_name | nil | The user’s last_name |
locale | nil | The user’s current locale |
department_id | nil | The id of user’s department |
gender | nil | The user’s gender |
position | nil | The user’s position |
Deactivate User
curl --header "Content-Type: application/json"
--data ''
"http://example.com/api/v1/users/68/deactivate?token=API_TOKEN"
The above command returns HTTP Status 204 No Content
This endpoint deactivates a company user.
HTTP Request
POST http://example.com/api/v1/users/68/deactivate
Query Parameters
Parameter | Default | Description |
---|---|---|
token | nil | The company’s token for authentication |