ADDA Lattice API
API Endpoint
https://api.adda.ioAPI to support resident work order requests sync with Lattice Platform
Authentication
-
This API uses JWT for authentication
-
Every token MUST be refreshed before its expiration time of 24 hours
-
Token MUST be provided in
Authorization
header -
Token MUST be provided for each request that requires authentication
-
This API issues a long-lived access tokens for consumers. A long-lived JWT generally SHOULD lasts 365 days.
-
Once a token expires the user MUST go through the login flow again to get a new one.
Example Header
Authorization: Bearer <token>
Claims
-
exp
- The exp ( expiration time ) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. -
iat
- The iat ( issued at ) claim identifies the time at which the JWT was issued. -
sub
- The aud ( audience ) claim identifies the subject of this token (for e.g. a user id). -
iss
- The iss ( issuer ) claim identifies the principal that issued the JWT.
HTTP Methods
This API uses HTTP verbs (methods) as following:
-
GET
- Read - used to read (or retrieve) a representation of a resource, -
POST
- Create - used to create new resources. In particular, it"s used to create subordinate resources. -
PUT
- Update/Replace - used for update capabilities, PUT-ing to a known resource URI with the request body containing the newly-updated representation of the original resource. On successful request, replaces identified resource with the request body. -
PATCH
- Update/Modify - used for modify capabilities. The PATCH request only needs to contain the changes to the resource, not the complete resource. -
DELETE
- Delete - used to delete a resource identified by a URI.
Media Type
Where applicable this API MUST use the JSON media-type. Requests with a message-body are using plain JSON to set or update resource states.
Content-type: application/json
and Accept: application/json
headers SHOULD be set on all requests if not stated
otherwise.
Status Codes and Errors
This API uses HTTP status codes to communicate with the API consumer.
-
200 OK
- Response to a successful GET, PUT, PATCH or DELETE. -
201 Created
- Response to a POST that results in a creation. -
204 No Content
- Response to a successful request that won"t be returning a body (like a DELETE request). -
400 Bad Request
- Malformed request; form validation errors. -
401 Unauthorized
- When no or invalid authentication details are provided. -
403 Forbidden
- When authentication succeeded but authenticated user doesn"t have access to the resource. -
404 Not Found
- When a non-existent resource is requested. -
405 Method Not Allowed
- Method not allowed. -
406 Not Acceptable
- Could not satisfy the request Accept header. -
415 Unsupported Media Type
- Unsupported media type in request.
Vendor Authentication ¶
Access tokens are required to access nearly all endpoints of this API.
Retrieve a token ¶
Headers
Content-Type: application/json
Body
{
"email": "iot@adda.io",
"password": "iot-api@adda"
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "User email address"
},
"password": {
"type": "string",
"description": "User password"
}
},
"required": [
"email",
"password"
]
}
Headers
Content-Type: application/json
Body
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9....",
"token_type": "bearer",
"expires_in": 86400
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"access_token": {
"type": "string",
"description": "JSON Web Token."
},
"token_type": {
"type": "string",
"description": "Token type"
},
"expires_in": {
"type": "number",
"description": "Token expiry in seconds"
}
}
}
Retrieve a tokenPOST/api/auth/login
Allows to retrieve a valid JSON Web Token for email and password.
Endpoint information
Requires authentication | No |
Has restricted scope | No |
Refresh a token ¶
Headers
Authorization: bearer <token>
Headers
Content-Type: application/json
Body
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
}
Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "New JWT"
}
}
}
Headers
Content-Type: application/json
Body
{
"status": "Unauthorized"
}
Refresh a tokenGET/api/auth/refresh
Allows to retrieve a new, valid JSON Web Token based on a valid JSON Web Token.
Expired tokens MUST NOT be refreshed.
Endpoint information
Requires authentication | Yes |
Has restricted scope | No |
Change password ¶
Headers
Content-Type: application/json
Authorization: bearer <token>
Body
{
"old_password": "secret",
"new_password": "$3C6e7"
}
Headers
Content-Type: application/json
Body
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Headers
Content-Type: application/json
Body
{
"status": "Unauthorized"
}
Change passwordPUT/api/auth/password
Changes user password.
After password is changed all access tokens issued for this user prior to password change must be invalidated.
Endpoint information
Requires authentication | Yes |
Has restricted scope | No |
Get profile ¶
Headers
Authorization: bearer <token>
Headers
Content-Type: application/json
Body
{
"vendor_user_id": 1,
"is_primary": 1,
"is_admin": 1,
"name": "John Doe",
"phone": "080 1234 5678",
"email": "john@doe.com",
"vendor": {
"vendor_id": 1,
"vendor_name": "Adda",
"is_active": 1,
"address1": "No. 518, 4th & 5th Floor, V V Arcade",
"address2": "1st Main Road, AECS Layout, B Block, Kundalahalli",
"zip": "560037",
"city": "Bangalore",
"state": "Karnataka",
"country": "India",
"landline": "080 9876 4321"
}
}
Headers
Content-Type: application/json
Body
{
"status": "Unauthorized"
}
Get profileGET/api/auth/me
Shows user profile information
Endpoint information
Requires authentication | Yes |
Has restricted scope | No |
Lattice APIs ¶
Access tokens are required to access nearly all endpoints of this API.
Update Work Order ¶
Headers
Content-Type: application/json
Authorization: bearer <token>
Body
{
"adda_id": 132016, //Test ADDA created for Lattice
"adda_wo_id": 123456,
"wo_number": 1234,
"status": "Closed",
"status_remarks": "Pipe leakage has been fixed by John Doe at 12.12.12 10:15:00",
"photos": [
{
"url": "https:\/\/addapublicmumbai.s3.ap-south-1.amazonaws.com\/mum\/brk\/2019\/5\/complaint\/4eb1e0650128f21c536980fbdecf3c11-1576741472-71547270_2462198770495653_1678855024689545216_n.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJHT5X55J3NXCUPBQ%2F20191219%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20191219T074434Z&X-Amz-SignedHeaders=Host&X-Amz-Expires=86400&X-Amz-Signature=e99a6a72dad352742b7f5da4fafcf463d303b47cc79bd04fd3260e781c1a6aa5",
"format": "image",
"name": "71547270_2462198770495653_1678855024689545216_n.jpg"
},
{
"url": "https:\/\/addapublicmumbai.s3.ap-south-1.amazonaws.com\/mum\/brk\/2019\/5\/complaint\/4eb1e0650128f21c536980fbdecf3c11-1576741472-71547270_2462198770495653_1678855024689545216_n.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJHT5X55J3NXCUPBQ%2F20191219%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20191219T074434Z&X-Amz-SignedHeaders=Host&X-Amz-Expires=86400&X-Amz-Signature=e99a6a72dad352742b7f5da4fafcf463d303b47cc79bd04fd3260e781c1a6aa5",
"format": "image",
"name": "71547270_2462198770495653_1678855024689545216_n.jpg"
}
],
"status_timestamp": "YYYY-MM-DD HH:mm:ss"
}
Headers
Content-Type: application/json
Body
{
"adda_wo_id": 123456,
"updated": true,
"reason": "Work order updated on ADDA"
}
Headers
Content-Type: application/json
Body
{
"adda_wo_id": 123456,
"updated", false,
"reason": "Work order doesn't exist"
}
Update Work OrderPOST/api/lattice/WOUpdate
Updates a work order
Payload Parameters
-
adda_id - ADDA Property ID
-
adda_wo_id - ADDA work order ID
-
wo_number - Work order Lattice reference number
-
status - Status of the work order
-
status_remarks - Update for the work order [‘New’, ‘In Progress’, ‘On Hold’, ‘Closed’]
-
photos - Array of photo file ID(s) [use File uload API for file ID]
-
status_timestamp - Status timestamp in GMT
Endpoint information
Requires authentication | Yes |
Has restricted scope | No |
SR Purchase Request ¶
Headers
Content-Type: application/json
Authorization: bearer <token>
Body
{
"adda_id": 132016, //Test ADDA created for Lattice
"rf_pr_id": 1234,
"pr_date": "YYYY-MM-DD",
"pr_type": "Period Based Contract",
"oa_supplier_id": 412312,
"contract_period_from": "YYYY-MM-DD",
"contract_period_to": "YYYY-MM-DD",
"budget_type": "Budget Type",
"pr_line": [
{
"category": "Category"
"expense_head": "Expense Head",
"description": "Description",
"amount": 12.50
},
{
"category": "Category 2",
"expense_head": "Expense Head 2",
"description": "Description 2",
"amount": 34.50
}
],
"rf_approval_history": [
{
"timestamp": "2020-12-30 12-12-12",
"actioned_by": "Actioned By",
"action": "Approved",
"remarks": "Remarks"
]
}
Headers
Content-Type: application/json
Body
{
"rf_pr_id": 123456,
"created": true,
"reason": "Work order created on ADDA"
}
Headers
Content-Type: application/json
Body
{
"rf_pr_id": 123456,
"created", false,
"reason": "Work order doesn't exist"
}
SR Purchase RequestPOST/api/lattice/PRCreate
Create a new purchase request
Payload Parameters
-
rf_pr_id - Reflexion Purchase Request ID
-
adda_id - ADDA Property ID
-
pr_date - Purchase request creation date (YYYY-MM-DD)
-
pr_type - Purchase request type (“Period Based Contract”, “Out of Scope / Additional Work”)
-
oa_supplier_id - Reflexion Supplier Code
-
contract_period_from - Contract Period From (YYYY-MM-DD)
-
contract_period_to - Contract Period To (YYYY-MM-DD)
-
budget_type - Budget Type
-
pr_line - Array of PR line items
-
pr_line_item
- category - Category
- expense_head - Expense Head
- description - Description
- amount - Amount
-
rf_approval_history - Array of Reflexion Approval History
-
rf_approval_history_item
- timestamp - Date & Time
- actioned_by - Actioned by
- action - Action (Approved / Rejected / Rejected to Resubmit / Clarification etc.)
- remarks - Remarks
Endpoint information
Requires authentication | Yes |
Has restricted scope | No |
File upload ¶
Headers
Content-Type: multipart/form-data; boundary=---BOUNDARY
Body
-----BOUNDARY
Content-Disposition: form-data; name="image[file]"; filename="image.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAABAAEDASIA
AhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFAEB
AAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AL+AD//Z
-----BOUNDARY
Headers
Content-Type: application/json
Body
{
"adda_id": 132016, //Test ADDA created for Lattice
"id": 9876,
"file_name": "image.jpg"
}
File uploadPOST/api/lattice/WOFile/{adda_id}
Upload files to ADDA platform
Endpoint information
Requires authentication | Yes |
Has restricted scope | No |
- adda_id
number
(required) Example: 132016ADDA Property ID
Generated by aglio on 04 Jul 2024