I was looking at the documentation for the Tweet Object and the User Object, but could not find any relationship between a Tweet and its Author.

So how are Tweets linked to a particular Author(that is a User)?

Thanks

A Tweet typically contains Tweet object and User objects. The Tweet objects are related to the Tweet itself, and the User objects are related to the user that the Tweet originated from, such as the (user) id, name, screen_name, etc.

1 Like

@Hamza thanks for the answer.

What I mean is what happens when a new Tweet is created? How do we know that a Tweet with id 1 was created by user with id A?

Because I can’t find that a Tweet object has an author(or created_by) attribute or a User object has a tweet(an array of Tweet Id’s)!

A Tweet typically contains Tweet object and User objects.

So what you mean is that every Tweet has all the info about it creator(User) as a user attribute?

Thanks

@gaganrattan9, you’re correct. Every Tweet contains the user info as well as the Tweet info.

Here’s an example of the user object:

"user": {
  "id": 12,
  "id_str": "12",
  "name": "jack 🌍🌏🌎",
  "screen_name": "jack",
  "location": "",
  "description": "",
  "url": null,
  "entities": {
    "description": {
      "urls": []
    }

Here’s an example of the Tweet object:

[
  {
    "created_at": "Thu Mar 01 15:33:53 +0000 2018",
    "id": 969234275420655616,
    "id_str": "969234275420655616",
    "full_text": "We’re committing Twitter to help increase the collective health, openness, and civility of public conversation, and to hold ourselves publicly accountable towards progress.",
    "truncated": false,
    ...

I encourage you to play around with the GET statuses/lookup API using Postman or Insomnia to learn more about how a ‘hydrated’ JSON Tweet looks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.