Skip to content
J. Biolaz edited this page Jun 24, 2014 · 12 revisions

Create post

Creating post is not really part of REST API but it is possible for you to add the possibility to create a post inside your website. You can simply add a link from your web page to the following URL:

<a href="http://www.urturn.com/documents/_your_document_uuid_/new_post?callback_url=_your_callback_url_">
  Participate
</a>
  • your_document_uuid: the UUID of the source document for the expression. Basically new post will be created from this post
  • your_callback_url: the URL that will be redirected to once post has been created.

your_callback_url will be called with following parameters:

_your_callback_url_?status=success&document_id=_new_document_id&username=_urturn_creator_username
  • status can be success if post has been created or cancelled if user did not post it but did a cancel
  • document_id will be the uuid of created document
  • username will be the urturn username that the user used for creating his post

Search posts

You can get a list of posts using the following url on the API endpoint (http://www.urturn.com/api):

GET /posts.json?_params_

It will return a json that contains an array of posts and a boolean to know if there is more posts. Posts are always ordered by date of publication

You have to pass one of the following parameters to get posts (params) :

  • q : A query, It will return posts that match it

    http://www.urturn.com/api/posts.json?q=%23oscars2014 To get all posts with the hashtag #Oscars2014

  • username : Will return posts created by a username like LittleMissPrincess

    http://www.urturn.com/api/posts.json?username=LittleMissPrincess

  • expression_name : Will return posts based on a expression name like BlueTit/My-Best-Celebrity-Selfie-Ever

    http://www.urturn.com/api/posts.json?expression_name=BlueTit/My-Best-Celebrity-Selfie-Ever

  • expression_post_id : Will return posts that use the same expression than the post id given

    http://www.urturn.com/api/posts.json?expression_post_id=C6331A63-5460-0001-E840-1F7614101157

  • expression_creator : Will return posts based on a expression creator. It means all posts from all expression created by expression_creator like bluetit

    http://www.urturn.com/api/posts.json?expression_creator=bluetit

Note that you can't combine this parameters. You have to choose only one. If more are passed you may not have the expected result

There is also two optional params that allow you to paginate:

  • page: the page you want to show. Default is 1
  • per_page: the number of posts you want per page. Default is 50

Example: http://www.urturn.com/api/posts.json?q=%23oscars2014&page=3&per_page=10

post json contents

You will get the following json for each post:

post: {
	post_url: "http://www.urturn.com/documents/C617BFB1-D3C0-0001-39A2-18FB1F3019B3",
	uuid: "C617BFB1-D3C0-0001-39A2-18FB1F3019B3",
	note: "#Oscars2014 Me and my buddies!",
	creator: {
	  uuid: "2f3ec817-e079-4925-9b83-bd3a67550c47",
	  username: "barbie13",
	  avatar_thumb_url: "http://d1zfyaik59vxnx.cloudfront.net/assets/thumbs/default_thumb-27f331e47e283fec5166ba581f0f0271.png",
	  first_name: "Barbie",
	  last_name: "",
	  is_official: false,
	  created_at: "2014-03-31T05:56:04Z"
	},
	expression: {
	  system_name: "My-Best-Celebrity-Selfie-Ever",
	  full_system_name: "BlueTit/My-Best-Celebrity-Selfie-Ever",
	  version: "2.0.0",
	  state: "public",
	  closed: false,
	  description: "My Best Celebrity Selfie Ever",
	  creator: {
	    uuid: "2d9e7322-db9a-4d29-8a2c-5c2e154c37af",
	    username: "BlueTit",
	    avatar_thumb_url: "http://assets.urturn.com/uploads/user/avatar/2d9e7322-db9a-4d29-8a2c-5c2e154c37af/small_thumb_screen_shot_20140118_at_182142_1390069334.jpg",
	    first_name: "",
	    last_name: "",
	    is_official: false
	  }
	},
	thumbnails: {
		default: "http://d3hbqwz8pbf7wl.cloudfront.net/page/thumbnail/C617BFB1-D420-0001-924B-F0EF12201942/0.jpg",
		small: "http://d3hbqwz8pbf7wl.cloudfront.net/page/thumbnail/C617BFB1-D420-0001-924B-F0EF12201942/2.jpg",
		thumb_height: 290,
		has_interaction: true
	}
}
  • post.post_url : the url of the post on urturn
  • post.uuid : the unique id of the post on urturn
  • post.note : the note of the post. Can contains hashtag and mentions
  • post.creator : a json with all the info about the creator of the post.
  • post.thumbnails : a json with link to the thumbnails of the posts (default and small).
  • post.expression : a json with all the info about the expression used to create the post.
  • post.expression.creator : a json with all the info about the expression creator.
Clone this wiki locally