Project
Any experience is called a “project” in the GMetri SDK.
The field you are most interested in is the “json” field, which is an object of type RecordNode<RT.project>
Changes to the project body (project.json) can be sent in via the updateJSON API which takes in the whole json at once or the applyJSONPatches which allows you send in an array of diffs.
In case you send patches, they need to be an array of type “JSON patches” https://immerjs.github.io/immer/patches/
Project Schema
- id: Unique id for every project
- uuid: Unique string identifier for every project (UUID format)
- name: Name of the project (has to be unique for per workspace for every project)
- thumbnail: The thumbnail URL
- created_at: Create at timestamp
- modified_at: Modified at timestamp
- organization_id: Unique id of the organization this project belongs to
- json: the body of the project. Of type
RecordNode<RT.project>
Create Project
Section titled “Create Project”POST https://api.gmetri.com/sdk/project/create
Create new project with default JSON.
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| name* | String | The name of project |
| orgSlug* | String | The unique identification string of organization |
{ "status": { "success": true }, "data": { "id": 37, "name": "Mitul Test", "uuid": "9ead035f-1ec4-45c8-9fcc-2aaedfc8c4f8", "thumbnail": null, "created_at": "2022-10-20T18:07:14.193625", "modified_at": "2022-10-20T18:07:14.193625", "organization_id": 6 }}Get Project
Section titled “Get Project”POST https://api.gmetri.com/sdk/project/get
Get the project using project uuid
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String | Unique identifier of the project (UUID format) |
{ "status": { "success": true }, "data": { "id": 33, "name": "test7 (1)", "uuid": "6ee092d0-bc12-4c89-8d75-05ba9ea50218", "thumbnail": "https://s.vrgmetri.com/image/w_400,q_90/gb-web/r3f-ui/assets/pano/0_grid_02_white.jpg", "created_at": "2022-10-19T09:24:32.20418", "modified_at": "2022-10-19T09:25:10.131", "organization_id": 6 }}{ "statusCode": 401, "error": "Unauthorized", "message": "Error from z5api: No Authorization was found in request.headers"}{ "status": { "success": false, "errorMessage": "Opps! Something went wrong. Please try again later." }}Get All Project
Section titled “Get All Project”POST https://api.gmetri.com/sdk/project/getAll
Get all project for the orgnization
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| orgSlug* | String | |
| searchString | String | Search project by name |
| sortKey* | String | Get project by sorted order by [“modified_at” | “created_at” | “name”] |
| orderBy* | String | “ASC” | “DESC” |
| limit* | String | No of records |
| offset* | String | Next page offset to support pagination |
{ "status": { "success": true }, "data": { "projects": [ { "id": 35, "name": "test7 (3)", "uuid": "b1e9360e-86bb-4a79-879a-02041a325d9a", "thumbnail": "https://s.vrgmetri.com/image/w_400,q_90/gb-web/r3f-ui/assets/pano/0_grid_02_white.jpg", "created_at": "2022-10-19T19:59:27.898471", "modified_at": "2022-10-19T19:59:27.988", "organization_id": 6 }, { "id": 34, "name": "test7 (2)", "uuid": "abd7409f-58f2-4fca-813b-761a47d47092", "thumbnail": "https://s.vrgmetri.com/image/w_400,q_90/gb-web/r3f-ui/assets/pano/0_grid_02_white.jpg", "created_at": "2022-10-19T09:25:24.306648", "modified_at": "2022-10-19T09:25:24.376", "organization_id": 6 } ], "totalCount": 21 }}Update Project
Section titled “Update Project”POST https://api.gmetri.com/sdk/project/update
Update project name or tag by project uuid
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String | |
| name | String | Project new name |
| tags | Array of String | Project tag |
{ "status": { "success": true }, "data": { "id": 21, "name": "mitul test", "uuid": "39be32c8-0415-4b27-9667-d983de4fc07b", "thumbnail": "https://s.vrgmetri.com/image/w_400,q_90/gb-web/r3f-ui/assets/pano/0_grid_02_white.jpg", "created_at": "2022-09-22T18:47:38.708681", "modified_at": "2022-10-20T09:13:02.826", "organization_id": 6 }}Delete Project
Section titled “Delete Project”POST https://api.gmetri.com/sdk/project/delete
Delete project by project uuid
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String |
{ "status": { "success": true }}Get Project JSON
Section titled “Get Project JSON”POST https://api.gmetri.com/sdk/project/getJSON
Get Project JSON by project uuid
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String |
{ "status": { "success": true, "errorCode": "string", "errorMessage": "string" }, "data": RecordNode<RT.project> //project's rJSON}Update JSON
Section titled “Update JSON”POST https://api.gmetri.com/sdk/project/updateJSON
Update project json(RecordNode<RT.project>) by project uuid
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String | Token <apiToken> |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String | |
| json* | Object | rJSON of the project RecordNode<RT.project> |
{ "status": { "success": true }}Apply JSON Patches
Section titled “Apply JSON Patches”POST https://api.gmetri.com/sdk/project/applyJSONPatches
Apply JSON patches and by getting diff JSON and update new JSON by project uuid
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String | |
| patches* | Object | JSON patches https://immerjs.github.io/immer/patches/ |
{ "status": { "success": true }}Duplicate Project
Section titled “Duplicate Project”POST https://api.gmetri.com/sdk/project/duplicate
Make copy of project inside same organization
Headers
Section titled “Headers”| Name | Type | Description |
|---|---|---|
| Authorization* | String |
Request Body
Section titled “Request Body”| Name | Type | Description |
|---|---|---|
| projUuid* | String | |
| orgSlug* | String |
{ "status": { "success": true }, "data": { "projectUuid": "b1e9360e-86bb-4a79-879a-02041a325d9a" // copy project uuid }}
