### Nested GET Request Example Source: https://developers.autoenrolment.co.uk/smart/28783c05ecb6a-using-the-api Demonstrates how to use the `include[]` query parameter to fetch related data in a single HTTP GET request. This example shows retrieving company details along with its owner information. ```http GET /companies/:id?include[]=owner ``` -------------------------------- ### Nested GET Request Example Source: https://developers.autoenrolment.co.uk/smart/7756f9f9959a5-getting-started Demonstrates how to use the `include[]` query parameter to perform nested requests in a single HTTP GET call. This allows fetching related data, such as company details and its owner information, in a hierarchical structure. ```http GET /companies/:id?include[]=owner ``` ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", .... "owner": { "id": 15, "forename": "John", "surname": "Smith", .... } } ``` -------------------------------- ### Filtering GET Request Example Source: https://developers.autoenrolment.co.uk/smart/7756f9f9959a5-getting-started Illustrates the use of the `filter[]` query parameter to filter results from API endpoints. This example shows how to retrieve only paid contributions for a specific company by filtering on the 'state' field. ```http GET /companies/:company_id/contributions?filter[state]=paid ``` -------------------------------- ### Nested GET Request Example with `include[]` Source: https://developers.autoenrolment.co.uk/smart/index Demonstrates how to use the `include[]` query parameter in an HTTP GET request to retrieve related data in a single call. This example shows fetching company details along with nested owner information. ```http GET /companies/:id?include[]=owner ``` ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", ...., "owner": { "id": 15, "forename": "John", "surname": "Smith", .... } } ``` -------------------------------- ### Nested Request Response Example (JSON) Source: https://developers.autoenrolment.co.uk/smart/28783c05ecb6a-using-the-api Illustrates the JSON response structure when using nested requests, maintaining data hierarchy for related resources like company and owner details. ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", .... "owner": { "id": 15, "forename": "John", "surname": "Smith", .... } } ``` -------------------------------- ### Nested Requests with `include[]` Source: https://developers.autoenrolment.co.uk/smart/28783c05ecb6a-using-the-api Demonstrates how to use the `include[]` query parameter with GET requests to fetch nested related data in a single API call, maintaining data hierarchy. ```APIDOC ## GET /companies/:id?include[]=owner ### Description Fetches company details along with its nested owner information in a single API call. ### Method GET ### Endpoint `/companies/:id?include[]=owner` #### Query Parameters - **include[]** (array) - Required - Specifies related resources to include in the response (e.g., `owner`). ### Request Example ``` GET /companies/10?include[]=owner ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the company. - **name** (string) - The name of the company. - **staging_on** (date) - The staging date for the company. - **owner_id** (integer) - The ID of the company's owner. - **legal_structure** (string) - The legal structure of the company. - **owner** (object) - An object containing the details of the company's owner. - **id** (integer) - The unique identifier for the owner. - **forename** (string) - The owner's first name. - **surname** (string) - The owner's last name. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Nested Requests API Source: https://developers.autoenrolment.co.uk/smart/44e37c461ba67-keystone-api Demonstrates how to use the `include[]` query parameter to nest multiple queries into a single HTTP GET request, allowing retrieval of related data in a single call. ```APIDOC ## GET /companies/:id?include[]=owner ### Description This endpoint allows you to retrieve company details along with nested owner information in a single request by using the `include[]=owner` query parameter. ### Method GET ### Endpoint `/companies/:id?include[]=owner` ### Parameters #### Query Parameters - **include[]** (string) - Optional - Allows nesting of related data, e.g., `owner`. ### Request Example `GET /companies/10?include[]=owner` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the company. - **name** (string) - The name of the company. - **staging_on** (string) - The staging date of the company. - **owner_id** (integer) - The ID of the company's owner. - **legal_structure** (string) - The legal structure of the company. - **owner** (object) - Nested object containing owner details. - **id** (integer) - The unique identifier for the owner. - **forename** (string) - The owner's first name. - **surname** (string) - The owner's last name. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Nested Requests Source: https://developers.autoenrolment.co.uk/smart/index Demonstrates how to use the `include[]` query parameter to fetch related data in a single `GET` request. This allows for retrieving nested resources, such as company details along with owner information, without requiring multiple calls. ```APIDOC ## GET /companies/:id?include[]=owner ### Description Fetches company details and includes nested owner information in the same response. ### Method GET ### Endpoint `/companies/:id?include[]=owner` ### Parameters #### Query Parameters - **include[]** (string) - Optional - Allows including related data, e.g., `owner`. ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the company. - **name** (string) - The name of the company. - **staging_on** (date) - The staging date for the company. - **owner_id** (integer) - The ID of the company's owner. - **legal_structure** (string) - The legal structure of the company. - **owner** (object) - Nested object containing owner details. - **id** (integer) - The unique identifier for the owner. - **forename** (string) - The first name of the owner. - **surname** (string) - The last name of the owner. ### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Filtering Results with `filter[]` Source: https://developers.autoenrolment.co.uk/smart/28783c05ecb6a-using-the-api Explains how to use the `filter[]` query parameter to filter lists of resources based on specific field values in GET requests. ```APIDOC ## GET /companies/:company_id/contributions?filter[state]=paid ### Description Fetches a list of contributions for a specific company, filtered to include only those with a 'paid' state. ### Method GET ### Endpoint `/companies/:company_id/contributions` #### Query Parameters - **filter[state]** (string) - Optional - Filters contributions by their state (e.g., `paid`). ### Request Example ``` GET /companies/123/contributions?filter[state]=paid ``` ### Response #### Success Response (200) - Returns a list of contribution objects that match the filter criteria. #### Response Example ```json [ { "id": 1, "company_id": 123, "employee_id": 456, "amount": 100.50, "state": "paid" }, { "id": 2, "company_id": 123, "employee_id": 457, "amount": 75.20, "state": "paid" } ] ``` ``` -------------------------------- ### Nested Requests Source: https://developers.autoenrolment.co.uk/smart/7756f9f9959a5-getting-started The `include[]` query parameter allows for nesting multiple queries into a single GET request. This is useful for fetching related data in a single call, maintaining data hierarchy. ```APIDOC ## GET /companies/:id?include[]=owner ### Description Fetches company details along with nested owner details in a single API call. ### Method GET ### Endpoint `/companies/:id?include[]=owner` #### Query Parameters - **include[]** (array) - Optional - Specifies related resources to include in the response, e.g., `owner`. ### Response #### Success Response (200) - **id** (integer) - Unique identifier for the company. - **name** (string) - Name of the company. - **staging_on** (date) - Staging date of the company. - **owner_id** (integer) - ID of the company's owner. - **legal_structure** (string) - Legal structure of the company. - **owner** (object) - Nested object containing owner details. - **id** (integer) - Unique identifier for the owner. - **forename** (string) - Owner's first name. - **surname** (string) - Owner's last name. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Nested Requests with `include[]` Source: https://developers.autoenrolment.co.uk/smart/42d8d78e1463a-versions Demonstrates how to use the `include[]` query parameter to make nested requests, fetching related data in a single API call. This is typically used with GET requests to retrieve a resource and its associated data. ```APIDOC ## GET /companies/:id?include[]=owner ### Description This endpoint allows you to retrieve company details along with nested owner information in a single request by utilizing the `include[]=owner` query parameter. ### Method GET ### Endpoint `/companies/:id?include[]=owner` ### Parameters #### Query Parameters - **include[]** (string) - Optional - Specifies related data to include in the response. Example: `include[]=owner` ### Request Example `GET /companies/10?include[]=owner` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the company. - **name** (string) - The name of the company. - **staging_on** (date) - The staging date of the company. - **owner_id** (integer) - The ID of the company's owner. - **legal_structure** (string) - The legal structure of the company. - **owner** (object) - An object containing the details of the company's owner. - **id** (integer) - The unique identifier for the owner. - **forename** (string) - The first name of the owner. - **surname** (string) - The last name of the owner. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Nested Requests Source: https://developers.autoenrolment.co.uk/smart/451fbda1e0bde-introduction The `include[]` query parameter allows for nesting multiple queries into a single GET request. You can retrieve linked data in a single call, maintaining data hierarchy. ```APIDOC ## GET /companies/:id?include[]=owner ### Description Retrieves company details along with nested owner information in a single API call. ### Method GET ### Endpoint `/companies/:id?include[]=owner` ### Query Parameters - **include[]** (string) - Required - Specifies related resources to include in the response, e.g., `owner`. ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the company. - **name** (string) - The name of the company. - **owner_id** (integer) - The ID of the company's owner. - **owner** (object) - Nested object containing the owner's details. - **id** (integer) - The unique identifier for the owner. - **forename** (string) - The owner's first name. - **surname** (string) - The owner's last name. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Nested Requests with `include[]` Source: https://developers.autoenrolment.co.uk/smart/8746c0c6c82b7-o-auth The `include[]` query parameter enables fetching related data in a single API call. This is particularly useful for `GET` requests where you need to retrieve details of associated resources along with the primary resource. ```APIDOC ## GET /companies/:id?include[]=owner ### Description Retrieves company details and nested owner information in a single request. ### Method GET ### Endpoint `/companies/:id?include[]=owner` #### Query Parameters - **include[]** (string) - Optional - Specifies the related resource to include (e.g., 'owner'). ### Request Example ``` GET /companies/10?include[]=owner ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the company. - **name** (string) - The name of the company. - **staging_on** (date) - The staging date of the company. - **owner_id** (integer) - The ID of the company owner. - **legal_structure** (string) - The legal structure of the company. - **owner** (object) - Nested object containing owner details. - **id** (integer) - The unique identifier of the owner. - **forename** (string) - The first name of the owner. - **surname** (string) - The last name of the owner. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Nested Requests Source: https://developers.autoenrolment.co.uk/smart/6810f928c15a0-parameters The `include[]` query parameter allows for nesting multiple queries into a single GET request. This enables fetching related data in a single call, maintaining data hierarchy in the response. ```APIDOC ## GET /companies/:id?include[]=owner ### Description Retrieves company details along with nested owner information in a single API call. ### Method GET ### Endpoint `/companies/:id?include[]=owner` ### Query Parameters - **include[]** (string) - Optional - Specifies related resources to include in the response. Example: `owner`. ### Response #### Success Response (200) - **id** (integer) - Unique identifier for the company. - **name** (string) - The name of the company. - **staging_on** (date) - The staging date of the company. - **owner_id** (integer) - The ID of the company's owner. - **legal_structure** (string) - The legal structure of the company. - **owner** (object) - Nested object containing owner details. - **id** (integer) - Unique identifier for the owner. - **forename** (string) - The owner's first name. - **surname** (string) - The owner's last name. #### Response Example ```json { "id": 10, "name": "Example Company", "staging_on": "2016-02-01", "owner_id": 15, "legal_structure": "Limited Company", "owner": { "id": 15, "forename": "John", "surname": "Smith" } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create Source: https://developers.autoenrolment.co.uk/smart/7756f9f9959a5-getting-started This endpoint is used to create a presigned POST request for employee data. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description Creates a presigned POST request, likely for uploading employee-related data securely. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Query Parameters None #### Request Body - **data** (object) - Required - The data payload for the employee. - **field1** (type) - Description ### Request Example ```json { "data": { "field1": "value1" } } ``` ### Response #### Success Response (200) - **uploadUrl** (string) - The URL to which the data should be POSTed. - **fields** (object) - Additional fields required for the POST request. - **field1** (string) - Description #### Response Example ```json { "uploadUrl": "https://example.com/upload", "fields": { "field1": "field_value" } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create Source: https://developers.autoenrolment.co.uk/smart/44e37c461ba67-keystone-api This endpoint allows for the creation of a presigned post for employee data. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description Allows for the creation of a presigned post for employee data. This is typically used for secure, pre-authenticated uploads of employee information. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **employeeData** (object) - Required - The data payload for the employee. - **firstName** (string) - Required - The first name of the employee. - **lastName** (string) - Required - The last name of the employee. - **email** (string) - Required - The email address of the employee. - **dateOfBirth** (string) - Required - The date of birth of the employee in YYYY-MM-DD format. ### Request Example ```json { "employeeData": { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "dateOfBirth": "1990-01-01" } } ``` ### Response #### Success Response (200) - **uploadUrl** (string) - The URL to which the employee data should be posted. - **fields** (object) - Additional fields required for the upload. #### Response Example ```json { "uploadUrl": "https://example.com/upload/presigned", "fields": { "key": "employee/12345.json", "AWSAccessKeyId": "EXAMPLE_KEY_ID", "policy": "EXAMPLE_POLICY", "signature": "EXAMPLE_SIGNATURE" } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create API Source: https://developers.autoenrolment.co.uk/smart/28783c05ecb6a-using-the-api This API endpoint is used to create a pre-signed POST URL for employee data uploads. ```APIDOC ## POST /employees/presigned-post/create ### Description Creates a pre-signed POST URL, allowing for secure and direct uploads of employee data to the Keystone platform without requiring intermediate storage. ### Method POST ### Endpoint /employees/presigned-post/create ### Parameters #### Query Parameters - **account_id** (string) - Required - The unique identifier for the account. ### Request Body ```json { "file_name": "string", "content_type": "string" } ``` ### Request Example ```json { "file_name": "employee_data.csv", "content_type": "text/csv" } ``` ### Response #### Success Response (200) - **upload_url** (string) - The pre-signed URL for uploading the file. - **fields** (object) - Additional form fields required for the upload. - **key** (string) - The object key for the upload. - **policy** (string) - The AWS policy document. - **x-amz-signature** (string) - The AWS signature. - **x-amz-credential** (string) - The AWS credential. - **x-amz-date** (string) - The AWS date. - **x-amz-security-token** (string) - The AWS security token. - **x-amz-algorithm** (string) - The AWS algorithm. #### Response Example ```json { "upload_url": "https://example-bucket.s3.amazonaws.com/uploads/12345/employee_data.csv?AWSAccessKeyId=...", "fields": { "key": "uploads/12345/employee_data.csv", "policy": "ey...", "x-amz-signature": "t...", "x-amz-credential": "...", "x-amz-date": "20231027T100000Z", "x-amz-security-token": "...", "x-amz-algorithm": "AWS4-HMAC-SHA256" } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create Source: https://developers.autoenrolment.co.uk/smart/6810f928c15a0-parameters This API endpoint allows for the creation of a pre-signed POST request for employee-related data. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description Creates a pre-signed POST URL for uploading employee data securely. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **filename** (string) - Required - The name of the file to be uploaded. - **contentType** (string) - Required - The MIME type of the file. ### Request Example ```json { "filename": "employee_data.csv", "contentType": "text/csv" } ``` ### Response #### Success Response (200) - **uploadUrl** (string) - The URL to which the file should be POSTed. - **fields** (object) - A map of form field names and their values that must be included in the POST request. #### Response Example ```json { "uploadUrl": "https://example.com/upload", "fields": { "key": "uploads/employee_data.csv", "AWSAccessKeyId": "EXAMPLE_KEY_ID", "signature": "EXAMPLE_SIGNATURE", "policy": "EXAMPLE_POLICY" } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create Source: https://developers.autoenrolment.co.uk/smart/42d8d78e1463a-versions This endpoint is used to create a pre-signed POST request for employee data. It allows for secure, direct uploads of employee information. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description Creates a pre-signed POST URL for uploading employee data directly to the system. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Query Parameters - **filename** (string) - Required - The name of the file to be uploaded. - **contentType** (string) - Required - The MIME type of the file. ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **uploadUrl** (string) - The URL to which the file should be uploaded. - **fields** (object) - Additional form fields required for the upload. #### Response Example ```json { "uploadUrl": "https://example.com/upload", "fields": { "key": "your-file-key", "AWSAccessKeyId": "YOUR_ACCESS_KEY", "acl": "private", "policy": "YOUR_POLICY", "signature": "YOUR_SIGNATURE" } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create Source: https://developers.autoenrolment.co.uk/smart/451fbda1e0bde-introduction This endpoint is designed to create a presigned POST URL for uploading employee data. It is part of the employee management functionality within the Keystone API. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description This endpoint generates a presigned POST URL, allowing clients to securely upload employee data directly to a storage service without direct server intervention. This is typically used for bulk employee uploads. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Query Parameters - **filename** (string) - Required - The name of the file to be uploaded. - **contentType** (string) - Required - The MIME type of the file (e.g., 'text/csv'). ### Request Example ```json { "filename": "employees.csv", "contentType": "text/csv" } ``` ### Response #### Success Response (200) - **uploadUrl** (string) - The presigned URL to which the file should be POSTed. - **fields** (object) - Additional form fields required for the POST request. - **key** (string) - The object key for the uploaded file. - **AWSAccessKeyId** (string) - The AWS access key ID. - **policy** (string) - The base64 encoded policy document. - **signature** (string) - The signature for the policy document. #### Response Example ```json { "uploadUrl": "https://smart-pension-uploads.s3.amazonaws.com/some-unique-path/employees.csv?AWSAccessKeyId=...", "fields": { "key": "some-unique-path/employees.csv", "AWSAccessKeyId": "...", "policy": "...", "signature": "..." } } ``` ``` -------------------------------- ### Employees/PresignedPost/Create API Source: https://developers.autoenrolment.co.uk/smart/index This API endpoint is used to create a pre-signed POST request for employees. It is part of the Keystone API for Smart Pension. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description This endpoint is used to generate a pre-signed URL for uploading employee data, allowing for secure and direct uploads to the system. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Query Parameters - **X-Api-Key** (string) - Required - The API key for authentication. #### Request Body - **fileName** (string) - Required - The name of the file to be uploaded. - **contentType** (string) - Required - The MIME type of the file. ### Request Example ```json { "fileName": "employee_data.csv", "contentType": "text/csv" } ``` ### Response #### Success Response (200) - **uploadUrl** (string) - The pre-signed URL for uploading the file. - **accessUrl** (string) - The URL to access the uploaded file after successful upload. #### Response Example ```json { "uploadUrl": "https://your-storage-bucket.s3.amazonaws.com/employees/presigned/upload/url?signature=...", "accessUrl": "https://your-storage-bucket.s3.amazonaws.com/employees/uploaded/file.csv" } ``` ``` -------------------------------- ### Employees/PresignedPost/Create API Source: https://developers.autoenrolment.co.uk/smart/8746c0c6c82b7-o-auth This API endpoint is used to create a presigned post for employee data. It is part of the Employees section within the Keystone API. ```APIDOC ## POST /Employees/PresignedPost/Create ### Description Creates a presigned post for employee data. This allows for secure and direct uploads of employee information. ### Method POST ### Endpoint /Employees/PresignedPost/Create ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **account_id** (string) - Required - The ID of the account associated with the employee. * **upload_url** (string) - Required - The URL to which the presigned post will be made. * **form_data** (object) - Required - Additional form data required for the upload. * **key** (string) - Required - The key for the form data. * **acl** (string) - Required - The access control list for the form data. * **policy** (string) - Required - The policy for the form data. * **signature** (string) - Required - The signature for the form data. * **content_type** (string) - Required - The content type of the upload. * **expires** (string) - Required - The expiration date for the presigned post. ### Request Example ```json { "account_id": "acc_12345", "upload_url": "https://example.com/upload", "form_data": { "key": "employees/data.csv", "acl": "private", "policy": "some_policy_string", "signature": "some_signature_string", "content_type": "text/csv", "expires": "2024-12-31T23:59:59Z" } } ``` ### Response #### Success Response (200) * **message** (string) - A success message indicating the presigned post was created. * **presigned_post** (object) - Details of the presigned post. * **url** (string) - The URL for the presigned post. * **fields** (object) - The fields required for the presigned post upload. #### Response Example ```json { "message": "Presigned post created successfully", "presigned_post": { "url": "https://example.com/upload", "fields": { "key": "employees/data.csv", "acl": "private", "policy": "some_policy_string", "signature": "some_signature_string", "content_type": "text/csv", "expires": "2024-12-31T23:59:59Z" } } } ``` ``` -------------------------------- ### Searching and Filtering Source: https://developers.autoenrolment.co.uk/smart/index Explains how to use the `filter[]` query parameter to narrow down results from API endpoints. This enables precise data retrieval by specifying field names and values for filtering. ```APIDOC ## GET /companies/:company_id/contributions?filter[state]=paid ### Description Retrieves a list of contributions for a specific company, filtered to show only those with a 'paid' state. ### Method GET ### Endpoint `/companies/:company_id/contributions` ### Parameters #### Query Parameters - **filter[state]** (string) - Optional - Filters contributions by their state (e.g., `paid`). ### Response #### Success Response (200) - Returns a list of contribution objects matching the filter criteria. ### Response Example (Example response would be a list of contribution objects, structure depends on the contribution schema) ``` -------------------------------- ### Filtering Results with `filter[]` Source: https://developers.autoenrolment.co.uk/smart/42d8d78e1463a-versions Explains how to use the `filter[]` query parameter to filter lists of resources based on specific field values. This allows for targeted retrieval of data. ```APIDOC ## GET /companies/:company_id/contributions?filter[state]=paid ### Description This endpoint allows you to filter contributions for a specific company. By using the `filter[state]=paid` query parameter, you can retrieve only the contributions that have a 'paid' state. ### Method GET ### Endpoint `/companies/:company_id/contributions` ### Parameters #### Query Parameters - **filter[state]** (string) - Optional - Filters the contributions by their state. Example: `filter[state]=paid` ### Request Example `GET /companies/123/contributions?filter[state]=paid` ### Response #### Success Response (200) - Returns a list of contributions that match the filter criteria. #### Response Example ```json [ { "id": 1, "company_id": 123, "member_id": 456, "amount": 100.00, "state": "paid" }, { "id": 2, "company_id": 123, "member_id": 789, "amount": 150.00, "state": "paid" } ] ``` ``` -------------------------------- ### Searching Source: https://developers.autoenrolment.co.uk/smart/7756f9f9959a5-getting-started The `filter[]` query parameter enables filtering results from various endpoints based on specific field values. ```APIDOC ## GET /companies/:company_id/contributions?filter[state]=paid ### Description Fetches contributions for a specific company, filtered by their state (e.g., 'paid'). ### Method GET ### Endpoint `/companies/:company_id/contributions` #### Query Parameters - **filter[state]** (string) - Optional - Filters contributions by their state. Example: `paid`. ### Response #### Success Response (200) - Returns a list of contribution objects matching the filter criteria. ``` -------------------------------- ### Searching API Source: https://developers.autoenrolment.co.uk/smart/44e37c461ba67-keystone-api Explains how to use the `filter[]` query parameter to filter results from various endpoints based on specific field values. ```APIDOC ## GET /companies/:company_id/contributions?filter[state]=paid ### Description This endpoint demonstrates how to filter contributions for a specific company by their state using the `filter[state]=paid` query parameter. ### Method GET ### Endpoint `/companies/:company_id/contributions?filter[state]=paid` ### Parameters #### Query Parameters - **filter[state]** (string) - Optional - Filters contributions by their state (e.g., `paid`). ### Request Example `GET /companies/123/contributions?filter[state]=paid` ### Response #### Success Response (200) Returns a list of contributions matching the filter criteria. #### Response Example ```json [ { "id": 1, "company_id": 123, "state": "paid", "amount": 500.00 }, { "id": 2, "company_id": 123, "state": "paid", "amount": 750.00 } ] ``` ``` -------------------------------- ### Generic Error Codes Source: https://developers.autoenrolment.co.uk/smart/28783c05ecb6a-using-the-api Lists and explains the standard error responses returned by the API for various failure conditions, including status codes and error message formats. ```APIDOC ## Generic Error Codes ### Description Provides a reference for common error codes and their meanings when interacting with the API. ### Method All HTTP Methods ### Endpoint N/A ### Parameters N/A ### Response #### Error Responses - **401 Unauthorized** - **Reason**: The accessor of the API is not authorized to access the endpoint. - **403 Forbidden** - **Response Format**: ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` - **Reason**: The request is forbidden due to business logic. - **404 Not Found** - **Reason**: The requested resource is not found. - **405 Method Not Allowed** - **Response Format**: ```json { "code": "55555", "title": "Action not allowed", "detail": "Cannot perform requested action." } ``` - **Reason**: The resource state does not permit further changes. - **409 Conflict** - **Response Format**: ```json { "errors": [ { "code": "99999", "title": "Error while processing request.", "detail": "We are processing your request, please try again later." } ] } ``` - **Reason**: The resource being accessed is not unique. - **422 Unprocessable Entity** - **Response Format**: ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` - **Reason**: The request raises validation errors or is unprocessable. #### Other Failures Any other failures will be in the format of: ```json { "code": "A custom code", "title": "A custom title", "detail": "A custom full description of the error" } ``` #### Internal Server Error (500) - **Reason**: An internal server error occurred. Returns an HTML page response. ``` -------------------------------- ### Generic Error Codes Source: https://developers.autoenrolment.co.uk/smart/7756f9f9959a5-getting-started Standard errors returned by the API when a request fails, categorized by status code. ```APIDOC ## Generic Error Codes ### Description This section outlines the standard error responses provided by the API. ### Error Responses - **401 Unauthorized** - **Reason**: The accessor of the API is not authorized to access the endpoint. - **403 Forbidden** - **Response Format**: ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` - **Reason**: The request is forbidden due to business logic. - **404 Not Found** - **Reason**: The requested resource was not found. - **405 Action Not Allowed** - **Response Format**: ```json { "code": "55555", "title": "Action not allowed", "detail": "Cannot perform requested action." } ``` - **Reason**: The resource state does not permit further changes. - **409 Conflict** - **Response Format**: ```json { "errors": [ { "code": "99999", "title": "Error while processing request.", "detail": "We are processing your request, please try again later." } ] } ``` - **Reason**: The resource being accessed is not unique. - **422 Unprocessable Entity** - **Response Format**: ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` - **Reason**: The request raises validation errors or is unprocessable. - **Other Failures** - **Response Format**: ```json { "code": "A custom code", "title": "A custom title", "detail": "A custom full description of the error" } ``` - **500 Internal Server Error** - **Reason**: Internal server errors return a status code of 500 and an HTML page response. ``` -------------------------------- ### Generic Error Codes Source: https://developers.autoenrolment.co.uk/smart/42d8d78e1463a-versions Provides a reference for common error responses returned by the API, including status codes, response formats, and reasons for the errors. ```APIDOC ## Generic Error Codes ### Description This section outlines the standard error responses that the API may return when a request fails. ### Status Codes and Responses **Status** | **Response** | **Reason** ---|---|--- **401** | | When the accessor of the API is not authorised to access the endpoint. **403** | ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` | When the request is forbidden due to business logic. **404** | | When a requested resource is not found. **405** | ```json { "code": "55555", "title": "Action not allowed", "detail": "Cannot perform requested action." } ``` | When a resource state does not permit further changes. **409** | ```json { "errors": [ { "code": "99999", "title": "Error while processing request.", "detail": "We are processing your request, please try again later." } ] } ``` | When the resource being accessed is not unique. **422** | ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` | When request raises validation errors or is unprocessable. Any other failures will be in the format of: ```json { "code": "A custom code", "title": "A custom title", "detail": "A custom full description of the error" } ``` Internal server errors return a status code of `500` and an HTML page response. ``` -------------------------------- ### Generic Error Codes Source: https://developers.autoenrolment.co.uk/smart/8746c0c6c82b7-o-auth Provides a list of standard error codes and their corresponding reasons that may be returned by the API when a request fails. ```APIDOC ## Error Handling ### Description Details common error responses from the API. ### Status Codes and Responses - **401 Unauthorized** - **Reason**: The accessor of the API is not authorized to access the endpoint. - **403 Forbidden** - **Response**: `{ "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } }` - **Reason**: The request is forbidden due to business logic. - **404 Not Found** - **Reason**: When a requested resource is not found. - **405 Method Not Allowed** - **Response**: `{ "code": "55555", "title": "Action not allowed", "detail": "Cannot perform requested action." }` - **Reason**: When a resource state does not permit further changes. - **409 Conflict** - **Response**: `{ "errors": [ { "code": "99999", "title": "Error while processing request.", "detail": "We are processing your request, please try again later." } ] }` - **Reason**: When the resource being accessed is not unique. - **422 Unprocessable Entity** - **Response**: `{ "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } }` - **Reason**: When request raises validation errors or is unprocessable. ### Other Failures Any other failures will be in the format of: ```json { "code": "A custom code", "title": "A custom title", "detail": "A custom full description of the error" } ``` Internal server errors return a status code of `500` and an HTML page response. ``` -------------------------------- ### Generic Error Codes Source: https://developers.autoenrolment.co.uk/smart/index Provides a reference for common error responses returned by the API. Includes status codes, their associated error formats, and reasons for the error. ```APIDOC ## Generic Error Codes ### Description Details standard error responses from the API, including status codes, response formats, and reasons. ### Error Responses - **401 Unauthorized** - **Reason**: The accessor of the API is not authorized to access the endpoint. - **403 Forbidden** - **Response Format**: ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` - **Reason**: The request is forbidden due to business logic. - **404 Not Found** - **Reason**: A requested resource was not found. - **405 Action Not Allowed** - **Response Format**: ```json { "code": "55555", "title": "Action not allowed", "detail": "Cannot perform requested action." } ``` - **Reason**: A resource's state does not permit further changes. - **409 Conflict** - **Response Format**: ```json { "errors": [ { "code": "99999", "title": "Error while processing request.", "detail": "We are processing your request, please try again later." } ] } ``` - **Reason**: The resource being accessed is not unique. - **422 Unprocessable Entity** - **Response Format**: ```json { "errors": { "code": "*custom code*", "title": "*custom error title*", "detail": "*custom description*" } } ``` - **Reason**: The request raises validation errors or is unprocessable. - **Other Failures** - **Response Format**: ```json { "code": "A custom code", "title": "A custom title", "detail": "A custom full description of the error" } ``` - **500 Internal Server Error** - **Reason**: Returns an HTML page response. ```