{"__v":2,"_id":"55b96120b42b610d00c9b29a","category":{"__v":2,"_id":"55b9611fb42b610d00c9b291","pages":["55b96120b42b610d00c9b29a","55b96120b42b610d00c9b29b","55b96120b42b610d00c9b29c","55b96120b42b610d00c9b29d","55b96120b42b610d00c9b29e","55b96120b42b610d00c9b29f","55b96120b42b610d00c9b2a0","55b96120b42b610d00c9b2a1","55ba5b8c04775a2f0062813d"],"project":"54295508cd35120800fceca2","version":"55b9611eb42b610d00c9b28d","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-09-29T12:48:08.939Z","from_sync":false,"order":3,"slug":"api-tokens-endpoints","title":"Rpc Endpoints"},"editedParams":true,"editedParams2":true,"project":"54295508cd35120800fceca2","user":"542954f6cd35120800fceca0","version":{"__v":4,"_id":"55b9611eb42b610d00c9b28d","project":"54295508cd35120800fceca2","createdAt":"2015-07-29T23:26:22.532Z","releaseDate":"2015-07-29T23:26:22.532Z","categories":["55b9611fb42b610d00c9b28e","55b9611fb42b610d00c9b28f","55b9611fb42b610d00c9b290","55b9611fb42b610d00c9b291","55b9611fb42b610d00c9b292","55b9611fb42b610d00c9b293","55bc25ee76754617002aa893","56ae7f53be2c040d00d5a09b","56ae7f7b0c1cab0d009f65d1"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"updates":["543594995e1b2020004381e8","543a34eae14e09080000a02c","56acae1c79011b0d00c32a66"],"next":{"pages":[],"description":""},"createdAt":"2014-09-29T13:29:47.277Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"post","results":{"codes":[{"status":200,"language":"json","code":"{\"success\": true, \"yo_id\": \"55135e09f663d1000aed924c\"}","name":"Success"},{"status":429,"language":"json","code":"{\"error\": \"180 per 1 hour\"}","name":"Failure"},{"status":404,"language":"json","code":"{\"error\": \"No user found\", \"code\": 404}"},{"status":400,"language":"json","code":"{\"error\": \"Can't send Yo with location and link\"}"}]},"settings":"","auth":"never","params":[{"_id":"54295ecb8d596e080056e9d0","ref":"","in":"body","required":true,"desc":"the recipient's username","default":"","type":"string","name":"username"},{"_id":"54295ecb8d596e080056e9cf","ref":"","in":"body","required":true,"desc":"your api token (get it at http://dev.justyo.co)","default":"","type":"string","name":"api_token"},{"_id":"54295ecb8d596e080056e9ce","ref":"","in":"body","required":false,"desc":"(Optional) link","default":"","type":"string","name":"link"},{"_id":"543451c5bfaa3d0800c4d8a8","ref":"","in":"body","required":false,"desc":"(Optional - can only send link OR location but not both) format: lat,long","default":"","type":"string","name":"location"},{"_id":"55c0194837298d0d00088bae","ref":"","in":"body","required":false,"desc":"30 chars max","default":"","type":"string","name":"text"}],"url":"/yo/"},"isReference":false,"order":0,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var http = new XMLHttpRequest();\\nvar url = \\\"http://api.justyo.co/yo/\\\";\\nvar params = \\\"api_token=<token>&username=JOE\\\";\\nhttp.open(\\\"POST\\\", url, true);\\n\\n//Send the proper header information along with the request\\nhttp.setRequestHeader(\\\"Content-type\\\", \\\"application/x-www-form-urlencoded\\\");\\nhttp.setRequestHeader(\\\"Content-length\\\", params.length);\\nhttp.setRequestHeader(\\\"Connection\\\", \\\"close\\\");\\n\\nhttp.onreadystatechange = function() {//Call a function when the state changes.\\n    if(http.readyState == 4 && http.status == 200) {\\n        alert(http.responseText);\\n    }\\n}\\nhttp.send(params);\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"import requests\\nrequests.post(\\\"http://api.justyo.co/yo/\\\", \\n              data={'api_token': api_token, 'username': 'JOHNAPPLESEED'})\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"require 'net/http'\\n\\npostData = Net::HTTP.post_form(URI.parse('http://api.justyo.co/yo/'), {'api_token'=>'<token>', 'username'=>'JOE'})\\n\\nputs postData.body\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"$url = 'http://api.justyo.co/yo/';\\n$data = array('api_token' => 'token', 'username' => 'JOE');\\n\\n$options = array(\\n    'http' => array(\\n        'header'  => \\\"Content-type: application/x-www-form-urlencoded\\\\r\\\\n\\\",\\n        'method'  => 'POST',\\n        'content' => http_build_query($data),\\n    ),\\n);\\n$context  = stream_context_create($options);\\n$result = file_get_contents($url, false, $context);\\n\\nvar_dump($result);\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"NSURL *url = [NSURL urlWithString::::at:::\\\"http://api.justyo.co/yo/\\\";\\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\\n// Set request type\\nrequest.HTTPMethod = @\\\"POST\\\";\\n \\n// Set params to be sent to the server\\nNSString *params = @\\\"api_token=<token>&username=JOE\\\";\\n// Encoding type\\nNSData *data = [params dataUsingEncoding:NSUTF8StringEncoding];\\n// Add values and contenttype to the http header\\n[request addValue:@\\\"8bit\\\" forHTTPHeaderField:@\\\"Content-Transfer-Encoding\\\"];\\n[request addValue:@\\\"application/x-www-form-urlencoded\\\" forHTTPHeaderField:@\\\"Content-Type\\\"];\\n[request addValue:[NSString stringWithFormat:@\\\"%lu\\\", (unsigned long)[data length]] forHTTPHeaderField:@\\\"Content-Length\\\"];\\n[request setHTTPBody:data];\\n \\n// Send the request\\n[NSURLConnection connectionWithRequest:request delegate:self];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"String url = \\\"http://api.justyo.co/yo/\\\";\\nURL obj = new URL(url);\\nHttpsURLConnection con = (HttpsURLConnection) obj.openConnection();\\n\\ncon.setRequestMethod(\\\"POST\\\");\\n\\nString urlParameters = \\\"api_token=<token>&username=JOE\\\";\\n\\ncon.setDoOutput(true);\\nDataOutputStream wr = new DataOutputStream(con.getOutputStream());\\nwr.writeBytes(urlParameters);\\nwr.flush();\\nwr.close();\\n\\nint responseCode = con.getResponseCode();\\n\\nBufferedReader in = new BufferedReader(\\n        new InputStreamReader(con.getInputStream()));\\nString inputLine;\\nStringBuffer response = new StringBuffer();\\n\\nwhile ((inputLine = in.readLine()) != null) {\\n\\tresponse.append(inputLine);\\n}\\nin.close();\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"var request = require('request');\\n\\nrequest.post(\\n    'http://api.justyo.co/yo/',\\n    { form: { 'api_token': '<token>',\\n              'username': '<username>',\\n              'link': 'http://google.com' } },\\n    function (error, response, body) {\\n        if (!error && response.statusCode == 200) {\\n            console.log(body);\\n        }\\n    }\\n);\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"API_TOKEN = <token>\\n# get api_token from https://dev.justyo.co\\nUSERNAME = JOE\\nwget --post-data 'api_token=$API_TOKEN&username=$USERNAME' https://api.justyo.co/yo/\",\n      \"language\": \"shell\",\n      \"name\": \"Bash\"\n    },\n    {\n      \"code\": \"curl --data \\\"username=JOE&api_token=<your_api_token>\\\" http://api.justyo.co/yo/\",\n      \"language\": \"curl\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"yo","type":"endpoint","title":"/yo/"}

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

username:
required
string
the recipient's username
api_token:
required
string
your api token (get it at http://dev.justyo.co)
link:
string
(Optional) link
location:
string
(Optional - can only send link OR location but not both) format: lat,long
text:
string
30 chars max

Result Format


Documentation

[block:code] { "codes": [ { "code": "var http = new XMLHttpRequest();\nvar url = \"http://api.justyo.co/yo/\";\nvar params = \"api_token=<token>&username=JOE\";\nhttp.open(\"POST\", url, true);\n\n//Send the proper header information along with the request\nhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\nhttp.setRequestHeader(\"Content-length\", params.length);\nhttp.setRequestHeader(\"Connection\", \"close\");\n\nhttp.onreadystatechange = function() {//Call a function when the state changes.\n if(http.readyState == 4 && http.status == 200) {\n alert(http.responseText);\n }\n}\nhttp.send(params);", "language": "javascript" }, { "code": "import requests\nrequests.post(\"http://api.justyo.co/yo/\", \n data={'api_token': api_token, 'username': 'JOHNAPPLESEED'})", "language": "python" }, { "code": "require 'net/http'\n\npostData = Net::HTTP.post_form(URI.parse('http://api.justyo.co/yo/'), {'api_token'=>'<token>', 'username'=>'JOE'})\n\nputs postData.body", "language": "ruby" }, { "code": "$url = 'http://api.justyo.co/yo/';\n$data = array('api_token' => 'token', 'username' => 'JOE');\n\n$options = array(\n 'http' => array(\n 'header' => \"Content-type: application/x-www-form-urlencoded\\r\\n\",\n 'method' => 'POST',\n 'content' => http_build_query($data),\n ),\n);\n$context = stream_context_create($options);\n$result = file_get_contents($url, false, $context);\n\nvar_dump($result);", "language": "php" }, { "code": "NSURL *url = [NSURL urlWithString:@\"http://api.justyo.co/yo/\";\nNSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];\n// Set request type\nrequest.HTTPMethod = @\"POST\";\n \n// Set params to be sent to the server\nNSString *params = @\"api_token=<token>&username=JOE\";\n// Encoding type\nNSData *data = [params dataUsingEncoding:NSUTF8StringEncoding];\n// Add values and contenttype to the http header\n[request addValue:@\"8bit\" forHTTPHeaderField:@\"Content-Transfer-Encoding\"];\n[request addValue:@\"application/x-www-form-urlencoded\" forHTTPHeaderField:@\"Content-Type\"];\n[request addValue:[NSString stringWithFormat:@\"%lu\", (unsigned long)[data length]] forHTTPHeaderField:@\"Content-Length\"];\n[request setHTTPBody:data];\n \n// Send the request\n[NSURLConnection connectionWithRequest:request delegate:self];", "language": "objectivec" }, { "code": "String url = \"http://api.justyo.co/yo/\";\nURL obj = new URL(url);\nHttpsURLConnection con = (HttpsURLConnection) obj.openConnection();\n\ncon.setRequestMethod(\"POST\");\n\nString urlParameters = \"api_token=<token>&username=JOE\";\n\ncon.setDoOutput(true);\nDataOutputStream wr = new DataOutputStream(con.getOutputStream());\nwr.writeBytes(urlParameters);\nwr.flush();\nwr.close();\n\nint responseCode = con.getResponseCode();\n\nBufferedReader in = new BufferedReader(\n new InputStreamReader(con.getInputStream()));\nString inputLine;\nStringBuffer response = new StringBuffer();\n\nwhile ((inputLine = in.readLine()) != null) {\n\tresponse.append(inputLine);\n}\nin.close();", "language": "java" }, { "code": "var request = require('request');\n\nrequest.post(\n 'http://api.justyo.co/yo/',\n { form: { 'api_token': '<token>',\n 'username': '<username>',\n 'link': 'http://google.com' } },\n function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body);\n }\n }\n);", "language": "javascript" }, { "code": "API_TOKEN = <token>\n# get api_token from https://dev.justyo.co\nUSERNAME = JOE\nwget --post-data 'api_token=$API_TOKEN&username=$USERNAME' https://api.justyo.co/yo/", "language": "shell", "name": "Bash" }, { "code": "curl --data \"username=JOE&api_token=<your_api_token>\" http://api.justyo.co/yo/", "language": "curl" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}