Include raw in json request response


(Adam Beers) #1

Is there a way to include the raw as well as the cooked data for a search.json and user_actions.json request?

The “excerpt” in the response as urls, like the “cooked” entry for other responses. Wanted to have the raw data included. When getting a topic “115.json,” if you include the “include_raw=true” in the request it will supply the raw as well in the response. Trying to find a similar config in the search.json and user_actions.json requests.

Here is an example of a request to example.com/user_actions.json?username=user1234&filter=5 As seen, the excerpt is “cooked” and the title is raw. I would like the raw excerpt.

   "user_actions": [{
		"action_type": 5,
		"created_at": "2017-03-27T02:00:17.757Z",
		"excerpt": "<img src=\"//www.example.com/images/emoji/emoji_one/grinning.png?v=3\" title=\":grinning:\" class=\"emoji\" alt=\":grinning:\"> Reply with emoji face",
		"avatar_template": "/user_avatar/wwjd.example.com/user1234/{size}/57_1.png",
		"acting_avatar_template": "/user_avatar/wwjd.example.com/user1234/{size}/57_1.png",
		"slug": "this-is-an-emoji-post",
		"topic_id": 137,
		"target_user_id": 67,
		"target_name": null,
		"target_username": "user1234",
		"post_number": 3,
		"post_id": 185,
		"reply_to_post_number": null,
		"username": "user1234",
		"name": null,
		"user_id": 67,
		"acting_username": "user1234",
		"acting_name": null,
		"acting_user_id": 67,
		"title": "😀 This is an emoji post",
		"deleted": false,
		"hidden": false,
		"post_type": 1,
		"action_code": null,
		"category_id": 1,
		"closed": false,
		"archived": false
	}

(Adam Beers) #2

Any ideas? If I knew how to change it, I would do it myself and submit the changes for review, but I’m not familiar with this programming language.

Is there someone I could talk to about how to go about changing it?


(Mittineague) #3

I don’t think there are raw excerpts.
There are raw posts.
I don’t know of any way to get JSON from more than one in a single request as things are now.
But this should be doable in a plugin that could pull the data and output it as JSON


(Adam Beers) #4

If I do a user_actions.json?filter=5&username=bob123, then I will get all replies that bob123 has done. Which could be a large number, but it gives all of them back. It is getting more than one item, as you are talking about. I only showed one item for space limits.