Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update records by criteria did not work #3

Open
blackkara opened this issue Jun 23, 2021 · 0 comments
Open

Update records by criteria did not work #3

blackkara opened this issue Jun 23, 2021 · 0 comments

Comments

@blackkara
Copy link

blackkara commented Jun 23, 2021

To update records by criteria, documentation indicates below guidance. I just want to increase follower count of a specific user ( I have a custom user object)

curl -X PUT \
-H "Content-Type: application/json" \
-H "CB-Token: <TOKEN>" \
-d '{"search_criteria": {"age":{"lt":30}}, "country_of_birth":"Iran"}' \
https://api.connectycube.com/data/profile/by_criteria

But its missing important thing like where to add operation fields (i.e "inc": {"field_name": "value"})

As a flutter client this is what i have tried

 var url = 'https://api.connectycube.com/data/UserDetail/by_criteria';

 var headers = Map<String, String>();
 headers['CB-Token'] = session.token;
 headers['Content-Type'] = 'application/json';

 var values = ...
 var body = jsonEncode(values);
 This is what the body is ==> "{"search_criteria":{"userId":4388899},"inc":{"userTotalFollowers":1}}

 var response = await http.put(url, headers: headers, body: body);

But it does not update the field of the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant