From 1280daafe3656c7552cf648c79756a95f3774fe1 Mon Sep 17 00:00:00 2001 From: Shubham Palriwala Date: Tue, 28 Nov 2023 19:36:01 +0530 Subject: [PATCH] feat: update client api docs as per new responses (#1695) --- .../app/docs/api/client/actions/page.mdx | 7 ++- .../app/docs/api/client/displays/page.mdx | 18 ++----- .../app/docs/api/client/people/page.mdx | 28 +---------- .../app/docs/api/client/responses/page.mdx | 50 +------------------ .../client/[environmentId]/displays/route.ts | 6 ++- .../v1/client/[environmentId]/people/route.ts | 15 ++++-- 6 files changed, 25 insertions(+), 99 deletions(-) diff --git a/apps/formbricks-com/app/docs/api/client/actions/page.mdx b/apps/formbricks-com/app/docs/api/client/actions/page.mdx index 44da3a46e8..1fcd75c1c9 100644 --- a/apps/formbricks-com/app/docs/api/client/actions/page.mdx +++ b/apps/formbricks-com/app/docs/api/client/actions/page.mdx @@ -45,14 +45,17 @@ Adds an Actions for a given User by their User ID curl --location --request POST 'https://app.formbricks.com/api/v1/client//actions' \ --data-raw '{ "userId": "1", - "name": "new_action_v2" + "name": "new_action_v2", + "properties":{} + }' ``` ```json {{ title: 'Example Request Body' }} { "userId": "1", - "name": "new_action_v2" + "name": "new_action_v3", + "properties":{} } ``` diff --git a/apps/formbricks-com/app/docs/api/client/displays/page.mdx b/apps/formbricks-com/app/docs/api/client/displays/page.mdx index bf359e2ce4..fd14e1084f 100644 --- a/apps/formbricks-com/app/docs/api/client/displays/page.mdx +++ b/apps/formbricks-com/app/docs/api/client/displays/page.mdx @@ -65,12 +65,7 @@ This set of API can be used to ```json {{title:'200 Success'}} { "data": { - "id": "clp83r8uy000ceyqcbld2ebwj", - "createdAt": "2023-11-21T08:57:23.866Z", - "updatedAt": "2023-11-21T08:57:23.866Z", - "surveyId": "cloqzeuu70000z8khcirufo60", - "responseId": null, - "personId": "cloo25v3e0000z8ptskh030jd" + "id": "clphzz6oo00083zdmc7e0nwzi" } } ``` @@ -81,7 +76,7 @@ This set of API can be used to "message": "Fields are missing or incorrectly formatted", "details": { "surveyId": "Required" - } + } } ``` @@ -129,14 +124,7 @@ This set of API can be used to ```json {{title:'200 Success'}} { - "data": { - "id": "clp83r8uy000ceyqcbld2ebwj", - "createdAt": "2023-11-21T08:57:23.866Z", - "updatedAt": "2023-11-21T09:05:27.285Z", - "surveyId": "cloqzeuu70000z8khcirufo60", - "responseId": null, - "personId": "cloo25v3e0000z8ptskh030jd" - } + "data": {} } ``` diff --git a/apps/formbricks-com/app/docs/api/client/people/page.mdx b/apps/formbricks-com/app/docs/api/client/people/page.mdx index f286377e5f..d4b85735b5 100644 --- a/apps/formbricks-com/app/docs/api/client/people/page.mdx +++ b/apps/formbricks-com/app/docs/api/client/people/page.mdx @@ -26,12 +26,6 @@ This set of API can be used to Create User with your own User ID ### Mandatory Request Body JSON Keys - - - Environment to create a person in - - - User ID which you would like to identify the person with @@ -48,7 +42,6 @@ This set of API can be used to 'https://app.formbricks.com/api/v1/client//people' \ -H 'Content-Type: application/json' \ -d '{ - "environmentId":"clonzr6vc0009z8md7y06hipl", "userId":"docs_user" }' ``` @@ -60,15 +53,7 @@ This set of API can be used to ```json {{title:'200 Success'}} { "data": { - "status": "success", - "person": { - "id": "clp861gvu0000v7wzr950fqad", - "userId": "docs_user", - "attributes": {}, - "environmentId": "clonzr6vc0009z8md7y06hipl", - "createdAt": "2023-11-21T10:01:20.058Z", - "updatedAt": "2023-11-21T10:01:20.058Z" - } + "userId": "docs_user" } } ``` @@ -126,16 +111,7 @@ This set of API can be used to ```json {{title:'200 Success'}} { - "data": { - "id": "clp868htl0003v7wzmy977m15", - "userId": "new_docs_user", - "attributes": { - "welcome_to": "formbricks" - }, - "environmentId": "clonzr6vc0009z8md7y06hipl", - "createdAt": "2023-11-21T10:06:47.865Z", - "updatedAt": "2023-11-21T10:06:47.865Z" - } + "data": {} } ``` diff --git a/apps/formbricks-com/app/docs/api/client/responses/page.mdx b/apps/formbricks-com/app/docs/api/client/responses/page.mdx index a144e66350..b2099d95fb 100644 --- a/apps/formbricks-com/app/docs/api/client/responses/page.mdx +++ b/apps/formbricks-com/app/docs/api/client/responses/page.mdx @@ -95,29 +95,6 @@ Add a new response to a survey. { "data": { "id": "clp84xdld0002px36fkgue5ka", - "createdAt": "2023-11-21T09:30:09.553Z", - "updatedAt": "2023-11-21T09:30:09.553Z", - "surveyId": "cloqzeuu70000z8khcirufo60", - "finished": true, - "data": { - "clfqjny0v0003yzgscnog1j9i": 10, - "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks" - }, - "meta": { - "userAgent": {} - }, - "personAttributes": {}, - "singleUseId": null, - "person": { - "id": "cloo25v3e0000z8ptskh030jd", - "userId": "1", - "attributes": {}, - "environmentId": "clonzr6vc0009z8md7y06hipl", - "createdAt": "2023-11-07T08:17:23.114Z", - "updatedAt": "2023-11-07T08:17:23.114Z" - }, - "tags": [], - "notes": [] } } ``` @@ -196,32 +173,7 @@ Update an existing response in a survey. ```json {{ title: '200 Success' }} { - "data": { - "id": "clp84xdld0002px36fkgue5ka", - "createdAt": "2023-11-21T09:30:09.553Z", - "updatedAt": "2023-11-21T09:35:38.357Z", - "surveyId": "cloqzeuu70000z8khcirufo60", - "finished": false, - "data": { - "clfqjny0v0003yzgscnog1j9i": 10, - "clfqjtn8n0070yzgs6jgx9rog": "I love Formbricks" - }, - "meta": { - "userAgent": {} - }, - "personAttributes": {}, - "singleUseId": null, - "person": { - "id": "cloo25v3e0000z8ptskh030jd", - "userId": "1", - "attributes": {}, - "environmentId": "clonzr6vc0009z8md7y06hipl", - "createdAt": "2023-11-07T08:17:23.114Z", - "updatedAt": "2023-11-07T08:17:23.114Z" - }, - "tags": [], - "notes": [] - } + "data": {} } ``` diff --git a/apps/web/app/api/v1/client/[environmentId]/displays/route.ts b/apps/web/app/api/v1/client/[environmentId]/displays/route.ts index 1b6b2bba8e..0a4bcada7b 100644 --- a/apps/web/app/api/v1/client/[environmentId]/displays/route.ts +++ b/apps/web/app/api/v1/client/[environmentId]/displays/route.ts @@ -34,10 +34,12 @@ export async function POST(request: Request, context: Context): Promise