# How many posts created by specific user?

**URL:** https://forum.social.plus/t/how-many-posts-created-by-specific-user/854
**Category:** General
**Created:** [July 30, 2023, 10:32am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854 "2023-07-30T10:32:53Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 30, 2023, 10:32am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/1 "2023-07-30T10:32:53Z")

</div>

Hello, Is it away to get how many posts created by specific user?  
using - Flutter SDK  
Thanks

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 31, 2023, 10:09am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/4 "2023-07-31T10:09:32Z")

</div>

Hi @meridork ,

Are you trying to get post from community or user feed? Can you please help elaborate?

Thank you,  
Amity Support

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 31, 2023, 10:18am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/5 "2023-07-31T10:18:53Z")

</div>

How many posts the user uploaded. to all communities  
The idea to get the activity of the user

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 31, 2023, 11:54am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/6 "2023-07-31T11:54:06Z")

</div>

I did it with following command in api-docs and its working

```auto
curl -X 'GET' \
  'https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxxxxxxxxxxxxxxx'

```

But the following command got following error in my code  
**command**  
var resp = await http.get(Uri.parse(‘[https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count](https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count)’));

**error**  
I/flutter (11557): kobi - http 401 {  
I/flutter (11557): “status”: “error”,  
I/flutter (11557): “message”: “Authorization info not found”,  
I/flutter (11557): “code”: 400100,  
I/flutter (11557): “data”: {  
I/flutter (11557): “detail”: {  
I/flutter (11557): “appErrorCode”: 400100  
I/flutter (11557): }  
I/flutter (11557): }  
I/flutter (11557): }

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 31, 2023, 1:31pm UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/7 "2023-07-31T13:31:51Z")

</div>

> [@meridork](#):
>
> How many posts the user uploaded. to all communities  
> The idea to get the activity of the user

Currently, you can only get post specific from either user feed/community feed.

At the moment, our sdk doesn’t provide the option to get posts from community by userid.

From your api that is working, it seems that you tried to get user feed’s posts which is correct and it works as expected.

```auto
curl -X 'GET' \
  'https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxxxxxxxxxxxxxxx'

```

However for the code below, the error indicates that the _Authorization_ is missing.

**command**  
var resp = await http.get(Uri.parse(‘[https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count’](https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count%E2%80%99)));

error  
I/flutter (11557): kobi - http 401 {  
I/flutter (11557): “status”: “error”,  
I/flutter (11557): “message”: “Authorization info not found”,  
I/flutter (11557): “code”: 400100,  
I/flutter (11557): “data”: {  
I/flutter (11557): “detail”: {  
I/flutter (11557): “appErrorCode”: 400100  
I/flutter (11557): }  
I/flutter (11557): }  
I/flutter (11557): }

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 31, 2023, 1:50pm UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/8 "2023-07-31T13:50:22Z")

</div>

This is the API

```auto
curl -X 'GET' \
  'https://api.eu.amity.co/api/v3/user-feeds/allerg.meridor%40gmail.com/count' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer'

```

Where do I need to add the accessToken?

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 31, 2023, 1:58pm UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/9 "2023-07-31T13:58:19Z")

</div>

![Screenshot 2566-07-31 at 14.54.40](https://europe1.discourse-cdn.com/flex013/uploads/amity/original/1X/afe137b51d700cb6dde9a3df90880dcc20f565a6.png)

Could you help us confirm whether the API is causing the problem or if it’s an issue with the code? In your earlier comment, you mentioned the API was fine, but the code wasn’t working.

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 31, 2023, 2:15pm UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/10 "2023-07-31T14:15:13Z")

</div>

issue with the code

where to add the token? to the API GET

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 31, 2023, 2:27pm UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/11 "2023-07-31T14:27:37Z")

</div>

I found

```
url = Uri(
  scheme: 'https',
  host: 'api.eu.amity.co',
  path: '/api/v3/user-feeds/${eMail}/count',
);

var r1 = await http.get(
  url,
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer $accessToken',
  },
);

```

Its working on mobile and only one of the users  
The user is [allerg.meridor@gmail.com](mailto:allerg.meridor@gmail.com) and defined as Admin

And the user created posts and the counter was not incremented

Thanks

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [July 31, 2023, 3:02pm UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/12 "2023-07-31T15:02:40Z")

</div>

Another question about number of posts and its relevance to other issues  
Can I get number of post created by another user

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [August 1, 2023, 9:56am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/13 "2023-08-01T09:56:53Z")

</div>

If you manage to get the post by following the instructions we provided, then you should be able to get the number of posts by **count**

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [August 1, 2023, 11:13am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/14 "2023-08-01T11:13:58Z")

</div>

Hello,  
This is the code and the postsCount is wrong  
All the https post/get status are OK , 200  
Thanks

```
Uri url = Uri(
  scheme: 'https',
  host: 'api.eu.amity.co',
  path: '/api/v3/sessions',
);

var body = json.encode({
  "userId": "string",
  "deviceId": "string",
  "deviceInfo": {
    "kind": "ios",
    "model": "string",
    "sdkVersion": "string"
  },
  "displayName": "string",
  "authToken": "string"
});
var r = await http.post(
  url,
  headers: {
    'accept': 'application/json',
    'x-api-key': 'b0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2c',
    'Content-Type': 'application/json',
  },
  body: body,
);
Map bodyMap = jsonDecode(r.body);
String accessToken = bodyMap['accessToken'].toString();

url = Uri(
  scheme: 'https',
  host: 'api.eu.amity.co',
  path: '/api/v3/user-feeds/${eMail}/count',
);
body = json.encode({
  "userId": "string",
  "deviceId": "string",
  "deviceInfo": {
    "kind": "ios",
    "model": "string",
    "sdkVersion": "string"
  },
  "displayName": "string",
  "authToken": "string"
});

var r1 = await http.get(
  url,
  headers: {
    'accept': 'application/json',
    'Authorization': 'Bearer $accessToken',
  },
);

bodyMap = jsonDecode(r1.body);
postsCounuter = bodyMap['postsCount'];

```

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [August 1, 2023, 11:28am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/15 "2023-08-01T11:28:26Z")

</div>

Which token did you use in this code? Does it belong to another user?

---

<div class="post-metadata">

### Author: ![meridork](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meridork](https://forum.social.plus/u/meridork)
#### Post date: [August 1, 2023, 11:56am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/16 "2023-08-01T11:56:29Z")

</div>

is was created in the first HTTPS for the same user  
[allerg.meridor@gmail.com](mailto:allerg.meridor@gmail.com)

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [August 2, 2023, 8:52am UTC](https://forum.social.plus/t/how-many-posts-created-by-specific-user/854/17 "2023-08-02T08:52:48Z")

</div>

To retrieve the posts of a specific user, you will need to use their token. We suggest following the APIs mentioned in this topic: [Get post created by following](https://forum.social.plus/t/get-post-created-by-following/840) for guidance.
