OSF APIv2 Documentation
GET
List all addons
{{baseUrl}}/addons/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/addons/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/addons/")
require "http/client"
url = "{{baseUrl}}/addons/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/addons/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/addons/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/addons/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/addons/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/addons/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/addons/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/addons/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/addons/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/addons/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/addons/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/addons/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/addons/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/addons/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/addons/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/addons/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/addons/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/addons/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/addons/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/addons/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/addons/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/addons/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/addons/');
echo $response->getBody();
setUrl('{{baseUrl}}/addons/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/addons/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/addons/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/addons/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/addons/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/addons/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/addons/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/addons/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/addons/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/addons/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/addons/
http GET {{baseUrl}}/addons/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/addons/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/addons/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"categories": [
"storage"
],
"description": "Box is a file storage add-on. Connect your Box account to an OSF project to interact with files hosted on Box via the OSF.",
"name": "Box",
"url": "http://www.box.com"
},
"id": "box",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "Dataverse is an open source software application to share, cite, and archive data. Connect your Dataverse account to share your Dataverse datasets via the OSF.",
"name": "Dataverse",
"url": "https://dataverse.harvard.edu/"
},
"id": "dataverse",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "Dropbox is a file storage add-on. Connect your Dropbox account to an OSF project to interact with files hosted on Dropbox via the OSF.",
"name": "Dropbox",
"url": "http://www.dropbox.com"
},
"id": "dropbox",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "Figshare is an online digital repository. Connect your figshare account to share your figshare files along with other materials in your OSF project.",
"name": "figshare",
"url": "http://www.figshare.com"
},
"id": "figshare",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "GitHub is a web-based Git repository hosting service. Connect your GitHub repo to your OSF project to share your code alongside other materials in your OSF project.",
"name": "GitHub",
"url": "http://www.github.com"
},
"id": "github",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"citations"
],
"description": "Mendeley is a reference management tool. Connecting Mendeley folders to OSF projects allows you and others to view, copy, and download citations that are relevant to your project from the Project Overview page.",
"name": "Mendeley",
"url": "http://www.mendeley.com"
},
"id": "mendeley",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"citations"
],
"description": "Zotero is a reference management tool. Connecting Zotero folders to OSF projects allows you and others to view, copy, and download citations that are relevant to your project from the Project Overview page.",
"name": "Zotero",
"url": "http://www.zotero.org"
},
"id": "zotero",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "ownCloud is an open source, self-hosted file sync and share app platform. Connect your ownCloud account to an OSF project to interact with files hosted on ownCloud via the OSF.",
"name": "ownCloud",
"url": "https://owncloud.org/"
},
"id": "owncloud",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "Amazon S3 is a file storage add-on. Connect your S3 account to an OSF project to interact with files hosted on S3 via the OSF.",
"name": "Amazon S3",
"url": "https://aws.amazon.com/s3/"
},
"id": "s3",
"links": {},
"type": "addon"
},
{
"attributes": {
"categories": [
"storage"
],
"description": "Google Drive is a file storage add-on. Connect your Google Drive account to an OSF project to interact with files hosted on Google Drive via the OSF.",
"name": "Google Drive",
"url": "https://drive.google.com"
},
"id": "googledrive",
"links": {},
"type": "addon"
}
],
"links": {
"first": null,
"last": null,
"meta": null,
"next": null,
"per_page": 1000,
"prev": null,
"total": 10
}
}
GET
Root
{{baseUrl}}/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/")
require "http/client"
url = "{{baseUrl}}/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/');
echo $response->getBody();
setUrl('{{baseUrl}}/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/
http GET {{baseUrl}}/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all citation styles
{{baseUrl}}/citations/styles/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/citations/styles/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/citations/styles/")
require "http/client"
url = "{{baseUrl}}/citations/styles/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/citations/styles/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/citations/styles/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/citations/styles/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/citations/styles/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/citations/styles/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/citations/styles/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/citations/styles/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/citations/styles/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/citations/styles/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/citations/styles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/citations/styles/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/citations/styles/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/citations/styles/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/citations/styles/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/citations/styles/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/citations/styles/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/citations/styles/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/citations/styles/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/citations/styles/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/citations/styles/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/citations/styles/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/citations/styles/');
echo $response->getBody();
setUrl('{{baseUrl}}/citations/styles/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/citations/styles/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/citations/styles/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/citations/styles/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/citations/styles/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/citations/styles/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/citations/styles/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/citations/styles/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/citations/styles/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/citations/styles/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/citations/styles/
http GET {{baseUrl}}/citations/styles/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/citations/styles/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/citations/styles/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_parsed": "2015-02-16T04:16:25.732000",
"short_title": "AMR",
"summary": null,
"title": "Academy of Management Review"
},
"id": "academy-of-management-review",
"links": {},
"type": "citation-styles"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/citations/styles/?page=115",
"meta": {
"per_page": 10,
"total": 1149
},
"next": "https://api.osf.io/v2/citations/styles/?page=2",
"prev": null
}
}
GET
Retrieve a citation style
{{baseUrl}}/citations/styles/:style_id/
QUERY PARAMS
style_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/citations/styles/:style_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/citations/styles/:style_id/")
require "http/client"
url = "{{baseUrl}}/citations/styles/:style_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/citations/styles/:style_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/citations/styles/:style_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/citations/styles/:style_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/citations/styles/:style_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/citations/styles/:style_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/citations/styles/:style_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/citations/styles/:style_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/citations/styles/:style_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/citations/styles/:style_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/citations/styles/:style_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/citations/styles/:style_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/citations/styles/:style_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/citations/styles/:style_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/citations/styles/:style_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/citations/styles/:style_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/citations/styles/:style_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/citations/styles/:style_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/citations/styles/:style_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/citations/styles/:style_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/citations/styles/:style_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/citations/styles/:style_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/citations/styles/:style_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/citations/styles/:style_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/citations/styles/:style_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/citations/styles/:style_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/citations/styles/:style_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/citations/styles/:style_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/citations/styles/:style_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/citations/styles/:style_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/citations/styles/:style_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/citations/styles/:style_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/citations/styles/:style_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/citations/styles/:style_id/
http GET {{baseUrl}}/citations/styles/:style_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/citations/styles/:style_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/citations/styles/:style_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"date_parsed": "2015-02-16T04:16:26.233000",
"short_title": "APA",
"summary": null,
"title": "American Psychological Association 6th edition"
},
"id": "apa",
"links": {},
"type": "citation-styles"
}
}
POST
Add Metadata or Subjects to a Entity in a Collection
{{baseUrl}}/collections/:collection_id/collected_metadata/
QUERY PARAMS
collection_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/:collection_id/collected_metadata/" {:content-type :json
:form-params {:application/json {:data {:attributes {:guid "test0"
:subjects "5fd228b7e64e1300aa99ee15"
:volume "test"}
:type "collected-metadata"}}}})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/"),
Content = new StringContent("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/"
payload := strings.NewReader("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/:collection_id/collected_metadata/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 215
{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/:collection_id/collected_metadata/")
.setHeader("content-type", "application/json")
.setBody("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/:collection_id/collected_metadata/")
.header("content-type", "application/json")
.body("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
'application/json': {
data: {
attributes: {
guid: 'test0',
subjects: '5fd228b7e64e1300aa99ee15',
volume: 'test'
},
type: 'collected-metadata'
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/',
headers: {'content-type': 'application/json'},
data: {
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application/json":{"data":{"attributes":{"guid":"test0","subjects":"5fd228b7e64e1300aa99ee15","volume":"test"},"type":"collected-metadata"}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "application/json": {\n "data": {\n "attributes": {\n "guid": "test0",\n "subjects": "5fd228b7e64e1300aa99ee15",\n "volume": "test"\n },\n "type": "collected-metadata"\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/',
headers: {'content-type': 'application/json'},
body: {
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
'application/json': {
data: {
attributes: {
guid: 'test0',
subjects: '5fd228b7e64e1300aa99ee15',
volume: 'test'
},
type: 'collected-metadata'
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/',
headers: {'content-type': 'application/json'},
data: {
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application/json":{"data":{"attributes":{"guid":"test0","subjects":"5fd228b7e64e1300aa99ee15","volume":"test"},"type":"collected-metadata"}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"application/json": @{ @"data": @{ @"attributes": @{ @"guid": @"test0", @"subjects": @"5fd228b7e64e1300aa99ee15", @"volume": @"test" }, @"type": @"collected-metadata" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'application/json' => [
'data' => [
'attributes' => [
'guid' => 'test0',
'subjects' => '5fd228b7e64e1300aa99ee15',
'volume' => 'test'
],
'type' => 'collected-metadata'
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/', [
'body' => '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'application/json' => [
'data' => [
'attributes' => [
'guid' => 'test0',
'subjects' => '5fd228b7e64e1300aa99ee15',
'volume' => 'test'
],
'type' => 'collected-metadata'
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'application/json' => [
'data' => [
'attributes' => [
'guid' => 'test0',
'subjects' => '5fd228b7e64e1300aa99ee15',
'volume' => 'test'
],
'type' => 'collected-metadata'
]
]
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/:collection_id/collected_metadata/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/"
payload = { "application/json": { "data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
} } }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/"
payload <- "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/:collection_id/collected_metadata/') do |req|
req.body = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/";
let payload = json!({"application/json": json!({"data": json!({
"attributes": json!({
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
}),
"type": "collected-metadata"
})})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/ \
--header 'content-type: application/json' \
--data '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}'
echo '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}' | \
http POST {{baseUrl}}/collections/:collection_id/collected_metadata/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "application/json": {\n "data": {\n "attributes": {\n "guid": "test0",\n "subjects": "5fd228b7e64e1300aa99ee15",\n "volume": "test"\n },\n "type": "collected-metadata"\n }\n }\n}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["application/json": ["data": [
"attributes": [
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
],
"type": "collected-metadata"
]]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Add Metadata or Subjects to an Entity in a Collection
{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
QUERY PARAMS
collection_id
cgm_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id" {:content-type :json
:form-params {:application/json {:data {:attributes {:guid "test0"
:subjects "5fd228b7e64e1300aa99ee15"
:volume "test"}
:type "collected-metadata"}}}})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"),
Content = new StringContent("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
payload := strings.NewReader("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/:collection_id/collected_metadata/:cgm_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 215
{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.header("content-type", "application/json")
.body("{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
'application/json': {
data: {
attributes: {
guid: 'test0',
subjects: '5fd228b7e64e1300aa99ee15',
volume: 'test'
},
type: 'collected-metadata'
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id',
headers: {'content-type': 'application/json'},
data: {
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application/json":{"data":{"attributes":{"guid":"test0","subjects":"5fd228b7e64e1300aa99ee15","volume":"test"},"type":"collected-metadata"}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "application/json": {\n "data": {\n "attributes": {\n "guid": "test0",\n "subjects": "5fd228b7e64e1300aa99ee15",\n "volume": "test"\n },\n "type": "collected-metadata"\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/:cgm_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id',
headers: {'content-type': 'application/json'},
body: {
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
'application/json': {
data: {
attributes: {
guid: 'test0',
subjects: '5fd228b7e64e1300aa99ee15',
volume: 'test'
},
type: 'collected-metadata'
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id',
headers: {'content-type': 'application/json'},
data: {
'application/json': {
data: {
attributes: {guid: 'test0', subjects: '5fd228b7e64e1300aa99ee15', volume: 'test'},
type: 'collected-metadata'
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application/json":{"data":{"attributes":{"guid":"test0","subjects":"5fd228b7e64e1300aa99ee15","volume":"test"},"type":"collected-metadata"}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"application/json": @{ @"data": @{ @"attributes": @{ @"guid": @"test0", @"subjects": @"5fd228b7e64e1300aa99ee15", @"volume": @"test" }, @"type": @"collected-metadata" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'application/json' => [
'data' => [
'attributes' => [
'guid' => 'test0',
'subjects' => '5fd228b7e64e1300aa99ee15',
'volume' => 'test'
],
'type' => 'collected-metadata'
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id', [
'body' => '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'application/json' => [
'data' => [
'attributes' => [
'guid' => 'test0',
'subjects' => '5fd228b7e64e1300aa99ee15',
'volume' => 'test'
],
'type' => 'collected-metadata'
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'application/json' => [
'data' => [
'attributes' => [
'guid' => 'test0',
'subjects' => '5fd228b7e64e1300aa99ee15',
'volume' => 'test'
],
'type' => 'collected-metadata'
]
]
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/:collection_id/collected_metadata/:cgm_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
payload = { "application/json": { "data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
} } }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
payload <- "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/:collection_id/collected_metadata/:cgm_id') do |req|
req.body = "{\n \"application/json\": {\n \"data\": {\n \"attributes\": {\n \"guid\": \"test0\",\n \"subjects\": \"5fd228b7e64e1300aa99ee15\",\n \"volume\": \"test\"\n },\n \"type\": \"collected-metadata\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id";
let payload = json!({"application/json": json!({"data": json!({
"attributes": json!({
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
}),
"type": "collected-metadata"
})})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id \
--header 'content-type: application/json' \
--data '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}'
echo '{
"application/json": {
"data": {
"attributes": {
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
},
"type": "collected-metadata"
}
}
}' | \
http POST {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "application/json": {\n "data": {\n "attributes": {\n "guid": "test0",\n "subjects": "5fd228b7e64e1300aa99ee15",\n "volume": "test"\n },\n "type": "collected-metadata"\n }\n }\n}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["application/json": ["data": [
"attributes": [
"guid": "test0",
"subjects": "5fd228b7e64e1300aa99ee15",
"volume": "test"
],
"type": "collected-metadata"
]]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a Collection
{{baseUrl}}/collections/
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/collections/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/collections/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/collections/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/collections/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
null
DELETE
Delete Collection Metadata from entitiy
{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
QUERY PARAMS
collection_id
cgm_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/collections/:collection_id/collected_metadata/:cgm_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/:cgm_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/collections/:collection_id/collected_metadata/:cgm_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/collections/:collection_id/collected_metadata/:cgm_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
http DELETE {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete a Collection
{{baseUrl}}/collections/:collection_id/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/collections/:collection_id/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/collections/:collection_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/collections/:collection_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/collections/:collection_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/collections/:collection_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/collections/:collection_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/collections/:collection_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/collections/:collection_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/collections/:collection_id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/collections/:collection_id/
http DELETE {{baseUrl}}/collections/:collection_id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/collections/:collection_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Give a Sparse List of Node Ids
{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/linked_nodes/relationships/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_nodes/relationships/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/linked_nodes/relationships/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/linked_nodes/relationships/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
http GET {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"id": "guid0",
"type": "nodes"
},
{
"id": "newid",
"type": "nodes"
},
{
"id": "test2",
"type": "nodes"
},
{
"id": "guid4",
"type": "nodes"
}
],
"links": {
"html": "https://api.osf.io/v2/collections/dse23/linked_nodes/",
"self": "https://api.osf.io/v2/collections/dse23/relationships/linked_nodes/"
},
"meta": {
"version": "2.20"
}
}
GET
Give a Sparse List of Registrations Ids
{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/linked_registrations/relationships/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_registrations/relationships/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/linked_registrations/relationships/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/linked_registrations/relationships/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
http GET {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"id": "guid0",
"type": "registrations"
},
{
"id": "newid",
"type": "registrations"
},
{
"id": "test2",
"type": "registrations"
},
{
"id": "guid4",
"type": "registrations"
}
],
"links": {
"html": "https://api.osf.io/v2/collections/dse23/linked_registrations/",
"self": "https://api.osf.io/v2/collections/dse23/relationships/linked_registrations/"
},
"meta": {
"version": "2.20"
}
}
POST
Link Nodes to Collection
{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
QUERY PARAMS
collection_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/:collection_id/linked_nodes/relationships/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_nodes/relationships/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/:collection_id/linked_nodes/relationships/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/:collection_id/linked_nodes/relationships/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
null
POST
Link Registrations to Collection
{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
QUERY PARAMS
collection_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/:collection_id/linked_registrations/relationships/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_registrations/relationships/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/:collection_id/linked_registrations/relationships/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/:collection_id/linked_registrations/relationships/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
null
GET
List All Linked Nodes for a Collection
{{baseUrl}}/collections/:collection_id/linked_nodes
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_nodes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/linked_nodes")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_nodes"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_nodes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_nodes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_nodes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/linked_nodes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/linked_nodes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_nodes"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/linked_nodes")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/linked_nodes');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_nodes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_nodes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/linked_nodes');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_nodes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_nodes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_nodes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/linked_nodes');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_nodes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_nodes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/linked_nodes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_nodes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_nodes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_nodes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/linked_nodes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_nodes";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/linked_nodes
http GET {{baseUrl}}/collections/:collection_id/linked_nodes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_nodes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_nodes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"analytics_key": "c438e67a7680113ee310cad8121e520bab632f3df95d443a4fadb0cbf3af890acc0d91ab6499297ec622bb827979c6005f13a80b3eddcf87a081667e6b2ac3da6eff414dc659b19e3a473f8bf7ef295bff3c036c955c8313fa6ce1da1253e74592e0b399940ca9f099b36923df8c11622d0a1768ae53f79a6061da76007061207f299a0e507f1ff47baeb902f2c403f0",
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_is_contributor": false,
"current_user_is_contributor_or_group_member": false,
"current_user_permissions": [],
"custom_citation": null,
"date_created": "2020-05-11T17:57:58.725950Z",
"date_modified": "2020-11-20T14:31:59.946554Z",
"description": "A good Node description.",
"fork": false,
"node_license": {
"copyright_holders": [
"Test User"
],
"year": "2020"
},
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "A Good Node Title",
"wiki_enabled": true
},
"id": "2vewn",
"links": {
"html": "https://osf.io/2vewn/",
"self": "https://api.osf.io/v2/nodes/2vewn/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/institutions/",
"meta": {}
}
}
},
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/bibliographic_contributors/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/children/",
"meta": {}
}
}
},
"citation": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/comments/?filter%5Btarget%5D=2vewn",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/files/",
"meta": {}
}
}
},
"forked_from": {
"data": null
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/forks/",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/groups/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/identifiers/",
"meta": {}
}
}
},
"implicit_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/implicit_contributors/",
"meta": {}
}
}
},
"license": {
"data": {
"id": "563c1cf88c5e4a3877f9e965",
"type": "licenses"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e965/",
"meta": {}
}
}
},
"linked_by_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_by_nodes/",
"meta": {}
}
}
},
"linked_by_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_by_registrations/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/linked_nodes/",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_registrations/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/linked_registrations/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/logs/",
"meta": {}
}
}
},
"parent": {
"data": null
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/preprints/",
"meta": {}
}
}
},
"region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/registrations/",
"meta": {}
}
}
},
"root": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/settings/",
"meta": {}
}
}
},
"storage": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/storage/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/subjects/",
"meta": {}
}
}
},
"template_node": {
"data": null
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/collections/ux3nq/linked_nodes/"
},
"meta": {
"per_page": 10,
"total": 1,
"version": "2.20"
}
}
GET
List All Linked Preprints for a Collection
{{baseUrl}}/collections/:collection_id/linked_preprints/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_preprints/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/linked_preprints/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_preprints/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_preprints/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_preprints/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_preprints/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/linked_preprints/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/linked_preprints/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_preprints/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_preprints/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/linked_preprints/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/linked_preprints/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_preprints/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_preprints/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_preprints/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_preprints/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_preprints/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/linked_preprints/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_preprints/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_preprints/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_preprints/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_preprints/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/linked_preprints/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_preprints/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_preprints/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_preprints/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_preprints/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/linked_preprints/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_preprints/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_preprints/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_preprints/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/linked_preprints/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_preprints/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/linked_preprints/
http GET {{baseUrl}}/collections/:collection_id/linked_preprints/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_preprints/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_preprints/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"current_user_permissions": [],
"date_created": "2020-12-10T13:55:03.994648Z",
"date_last_transitioned": "2020-12-10T13:55:05.046084Z",
"date_modified": "2020-12-10T13:55:05.252565Z",
"date_published": "2020-12-10T13:55:05.046084Z",
"date_withdrawn": null,
"description": "Research physical language morning consumer front population.",
"doi": "10.123/0",
"is_preprint_orphan": false,
"is_published": true,
"license_record": null,
"original_publication_date": null,
"preprint_doi_created": "2020-12-10T13:55:05.230155Z",
"public": true,
"reviews_state": "accepted",
"tags": [],
"title": "A Good Preprint Title"
},
"id": "zjxhs",
"links": {
"doi": "https://doi.org/10.123/0",
"html": "https://osf.io/preprints/slug1/zjxhs/",
"preprint_doi": "https://doi.org/None/FK2osf.io/zjxhs",
"self": "https://api.osf.io/v2/preprints/zjxhs/"
},
"relationships": {
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/bibliographic_contributors/",
"meta": {}
}
}
},
"citation": {
"data": {
"id": "zjxhs",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/citation/",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/files/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/identifiers/",
"meta": {}
}
}
},
"license": {
"data": null
},
"node": {
"links": {
"self": {
"href": "https://api.osf.io/v2/preprints/zjxhs/relationships/node/",
"meta": {}
}
}
},
"primary_file": {
"data": {
"id": "5fd228b8e64e1300aa99ee17",
"type": "files"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/files/5fd228b8e64e1300aa99ee17/",
"meta": {}
}
}
},
"provider": {
"data": {
"id": "slug1",
"type": "preprint-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/preprints/slug1/",
"meta": {}
}
}
},
"requests": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/requests/",
"meta": {}
}
}
},
"review_actions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/review_actions/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/zjxhs/subjects/",
"meta": {}
}
}
}
},
"type": "preprints"
}
]
}
RESPONSE HEADERS
Content-Type
links
RESPONSE BODY text
{
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/collections/nywr6/linked_preprints/"
}
RESPONSE HEADERS
Content-Type
meta
RESPONSE BODY text
{
"per_page": 10,
"total": 1,
"version": "2.20"
}
GET
List All Linked Registrations for a Collection
{{baseUrl}}/collections/:collection_id/linked_registrations/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/linked_registrations/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/linked_registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/linked_registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/linked_registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/linked_registrations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/linked_registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/linked_registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/linked_registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/linked_registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/linked_registrations/
http GET {{baseUrl}}/collections/:collection_id/linked_registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"access_requests_enabled": false,
"analytics_key": null,
"archiving": false,
"article_doi": null,
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_is_contributor": false,
"current_user_is_contributor_or_group_member": false,
"current_user_permissions": [],
"custom_citation": "",
"date_created": "2020-12-10T14:36:42.195364Z",
"date_modified": "2020-12-10T14:36:39.925278Z",
"date_registered": "2020-12-10T14:36:42.166193Z",
"date_withdrawn": null,
"description": "Half believe though on significant.",
"embargo_end_date": null,
"embargoed": false,
"fork": false,
"node_license": null,
"pending_embargo_approval": false,
"pending_embargo_termination_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": true,
"registered_meta": {},
"registration": true,
"registration_responses": {
"summary": ""
},
"registration_supplement": "Open-Ended Registration",
"reviews_state": "initial",
"tags": [],
"title": "A Good Registration Title",
"wiki_enabled": true,
"withdrawal_justification": null,
"withdrawn": false
},
"id": "qrwhu",
"links": {
"html": "https://osf.io/qrwhu/",
"self": "https://api.osf.io/v2/registrations/qrwhu/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/qrwhu/relationships/institutions/",
"meta": {}
}
}
},
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/bibliographic_contributors/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/children/",
"meta": {}
}
}
},
"citation": {
"data": {
"id": "qrwhu",
"type": "registrations"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/comments/?filter%5Btarget%5D=qrwhu",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/files/",
"meta": {}
}
}
},
"forked_from": {
"data": null
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/identifiers/",
"meta": {}
}
}
},
"implicit_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/implicit_contributors/",
"meta": {}
}
}
},
"license": {
"data": null
},
"linked_by_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/linked_by_nodes/",
"meta": {}
}
}
},
"linked_by_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/linked_by_registrations/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/qrwhu/relationships/linked_nodes/",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/linked_registrations/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/qrwhu/relationships/linked_registrations/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/logs/",
"meta": {}
}
}
},
"parent": {
"data": null
},
"provider": {
"data": {
"id": "osf",
"type": "registration-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/registrations/osf/",
"meta": {}
}
}
},
"region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"registered_by": {
"data": {
"id": "9hr6c",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/9hr6c/",
"meta": {}
}
}
},
"registered_from": {
"data": {
"id": "4gnbx",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/4gnbx/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "5fa1bb678ccd39001e96c32b",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/5fa1bb678ccd39001e96c32b/",
"meta": {}
}
}
},
"requests": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/requests/",
"meta": {}
}
}
},
"review_actions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/actions/",
"meta": {}
}
}
},
"root": {
"data": {
"id": "qrwhu",
"type": "registrations"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/",
"meta": {}
}
}
},
"storage": {
"data": {
"id": "qrwhu",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qrwhu/storage/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/qrwhu/relationships/subjects/",
"meta": {}
}
}
},
"template_node": {
"data": null
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/qrwhu/wikis/",
"meta": {}
}
}
}
},
"type": "registrations"
}
]
}
RESPONSE HEADERS
Content-Type
links
RESPONSE BODY text
{
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/collections/nywr6/linked_registrations/"
}
RESPONSE HEADERS
Content-Type
meta
RESPONSE BODY text
{
"per_page": 10,
"total": 1,
"version": "2.20"
}
GET
List all Collections
{{baseUrl}}/collections/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/")
require "http/client"
url = "{{baseUrl}}/collections/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/collections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/collections/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/collections/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/
http GET {{baseUrl}}/collections/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"bookmarks\"": false,
"collected_type_choices": [
"Research",
"Teaching",
"Community Activity",
"Meeting",
"Other"
],
"date_created": "2019-09-18T19:24:28.751486Z",
"date_modified": "2019-09-18T19:24:28.886438Z",
"is_promoted\"": true,
"is_public": true,
"issue_choices\"": [],
"program_area_choices": [],
"status_choices": [
"Proposed",
"Active",
"Completed",
"Archived"
],
"title": "Metascience's Collection",
"volume_choices": []
},
"links": {
"self": "https://api.osf.io/v2/collections/"
},
"relationships": {
"collected_metadata": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/collected_metadata/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ezcuj/relationships/linked_nodes/",
"meta": {}
}
}
},
"linked_preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/linked_preprints/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ezcuj/relationships/linked_preprints/",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/linked_registrations/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ezcuj/relationships/linked_registrations/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/node_links/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/collections/metascience/",
"meta": {}
}
}
}
}
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/collections/?page=2",
"next": "https://api.osf.io/v2/collections/?page=2",
"prev": null,
"self": "https://api.osf.io/v2/collections/"
},
"meta": {
"per_page": 10,
"total": 11,
"version": 2.2
}
}
DELETE
Remove Nodes From Collection
{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
QUERY PARAMS
collection_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.delete url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/");
var request = new RestRequest("", Method.Delete);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/collections/:collection_id/linked_nodes/relationships/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"))
.header("content-type", "application/json")
.method("DELETE", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.delete(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/';
const options = {method: 'DELETE', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
method: 'DELETE',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
.delete(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_nodes/relationships/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/';
const options = {method: 'DELETE', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/');
$request->setRequestMethod('DELETE');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("DELETE", "/baseUrl/collections/:collection_id/linked_nodes/relationships/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/"
payload <- "{}"
encode <- "json"
response <- VERB("DELETE", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.delete('/baseUrl/collections/:collection_id/linked_nodes/relationships/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http DELETE {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/ \
content-type:application/json
wget --quiet \
--method DELETE \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_nodes/relationships/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_nodes/relationships/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
null
DELETE
Remove Registrations From Collection
{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
QUERY PARAMS
collection_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.delete url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/");
var request = new RestRequest("", Method.Delete);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/collections/:collection_id/linked_registrations/relationships/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"))
.header("content-type", "application/json")
.method("DELETE", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.delete(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/';
const options = {method: 'DELETE', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
method: 'DELETE',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
.delete(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/linked_registrations/relationships/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/';
const options = {method: 'DELETE', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/');
$request->setRequestMethod('DELETE');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("DELETE", "/baseUrl/collections/:collection_id/linked_registrations/relationships/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/"
payload <- "{}"
encode <- "json"
response <- VERB("DELETE", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.delete('/baseUrl/collections/:collection_id/linked_registrations/relationships/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http DELETE {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/ \
content-type:application/json
wget --quiet \
--method DELETE \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/linked_registrations/relationships/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/linked_registrations/relationships/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
null
GET
Retrieve Specific Metadata for a Collection
{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
QUERY PARAMS
collection_id
cgm_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/collected_metadata/:cgm_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/:cgm_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/collected_metadata/:cgm_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/collected_metadata/:cgm_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
http GET {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
data
RESPONSE BODY text
{
"attributes": {
"collected_type": "Action Research",
"issue": "",
"program_area": "Child Welfare",
"status": "",
"volume": ""
},
"embeds": {
"guid": {
"data": {
"attributes": {
"analytics_key": "",
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_is_contributor": false,
"current_user_is_contributor_or_group_member": false,
"current_user_permissions": [],
"custom_citation": null,
"date_created": "2020-06-05T18:02:28.254638Z",
"date_modified": "2020-10-21T15:47:17.646448Z",
"description": "flaksdjfasdlkfj lkjdf aslkdfj sdlfkj",
"fork": false,
"node_license": {
"copyright_holders": [],
"year": null
},
"preprint": false,
"public": false,
"registration": false,
"tags": [],
"title": "test",
"wiki_enabled": true
},
"id": "zw4sh",
"links": {
"html": "https://osf.io/zw4sh/",
"self": "https://api.osf.io/v2/nodes/zw4sh/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/zw4sh/relationships/institutions/",
"meta": {}
}
}
},
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/bibliographic_contributors/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/children/",
"meta": {}
}
}
},
"citation": {
"data": {
"id": "zw4sh",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/comments/?filter%5Btarget%5D=zw4sh",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/files/",
"meta": {}
}
}
},
"forked_from": {
"data": null
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/forks/",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/groups/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/identifiers/",
"meta": {}
}
}
},
"implicit_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/implicit_contributors/",
"meta": {}
}
}
},
"license": {
"data": {
"id": "563c1cf88c5e4a3877f9e96a",
"type": "licenses"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"linked_by_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/linked_by_nodes/",
"meta": {}
}
}
},
"linked_by_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/linked_by_registrations/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/zw4sh/relationships/linked_nodes/",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/linked_registrations/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/zw4sh/relationships/linked_registrations/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/logs/",
"meta": {}
}
}
},
"parent": {
"data": null
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/preprints/",
"meta": {}
}
}
},
"region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/registrations/",
"meta": {}
}
}
},
"root": {
"data": {
"id": "zw4sh",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "zw4sh",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/settings/",
"meta": {}
}
}
},
"storage": {
"data": {
"id": "zw4sh",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/storage/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/zw4sh/relationships/subjects/",
"meta": {}
}
}
},
"template_node": {
"data": null
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/zw4sh/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
}
},
"id": "zw4sh",
"links": {},
"relationships": {
"collection": {
"data": {
"id": "ux3nq",
"type": "collections"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ux3nq/",
"meta": {}
}
}
},
"creator": {
"data": {
"id": "nsx26",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/nsx26/",
"meta": {}
}
}
},
"guid": {
"links": {
"related": {
"href": "https://api.osf.io/v2/guids/zw4sh/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ux3nq/collected_metadata/zw4sh/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ux3nq/collected_metadata/zw4sh/relationships/subjects/",
"meta": {}
}
}
}
},
"type": "collected-metadata"
}
RESPONSE HEADERS
Content-Type
meta
RESPONSE BODY text
{
"version": "2.20"
}
GET
Retrieve a Collection
{{baseUrl}}/collections/:collection_id/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/collections/:collection_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/collections/:collection_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/collections/:collection_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/
http GET {{baseUrl}}/collections/:collection_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bookmarks\"": false,
"collected_type_choices": [
"Research",
"Teaching",
"Community Activity",
"Meeting",
"Other"
],
"date_created": "2019-09-18T19:24:28.751486Z",
"date_modified": "2019-09-18T19:24:28.886438Z",
"is_promoted\"": true,
"is_public": true,
"issue_choices\"": [],
"program_area_choices": [],
"status_choices": [
"Proposed",
"Active",
"Completed",
"Archived"
],
"title": "Metascience's Collection",
"volume_choices": []
},
"links": {
"self": "https://api.osf.io/v2/collections/"
},
"relationships": {
"collected_metadata": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/collected_metadata/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ezcuj/relationships/linked_nodes/",
"meta": {}
}
}
},
"linked_preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/linked_preprints/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ezcuj/relationships/linked_preprints/",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/linked_registrations/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/collections/ezcuj/relationships/linked_registrations/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ezcuj/node_links/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/collections/metascience/",
"meta": {}
}
}
}
}
},
"meta": {
"version": 2.2
},
"type": "collections"
}
GET
Retrieve a list of collected metadata for a collection
{{baseUrl}}/collections/:collection_id/collected_metadata/
QUERY PARAMS
collection_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/collected_metadata/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/collected_metadata/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/collected_metadata/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/collected_metadata/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/collected_metadata/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/collected_metadata/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/
http GET {{baseUrl}}/collections/:collection_id/collected_metadata/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"collected_type": "Document Analysis",
"issue": "",
"program_area": "N/A",
"status": "",
"subjects": [],
"volume": ""
},
"embeds": {
"guid": {
"data": {
"attributes": {
"access_requests_enabled": true,
"analytics_key": "c438e67a7680113ee310cad8121e520bab632f3df95d443a4fadb0cbf3af890acc0d91ab6499297ec622bb827979c6005f13a80b3eddcf87a081667e6b2ac3da6eff414dc659b19e3a473f8bf7ef295bff3c036c955c8313fa6ce1da1253e74592e0b399940ca9f099b36923df8c11622d0a1768ae53f79a6061da76007061207f299a0e507f1ff47baeb902f2c403f0",
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_is_contributor": false,
"current_user_is_contributor_or_group_member": false,
"current_user_permissions": [
"read"
],
"custom_citation": null,
"date_created": "2020-05-11T17:57:58.725950",
"date_modified": "2020-11-20T14:31:59.946554",
"description": "A Good Node Description",
"fork": false,
"node_license": {
"copyright_holders": [
"Test User"
],
"year": "2020"
},
"preprint": false,
"public": true,
"registration": false,
"subjects": [],
"tags": [],
"title": "A Good Node Title",
"wiki_enabled": true
},
"id": "2vewn",
"links": {
"html": "https://osf.io/2vewn/",
"self": "https://api.osf.io/v2/nodes/2vewn/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/institutions/?format=json",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/institutions/?format=json",
"meta": {}
}
}
},
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/bibliographic_contributors/?format=json",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/children/?format=json",
"meta": {}
}
}
},
"citation": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/citation/?format=json",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/comments/?format=json&filter%5Btarget%5D=2vewn",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/contributors/?format=json",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/draft_registrations/?format=json",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/files/?format=json",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/forks/?format=json",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/groups/?format=json",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/identifiers/?format=json",
"meta": {}
}
}
},
"implicit_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/implicit_contributors/?format=json",
"meta": {}
}
}
},
"license": {
"data": {
"id": "563c1cf88c5e4a3877f9e965",
"type": "licenses"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e965/?format=json",
"meta": {}
}
}
},
"linked_by_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_by_nodes/?format=json",
"meta": {}
}
}
},
"linked_by_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_by_registrations/?format=json",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_nodes/?format=json",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/linked_nodes/?format=json",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/linked_registrations/?format=json",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/2vewn/relationships/linked_registrations/?format=json",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/logs/?format=json",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/node_links/?format=json",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/preprints/?format=json",
"meta": {}
}
}
},
"region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/?format=json",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/registrations/?format=json",
"meta": {}
}
}
},
"root": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/?format=json",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/settings/?format=json",
"meta": {}
}
}
},
"storage": {
"data": {
"id": "2vewn",
"type": "nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/storage/?format=json",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/view_only_links/?format=json",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/2vewn/wikis/?format=json",
"meta": {}
}
}
}
},
"type": "nodes"
}
}
},
"id": "2vewn",
"links": {},
"relationships": {
"collection": {
"data": {
"id": "ux3nq",
"type": "collections"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/collections/ux3nq/?format=json",
"meta": {}
}
}
},
"creator": {
"data": {
"id": "794j8",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/794j8/?format=json",
"meta": {}
}
}
},
"guid": {
"links": {
"related": {
"href": "https://api.osf.io/v2/guids/2vewn/?format=json",
"meta": {}
}
}
}
},
"type": "collected-metadata"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
Retrieve subject data for a specific piece of metadata info for a collection
{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/
QUERY PARAMS
collection_id
cgm_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/collected_metadata/:cgm_id/subjects/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/subjects/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/subjects/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/
http GET {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/subjects/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"taxonomy_name": "",
"text": "Example Subject #0"
},
"embeds": {
"parent": {
"errors": [
{
"detail": "Not found."
}
]
}
},
"id": "5fd228b7e64e1300aa99ee15",
"links": {
"self": "https://api.osf.io/v2/subjects/5fd228b7e64e1300aa99ee15/"
},
"relationships": {
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/subjects/5fd228b7e64e1300aa99ee15/children/",
"meta": {}
}
}
},
"parent": {
"data": null
}
},
"type": "subjects"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/collections/nywr6/collected_metadata/zjxhs/subjects/"
},
"meta": {
"per_page": 10,
"total": 1,
"version": "2.20"
}
}
GET
Retrieve subject metadata for a specific piece of metadata in a collection
{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/
QUERY PARAMS
collection_id
cgm_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/
http GET {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
],
"links": {
"html": "https://api.osf.io/v2/collections/nywr6/collected_metadata/zjxhs/subjects/",
"self": "https://api.osf.io/v2/collections/nywr6/collected_metadata/zjxhs/relationships/subjects/"
},
"meta": {
"version": "2.20"
}
}
POST
Update subjects for a specific piece of metadata in a collection
{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/
QUERY PARAMS
collection_id
cgm_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/" {:content-type :json
:form-params {:application/json {:data {:id "5fd228b7e64e1300aa99ee15"
:type "subjects"}}}})
require "http/client"
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"),
Content = new StringContent("{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
payload := strings.NewReader("{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 116
{
"application/json": {
"data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.setHeader("content-type", "application/json")
.setBody("{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.header("content-type", "application/json")
.body("{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}")
.asString();
const data = JSON.stringify({
'application/json': {
data: {
id: '5fd228b7e64e1300aa99ee15',
type: 'subjects'
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
headers: {'content-type': 'application/json'},
data: {'application/json': {data: {id: '5fd228b7e64e1300aa99ee15', type: 'subjects'}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application/json":{"data":{"id":"5fd228b7e64e1300aa99ee15","type":"subjects"}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "application/json": {\n "data": {\n "id": "5fd228b7e64e1300aa99ee15",\n "type": "subjects"\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({'application/json': {data: {id: '5fd228b7e64e1300aa99ee15', type: 'subjects'}}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
headers: {'content-type': 'application/json'},
body: {'application/json': {data: {id: '5fd228b7e64e1300aa99ee15', type: 'subjects'}}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
'application/json': {
data: {
id: '5fd228b7e64e1300aa99ee15',
type: 'subjects'
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/',
headers: {'content-type': 'application/json'},
data: {'application/json': {data: {id: '5fd228b7e64e1300aa99ee15', type: 'subjects'}}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application/json":{"data":{"id":"5fd228b7e64e1300aa99ee15","type":"subjects"}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"application/json": @{ @"data": @{ @"id": @"5fd228b7e64e1300aa99ee15", @"type": @"subjects" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'application/json' => [
'data' => [
'id' => '5fd228b7e64e1300aa99ee15',
'type' => 'subjects'
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/', [
'body' => '{
"application/json": {
"data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'application/json' => [
'data' => [
'id' => '5fd228b7e64e1300aa99ee15',
'type' => 'subjects'
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'application/json' => [
'data' => [
'id' => '5fd228b7e64e1300aa99ee15',
'type' => 'subjects'
]
]
]));
$request->setRequestUrl('{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application/json": {
"data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application/json": {
"data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
payload = { "application/json": { "data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
} } }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/"
payload <- "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/') do |req|
req.body = "{\n \"application/json\": {\n \"data\": {\n \"id\": \"5fd228b7e64e1300aa99ee15\",\n \"type\": \"subjects\"\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/";
let payload = json!({"application/json": json!({"data": json!({
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
})})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/ \
--header 'content-type: application/json' \
--data '{
"application/json": {
"data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
}
}'
echo '{
"application/json": {
"data": {
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
}
}
}' | \
http POST {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "application/json": {\n "data": {\n "id": "5fd228b7e64e1300aa99ee15",\n "type": "subjects"\n }\n }\n}' \
--output-document \
- {{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["application/json": ["data": [
"id": "5fd228b7e64e1300aa99ee15",
"type": "subjects"
]]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/collections/:collection_id/collected_metadata/:cgm_id/relationships/subjects/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete a comment
{{baseUrl}}/comments/:comment_id/
QUERY PARAMS
comment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/comments/:comment_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/comments/:comment_id/")
require "http/client"
url = "{{baseUrl}}/comments/:comment_id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/comments/:comment_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/comments/:comment_id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/comments/:comment_id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/comments/:comment_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/comments/:comment_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/comments/:comment_id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/comments/:comment_id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/comments/:comment_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/comments/:comment_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/comments/:comment_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/comments/:comment_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/comments/:comment_id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/comments/:comment_id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/comments/:comment_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/comments/:comment_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/comments/:comment_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/comments/:comment_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/comments/:comment_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/comments/:comment_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/comments/:comment_id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/comments/:comment_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/comments/:comment_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/comments/:comment_id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/comments/:comment_id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/comments/:comment_id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/comments/:comment_id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/comments/:comment_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/comments/:comment_id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/comments/:comment_id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/comments/:comment_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/comments/:comment_id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/comments/:comment_id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/comments/:comment_id/
http DELETE {{baseUrl}}/comments/:comment_id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/comments/:comment_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/comments/:comment_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Retrieve a comment
{{baseUrl}}/comments/:comment_id/
QUERY PARAMS
comment_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/comments/:comment_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/comments/:comment_id/")
require "http/client"
url = "{{baseUrl}}/comments/:comment_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/comments/:comment_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/comments/:comment_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/comments/:comment_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/comments/:comment_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/comments/:comment_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/comments/:comment_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/comments/:comment_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/comments/:comment_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/comments/:comment_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/comments/:comment_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/comments/:comment_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/comments/:comment_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/comments/:comment_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/comments/:comment_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/comments/:comment_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/comments/:comment_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/comments/:comment_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/comments/:comment_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/comments/:comment_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/comments/:comment_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/comments/:comment_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/comments/:comment_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/comments/:comment_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/comments/:comment_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/comments/:comment_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/comments/:comment_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/comments/:comment_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/comments/:comment_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/comments/:comment_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/comments/:comment_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/comments/:comment_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/comments/:comment_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/comments/:comment_id/
http GET {{baseUrl}}/comments/:comment_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/comments/:comment_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/comments/:comment_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"can_edit": true,
"content": "comments about things",
"date_created": "2017-02-10T20:44:03.185000",
"date_modified": "2017-02-10T20:44:03.193000",
"deleted": false,
"has_children": false,
"has_report": false,
"is_abuse": false,
"is_ham": false,
"modified": false,
"page": "node"
},
"id": "twpgrpv78d8s",
"links": {
"self": "https://api.osf.io/v2/comments/twpgrpv78d8s/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/gvuew/",
"meta": {}
}
}
},
"replies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/gvuew/comments/?filter%5Btarget%5D=twpgrpv78d8s",
"meta": {}
}
}
},
"reports": {
"links": {
"related": {
"href": "https://api.osf.io/v2/comments/twpgrpv78d8s/reports/",
"meta": {}
}
}
},
"target": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/gvuew/",
"meta": {
"type": "nodes"
}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/rnizy/",
"meta": {}
}
}
}
},
"type": "comments"
}
}
PUT
Update a comment
{{baseUrl}}/comments/:comment_id/
QUERY PARAMS
comment_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/comments/:comment_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/comments/:comment_id/" {:content-type :json
:form-params {:data {:attributes {:content "changed comment content"}
:id "{comment_id}"
:type "comments"}}})
require "http/client"
url = "{{baseUrl}}/comments/:comment_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/comments/:comment_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/comments/:comment_id/");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/comments/:comment_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/comments/:comment_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 138
{
"data": {
"attributes": {
"content": "changed comment content"
},
"id": "{comment_id}",
"type": "comments"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/comments/:comment_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/comments/:comment_id/"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/comments/:comment_id/")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/comments/:comment_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
content: 'changed comment content'
},
id: '{comment_id}',
type: 'comments'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/comments/:comment_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/comments/:comment_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {content: 'changed comment content'},
id: '{comment_id}',
type: 'comments'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/comments/:comment_id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"content":"changed comment content"},"id":"{comment_id}","type":"comments"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/comments/:comment_id/',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "content": "changed comment content"\n },\n "id": "{comment_id}",\n "type": "comments"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/comments/:comment_id/")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/comments/:comment_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {content: 'changed comment content'},
id: '{comment_id}',
type: 'comments'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/comments/:comment_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {content: 'changed comment content'},
id: '{comment_id}',
type: 'comments'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/comments/:comment_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
content: 'changed comment content'
},
id: '{comment_id}',
type: 'comments'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/comments/:comment_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {content: 'changed comment content'},
id: '{comment_id}',
type: 'comments'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/comments/:comment_id/';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"content":"changed comment content"},"id":"{comment_id}","type":"comments"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"content": @"changed comment content" }, @"id": @"{comment_id}", @"type": @"comments" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/comments/:comment_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/comments/:comment_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/comments/:comment_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'content' => 'changed comment content'
],
'id' => '{comment_id}',
'type' => 'comments'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/comments/:comment_id/', [
'body' => '{
"data": {
"attributes": {
"content": "changed comment content"
},
"id": "{comment_id}",
"type": "comments"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/comments/:comment_id/');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'content' => 'changed comment content'
],
'id' => '{comment_id}',
'type' => 'comments'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'content' => 'changed comment content'
],
'id' => '{comment_id}',
'type' => 'comments'
]
]));
$request->setRequestUrl('{{baseUrl}}/comments/:comment_id/');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/comments/:comment_id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"content": "changed comment content"
},
"id": "{comment_id}",
"type": "comments"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/comments/:comment_id/' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"content": "changed comment content"
},
"id": "{comment_id}",
"type": "comments"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/comments/:comment_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/comments/:comment_id/"
payload = { "data": {
"attributes": { "content": "changed comment content" },
"id": "{comment_id}",
"type": "comments"
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/comments/:comment_id/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/comments/:comment_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/comments/:comment_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"changed comment content\"\n },\n \"id\": \"{comment_id}\",\n \"type\": \"comments\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/comments/:comment_id/";
let payload = json!({"data": json!({
"attributes": json!({"content": "changed comment content"}),
"id": "{comment_id}",
"type": "comments"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/comments/:comment_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"content": "changed comment content"
},
"id": "{comment_id}",
"type": "comments"
}
}'
echo '{
"data": {
"attributes": {
"content": "changed comment content"
},
"id": "{comment_id}",
"type": "comments"
}
}' | \
http PUT {{baseUrl}}/comments/:comment_id/ \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "content": "changed comment content"\n },\n "id": "{comment_id}",\n "type": "comments"\n }\n}' \
--output-document \
- {{baseUrl}}/comments/:comment_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": ["content": "changed comment content"],
"id": "{comment_id}",
"type": "comments"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/comments/:comment_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Add a contributor to a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/contributors/
QUERY PARAMS
draft_id
BODY json
{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/contributors/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/draft_registrations/:draft_id/contributors/" {:content-type :json
:form-params {:attributes {:bibliographic false
:index 0
:permission ""
:unregistered_contributor ""}
:id ""
:links {:self ""}
:relationships {:node ""
:user ""}
:type ""}})
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/contributors/"),
Content = new StringContent("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/contributors/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
payload := strings.NewReader("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/draft_registrations/:draft_id/contributors/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 242
{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.setHeader("content-type", "application/json")
.setBody("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/contributors/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.header("content-type", "application/json")
.body("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
attributes: {
bibliographic: false,
index: 0,
permission: '',
unregistered_contributor: ''
},
id: '',
links: {
self: ''
},
relationships: {
node: '',
user: ''
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/draft_registrations/:draft_id/contributors/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/',
headers: {'content-type': 'application/json'},
data: {
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/contributors/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"bibliographic":false,"index":0,"permission":"","unregistered_contributor":""},"id":"","links":{"self":""},"relationships":{"node":"","user":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attributes": {\n "bibliographic": false,\n "index": 0,\n "permission": "",\n "unregistered_contributor": ""\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "node": "",\n "user": ""\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/contributors/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/',
headers: {'content-type': 'application/json'},
body: {
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/draft_registrations/:draft_id/contributors/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attributes: {
bibliographic: false,
index: 0,
permission: '',
unregistered_contributor: ''
},
id: '',
links: {
self: ''
},
relationships: {
node: '',
user: ''
},
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/',
headers: {'content-type': 'application/json'},
data: {
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/contributors/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"bibliographic":false,"index":0,"permission":"","unregistered_contributor":""},"id":"","links":{"self":""},"relationships":{"node":"","user":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"attributes": @{ @"bibliographic": @NO, @"index": @0, @"permission": @"", @"unregistered_contributor": @"" },
@"id": @"",
@"links": @{ @"self": @"" },
@"relationships": @{ @"node": @"", @"user": @"" },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/contributors/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
'bibliographic' => null,
'index' => 0,
'permission' => '',
'unregistered_contributor' => ''
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'node' => '',
'user' => ''
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/draft_registrations/:draft_id/contributors/', [
'body' => '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/contributors/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attributes' => [
'bibliographic' => null,
'index' => 0,
'permission' => '',
'unregistered_contributor' => ''
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'node' => '',
'user' => ''
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attributes' => [
'bibliographic' => null,
'index' => 0,
'permission' => '',
'unregistered_contributor' => ''
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'node' => '',
'user' => ''
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/contributors/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/contributors/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/contributors/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/draft_registrations/:draft_id/contributors/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
payload = {
"attributes": {
"bibliographic": False,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": { "self": "" },
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
payload <- "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/draft_registrations/:draft_id/contributors/') do |req|
req.body = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/";
let payload = json!({
"attributes": json!({
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
}),
"id": "",
"links": json!({"self": ""}),
"relationships": json!({
"node": "",
"user": ""
}),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/draft_registrations/:draft_id/contributors/ \
--header 'content-type: application/json' \
--data '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}'
echo '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}' | \
http POST {{baseUrl}}/draft_registrations/:draft_id/contributors/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "attributes": {\n "bibliographic": false,\n "index": 0,\n "permission": "",\n "unregistered_contributor": ""\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "node": "",\n "user": ""\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/contributors/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attributes": [
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
],
"id": "",
"links": ["self": ""],
"relationships": [
"node": "",
"user": ""
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bibliographic": true,
"index": 2,
"permission": "write",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2022-03-04T20:13:35.594990",
"education": [],
"employment": [],
"family_name": "Dominguez",
"full_name": "Paul Dominguez",
"given_name": "Paul",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "tmxzg",
"links": {
"html": "http://localhost:5000/tmxzg/",
"profile_image": "https://secure.gravatar.com/avatar/c16b8f65c6ac5dc8511fbffab8ef8918?d=identicon",
"self": "http://localhost:8000/v2/users/tmxzg/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "http://localhost:8000/v2/users/tmxzg/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "http://localhost:8000/v2/users/tmxzg/institutions/",
"meta": {}
},
"self": {
"href": "http://localhost:8000/v2/users/tmxzg/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://localhost:8000/v2/users/tmxzg/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "http://localhost:8000/v2/users/tmxzg/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "http://localhost:8000/v2/users/tmxzg/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "62718748d90ebe0012c38815-tmxzg",
"links": {
"self": "http://localhost:8000/v2/draft_registrations/62718748d90ebe0012c38815/contributors/tmxzg/"
},
"relationships": {
"draft_registration": {
"links": {
"related": {
"href": "http://localhost:8000/v2/draft_registrations/62718748d90ebe0012c38815/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "tmxzg",
"type": "users"
},
"links": {
"related": {
"href": "http://localhost:8000/v2/users/tmxzg/",
"meta": {}
}
}
}
},
"type": "contributors"
},
"meta": {
"version": "2.0"
}
}
POST
Create a Draft Registration
{{baseUrl}}/draft_registrations/
BODY json
{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/draft_registrations/" {:content-type :json
:form-params {:attributes {:category ""
:current_user_permissions []
:datetime_initiated ""
:datetime_updated ""
:description ""
:has_project false
:node_license {:copyright_holders []
:year 0}
:registration_metadata {}
:registration_responses {}
:tags []
:title ""}
:id ""
:links {:html ""}
:relationships {:branched_from ""
:initiator ""
:registration_schema ""}
:type ""}})
require "http/client"
url = "{{baseUrl}}/draft_registrations/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/"),
Content = new StringContent("{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/"
payload := strings.NewReader("{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/draft_registrations/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 524
{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/draft_registrations/")
.setHeader("content-type", "application/json")
.setBody("{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/draft_registrations/")
.header("content-type", "application/json")
.body("{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
attributes: {
category: '',
current_user_permissions: [],
datetime_initiated: '',
datetime_updated: '',
description: '',
has_project: false,
node_license: {
copyright_holders: [],
year: 0
},
registration_metadata: {},
registration_responses: {},
tags: [],
title: ''
},
id: '',
links: {
html: ''
},
relationships: {
branched_from: '',
initiator: '',
registration_schema: ''
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/draft_registrations/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/draft_registrations/',
headers: {'content-type': 'application/json'},
data: {
attributes: {
category: '',
current_user_permissions: [],
datetime_initiated: '',
datetime_updated: '',
description: '',
has_project: false,
node_license: {copyright_holders: [], year: 0},
registration_metadata: {},
registration_responses: {},
tags: [],
title: ''
},
id: '',
links: {html: ''},
relationships: {branched_from: '', initiator: '', registration_schema: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"category":"","current_user_permissions":[],"datetime_initiated":"","datetime_updated":"","description":"","has_project":false,"node_license":{"copyright_holders":[],"year":0},"registration_metadata":{},"registration_responses":{},"tags":[],"title":""},"id":"","links":{"html":""},"relationships":{"branched_from":"","initiator":"","registration_schema":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attributes": {\n "category": "",\n "current_user_permissions": [],\n "datetime_initiated": "",\n "datetime_updated": "",\n "description": "",\n "has_project": false,\n "node_license": {\n "copyright_holders": [],\n "year": 0\n },\n "registration_metadata": {},\n "registration_responses": {},\n "tags": [],\n "title": ""\n },\n "id": "",\n "links": {\n "html": ""\n },\n "relationships": {\n "branched_from": "",\n "initiator": "",\n "registration_schema": ""\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
attributes: {
category: '',
current_user_permissions: [],
datetime_initiated: '',
datetime_updated: '',
description: '',
has_project: false,
node_license: {copyright_holders: [], year: 0},
registration_metadata: {},
registration_responses: {},
tags: [],
title: ''
},
id: '',
links: {html: ''},
relationships: {branched_from: '', initiator: '', registration_schema: ''},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/draft_registrations/',
headers: {'content-type': 'application/json'},
body: {
attributes: {
category: '',
current_user_permissions: [],
datetime_initiated: '',
datetime_updated: '',
description: '',
has_project: false,
node_license: {copyright_holders: [], year: 0},
registration_metadata: {},
registration_responses: {},
tags: [],
title: ''
},
id: '',
links: {html: ''},
relationships: {branched_from: '', initiator: '', registration_schema: ''},
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/draft_registrations/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attributes: {
category: '',
current_user_permissions: [],
datetime_initiated: '',
datetime_updated: '',
description: '',
has_project: false,
node_license: {
copyright_holders: [],
year: 0
},
registration_metadata: {},
registration_responses: {},
tags: [],
title: ''
},
id: '',
links: {
html: ''
},
relationships: {
branched_from: '',
initiator: '',
registration_schema: ''
},
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/draft_registrations/',
headers: {'content-type': 'application/json'},
data: {
attributes: {
category: '',
current_user_permissions: [],
datetime_initiated: '',
datetime_updated: '',
description: '',
has_project: false,
node_license: {copyright_holders: [], year: 0},
registration_metadata: {},
registration_responses: {},
tags: [],
title: ''
},
id: '',
links: {html: ''},
relationships: {branched_from: '', initiator: '', registration_schema: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"category":"","current_user_permissions":[],"datetime_initiated":"","datetime_updated":"","description":"","has_project":false,"node_license":{"copyright_holders":[],"year":0},"registration_metadata":{},"registration_responses":{},"tags":[],"title":""},"id":"","links":{"html":""},"relationships":{"branched_from":"","initiator":"","registration_schema":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"attributes": @{ @"category": @"", @"current_user_permissions": @[ ], @"datetime_initiated": @"", @"datetime_updated": @"", @"description": @"", @"has_project": @NO, @"node_license": @{ @"copyright_holders": @[ ], @"year": @0 }, @"registration_metadata": @{ }, @"registration_responses": @{ }, @"tags": @[ ], @"title": @"" },
@"id": @"",
@"links": @{ @"html": @"" },
@"relationships": @{ @"branched_from": @"", @"initiator": @"", @"registration_schema": @"" },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
'category' => '',
'current_user_permissions' => [
],
'datetime_initiated' => '',
'datetime_updated' => '',
'description' => '',
'has_project' => null,
'node_license' => [
'copyright_holders' => [
],
'year' => 0
],
'registration_metadata' => [
],
'registration_responses' => [
],
'tags' => [
],
'title' => ''
],
'id' => '',
'links' => [
'html' => ''
],
'relationships' => [
'branched_from' => '',
'initiator' => '',
'registration_schema' => ''
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/draft_registrations/', [
'body' => '{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attributes' => [
'category' => '',
'current_user_permissions' => [
],
'datetime_initiated' => '',
'datetime_updated' => '',
'description' => '',
'has_project' => null,
'node_license' => [
'copyright_holders' => [
],
'year' => 0
],
'registration_metadata' => [
],
'registration_responses' => [
],
'tags' => [
],
'title' => ''
],
'id' => '',
'links' => [
'html' => ''
],
'relationships' => [
'branched_from' => '',
'initiator' => '',
'registration_schema' => ''
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attributes' => [
'category' => '',
'current_user_permissions' => [
],
'datetime_initiated' => '',
'datetime_updated' => '',
'description' => '',
'has_project' => null,
'node_license' => [
'copyright_holders' => [
],
'year' => 0
],
'registration_metadata' => [
],
'registration_responses' => [
],
'tags' => [
],
'title' => ''
],
'id' => '',
'links' => [
'html' => ''
],
'relationships' => [
'branched_from' => '',
'initiator' => '',
'registration_schema' => ''
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/draft_registrations/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/draft_registrations/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/"
payload = {
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": False,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": { "html": "" },
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/"
payload <- "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/draft_registrations/') do |req|
req.body = "{\n \"attributes\": {\n \"category\": \"\",\n \"current_user_permissions\": [],\n \"datetime_initiated\": \"\",\n \"datetime_updated\": \"\",\n \"description\": \"\",\n \"has_project\": false,\n \"node_license\": {\n \"copyright_holders\": [],\n \"year\": 0\n },\n \"registration_metadata\": {},\n \"registration_responses\": {},\n \"tags\": [],\n \"title\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"html\": \"\"\n },\n \"relationships\": {\n \"branched_from\": \"\",\n \"initiator\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/";
let payload = json!({
"attributes": json!({
"category": "",
"current_user_permissions": (),
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": json!({
"copyright_holders": (),
"year": 0
}),
"registration_metadata": json!({}),
"registration_responses": json!({}),
"tags": (),
"title": ""
}),
"id": "",
"links": json!({"html": ""}),
"relationships": json!({
"branched_from": "",
"initiator": "",
"registration_schema": ""
}),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/draft_registrations/ \
--header 'content-type: application/json' \
--data '{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}'
echo '{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}' | \
http POST {{baseUrl}}/draft_registrations/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "attributes": {\n "category": "",\n "current_user_permissions": [],\n "datetime_initiated": "",\n "datetime_updated": "",\n "description": "",\n "has_project": false,\n "node_license": {\n "copyright_holders": [],\n "year": 0\n },\n "registration_metadata": {},\n "registration_responses": {},\n "tags": [],\n "title": ""\n },\n "id": "",\n "links": {\n "html": ""\n },\n "relationships": {\n "branched_from": "",\n "initiator": "",\n "registration_schema": ""\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/draft_registrations/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attributes": [
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": [
"copyright_holders": [],
"year": 0
],
"registration_metadata": [],
"registration_responses": [],
"tags": [],
"title": ""
],
"id": "",
"links": ["html": ""],
"relationships": [
"branched_from": "",
"initiator": "",
"registration_schema": ""
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"category": "",
"datetime_initiated": "2022-05-03T17:03:50.288542",
"datetime_updated": "2022-05-03T17:03:50.560153",
"description": "",
"node_license": null,
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": "Untitled"
},
"id": "62716076d90ebe0017f2bf42",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/relationships/institutions/",
"meta": {}
}
}
},
"branched_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_nodes/nmj5w/",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/contributors/",
"meta": {}
}
}
},
"initiator": {
"data": {
"id": "fgvc6",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/",
"meta": {}
}
}
},
"provider": {
"data": {
"id": "osf",
"type": "registration-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/registrations/osf/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/61e02b6c90de34000ae3447a/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/relationships/subjects/",
"meta": {}
}
}
}
},
"type": "draft_registrations"
},
"meta": {
"version": "2.0"
}
}
DELETE
Delete a draft registration
{{baseUrl}}/draft_registrations/:draft_id/
QUERY PARAMS
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/draft_registrations/:draft_id/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/draft_registrations/:draft_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/draft_registrations/:draft_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/draft_registrations/:draft_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/draft_registrations/:draft_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/draft_registrations/:draft_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/draft_registrations/:draft_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/draft_registrations/:draft_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/draft_registrations/:draft_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/draft_registrations/:draft_id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/draft_registrations/:draft_id/
http DELETE {{baseUrl}}/draft_registrations/:draft_id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Retreive a Contributor from a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/
QUERY PARAMS
draft_id
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/draft_registrations/:draft_id/contributors/:user_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/contributors/:user_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/draft_registrations/:draft_id/contributors/:user_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/draft_registrations/:draft_id/contributors/:user_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/
http GET {{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/contributors/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"accepted_terms_of_service": true,
"active": true,
"can_view_reviews": [],
"date_registered": "2017-04-26T15:39:29.779518Z",
"education": [],
"employment": [],
"family_name": "Tordoff",
"full_name": "John Tordoff",
"given_name": "John",
"locale": "en_US",
"middle_names": "",
"social": {
"academiaInstitution": "",
"academiaProfileID": "",
"baiduScholar": "",
"github": [
"Johnetordoff"
],
"impactStory": "",
"linkedIn": [],
"orcid": "0000-0001-8693-9390",
"profileWebsites": [
"https://test.com"
],
"researchGate": "",
"researcherId": "",
"scholar": "",
"ssrn": "",
"twitter": []
},
"suffix": "",
"timezone": "America/New_York"
},
"id": "gyht4",
"links": {
"html": "https://osf.io/gyht4/",
"profile_image": "https://secure.gravatar.com/avatar/a61b3827662ddbc604c78e1c8f6a3636?d=identicon",
"self": "https://api.osf.io/v2/users/gyht4/"
},
"relationships": {
"default_region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"emails": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/settings/emails/",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/gyht4/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/registrations/",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "gyht4",
"type": "user-settings"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/settings/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "626170854968470203611e2c-gyht4",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/contributors/gyht4/"
},
"relationships": {
"draft_registration": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "gyht4",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/",
"meta": {}
}
}
}
},
"type": "contributors"
},
"meta": {
"version": "2.20"
}
}
GET
Retreive a list Contributors from a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/contributors/
QUERY PARAMS
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/contributors/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/draft_registrations/:draft_id/contributors/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/contributors/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/contributors/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/draft_registrations/:draft_id/contributors/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/contributors/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/draft_registrations/:draft_id/contributors/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/contributors/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/draft_registrations/:draft_id/contributors/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/contributors/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/draft_registrations/:draft_id/contributors/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/contributors/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/contributors/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/contributors/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/contributors/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/draft_registrations/:draft_id/contributors/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/contributors/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/draft_registrations/:draft_id/contributors/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/contributors/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/draft_registrations/:draft_id/contributors/
http GET {{baseUrl}}/draft_registrations/:draft_id/contributors/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/contributors/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"accepted_terms_of_service": true,
"active": true,
"can_view_reviews": [],
"date_registered": "2017-04-26T15:39:29.779518Z",
"education": [],
"employment": [],
"family_name": "Tordoff",
"full_name": "John Tordoff",
"given_name": "John",
"locale": "en_US",
"middle_names": "",
"social": {
"academiaInstitution": "",
"academiaProfileID": "",
"baiduScholar": "",
"github": [
"Johnetordoff"
],
"impactStory": "",
"linkedIn": [],
"orcid": "0000-0001-8693-9390",
"profileWebsites": [
"https://test.com"
],
"researchGate": "",
"researcherId": "",
"scholar": "",
"ssrn": "",
"twitter": []
},
"suffix": "",
"timezone": "America/New_York"
},
"id": "gyht4",
"links": {
"html": "https://osf.io/gyht4/",
"profile_image": "https://secure.gravatar.com/avatar/a61b3827662ddbc604c78e1c8f6a3636?d=identicon",
"self": "https://api.osf.io/v2/users/gyht4/"
},
"relationships": {
"default_region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"emails": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/settings/emails/",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/gyht4/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/registrations/",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "gyht4",
"type": "user-settings"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/settings/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "626170854968470203611e2c-gyht4",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/contributors/gyht4/"
},
"relationships": {
"draft_registration": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "gyht4",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/",
"meta": {}
}
}
}
},
"type": "contributors"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/contributors/"
},
"meta": {
"per_page": 10,
"total": 1,
"total_bibliographic": 1,
"version": "2.20"
}
}
GET
Retrieve Institutions afilliated with a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/institutions/
QUERY PARAMS
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/institutions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/draft_registrations/:draft_id/institutions/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/institutions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/institutions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/institutions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/institutions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/draft_registrations/:draft_id/institutions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/draft_registrations/:draft_id/institutions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/institutions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/institutions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/draft_registrations/:draft_id/institutions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/draft_registrations/:draft_id/institutions/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/institutions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/institutions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/institutions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/institutions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/institutions/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/draft_registrations/:draft_id/institutions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/institutions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/institutions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/institutions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/institutions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/draft_registrations/:draft_id/institutions/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/institutions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/institutions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/institutions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/institutions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/draft_registrations/:draft_id/institutions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/institutions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/institutions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/institutions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/draft_registrations/:draft_id/institutions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/institutions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/draft_registrations/:draft_id/institutions/
http GET {{baseUrl}}/draft_registrations/:draft_id/institutions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/institutions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/institutions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"assets": {
"logo": "/static/img/institutions/shields/lab-shield.png",
"logo_rounded": "/static/img/institutions/shields-rounded-corners/lab-shield-rounded-corners.png"
},
"description": "Lab test",
"name": "Lab [Test]"
},
"id": "lab",
"links": {
"html": "http://localhost:5000/institutions/lab/",
"self": "https://api.osf.io/v2/institutions/lab/"
},
"relationships": {
"department_metrics": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/lab/metrics/departments/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/lab/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/lab/registrations/",
"meta": {}
}
}
},
"summary_metrics": {
"data": {
"id": "a2jlab",
"type": "institution-summary-metrics"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/lab/metrics/summary/",
"meta": {}
}
}
},
"user_metrics": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/lab/metrics/users/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/lab/users/",
"meta": {}
}
}
}
},
"type": "institutions"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/institutions/"
},
"meta": {
"per_page": 10,
"total": 1,
"version": "2.20"
}
}
GET
Retrieve Subjects associated with a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/subjects/
QUERY PARAMS
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/subjects/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/draft_registrations/:draft_id/subjects/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/subjects/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/subjects/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/subjects/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/subjects/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/draft_registrations/:draft_id/subjects/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/draft_registrations/:draft_id/subjects/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/subjects/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/subjects/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/draft_registrations/:draft_id/subjects/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/draft_registrations/:draft_id/subjects/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/subjects/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/subjects/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/subjects/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/subjects/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/subjects/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/subjects/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/draft_registrations/:draft_id/subjects/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/subjects/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/subjects/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/subjects/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/subjects/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/subjects/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/draft_registrations/:draft_id/subjects/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/subjects/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/subjects/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/subjects/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/subjects/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/draft_registrations/:draft_id/subjects/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/subjects/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/subjects/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/subjects/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/draft_registrations/:draft_id/subjects/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/subjects/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/draft_registrations/:draft_id/subjects/
http GET {{baseUrl}}/draft_registrations/:draft_id/subjects/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/subjects/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/subjects/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"taxonomy_name": "",
"text": "Philosophy"
},
"embeds": {
"parent": {
"data": {
"attributes": {
"taxonomy_name": "",
"text": "Arts and Humanities"
},
"embeds": {
"parent": {
"errors": [
{
"detail": "Not found."
}
]
}
},
"id": "61e02bee90de34000ae344b5",
"links": {
"self": "https://api.osf.io/v2/subjects/61e02bee90de34000ae344b5/"
},
"relationships": {
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/subjects/61e02bee90de34000ae344b5/children/",
"meta": {}
}
}
},
"parent": {
"data": null
}
},
"type": "subjects"
}
}
},
"id": "61e02bee90de34000ae3449e",
"links": {
"self": "https://api.osf.io/v2/subjects/61e02bee90de34000ae3449e/"
},
"relationships": {
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/subjects/61e02bee90de34000ae3449e/children/",
"meta": {}
}
}
},
"parent": {
"data": {
"id": "61e02bee90de34000ae344b5",
"type": "subjects"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/subjects/61e02bee90de34000ae344b5/",
"meta": {}
}
}
}
},
"type": "subjects"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/subjects/"
},
"meta": {
"per_page": 10,
"total": 1,
"version": "2.20"
}
}
GET
Retrieve a Draft Registration (GET)
{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
QUERY PARAMS
node_id
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/draft_registrations/:draft_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/draft_registrations/:draft_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/draft_registrations/:draft_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/draft_registrations/:draft_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
http GET {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"datetime_initiated": "",
"datetime_updated": "",
"registration_metadata": {},
"registration_supplement": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": {
"links": {
"related": {
"href": "",
"meta": {}
}
}
},
"initiator": {
"links": {
"related": {
"href": "",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"related": {
"href": "",
"meta": {}
}
}
}
},
"type": "draft_registrations"
}
],
"links": {
"first": "",
"last": "",
"meta": {
"per_page": 10,
"total": ""
},
"next": "",
"prev": ""
}
}
GET
Retrieve a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/
QUERY PARAMS
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/draft_registrations/:draft_id/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/draft_registrations/:draft_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/draft_registrations/:draft_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/draft_registrations/:draft_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/draft_registrations/:draft_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/draft_registrations/:draft_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/draft_registrations/:draft_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/draft_registrations/:draft_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/draft_registrations/:draft_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/draft_registrations/:draft_id/
http GET {{baseUrl}}/draft_registrations/:draft_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"category": "",
"datetime_initiated": "2022-05-02T15:43:22.981108Z",
"datetime_updated": "2022-05-03T13:08:47.334711Z",
"description": "",
"node_license": null,
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": "Untitled"
},
"id": "626ffc1ad90ebe0011fc7601",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/relationships/institutions/",
"meta": {}
}
}
},
"branched_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_nodes/ng4w2/",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/contributors/",
"meta": {}
}
}
},
"initiator": {
"data": {
"id": "fgvc6",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/",
"meta": {}
}
}
},
"license": {
"data": null
},
"provider": {
"data": {
"id": "osf",
"type": "registration-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/registrations/osf/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/61e02b6c90de34000ae3447a/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/relationships/subjects/",
"meta": {}
}
}
}
},
"type": "draft-registrations"
},
"meta": {
"version": "2.20"
}
}
GET
Retrieve a list of Draft Registrations
{{baseUrl}}/draft_registrations/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/draft_registrations/")
require "http/client"
url = "{{baseUrl}}/draft_registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/draft_registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/draft_registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/draft_registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/draft_registrations/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/draft_registrations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/draft_registrations/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/draft_registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/draft_registrations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/draft_registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/draft_registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/draft_registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/draft_registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/draft_registrations/
http GET {{baseUrl}}/draft_registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/draft_registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "",
"current_user_permissions": [
"admin",
"write",
"read"
],
"datetime_initiated": "2022-04-21T14:56:05.674349Z",
"datetime_updated": "2022-04-21T14:56:05.908546Z",
"description": "Test",
"has_project": false,
"node_license": null,
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": "Test Draft"
},
"id": "626170854968470203611e2c",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/relationships/institutions/",
"meta": {}
}
}
},
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/bibliographic_contributors/",
"meta": {}
}
}
},
"branched_from": {
"data": {
"id": "yt5fw",
"type": "draft_nodes"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_nodes/yt5fw/",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/contributors/",
"meta": {}
}
}
},
"initiator": {
"data": {
"id": "gyht4",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/gyht4/",
"meta": {}
}
}
},
"license": {
"data": null
},
"provider": {
"data": {
"id": "osf",
"type": "registration-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/registrations/osf/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "5e795fc0d2833800195735d0",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/5e795fc0d2833800195735d0/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/626170854968470203611e2c/relationships/subjects/",
"meta": {}
}
}
}
},
"type": "draft-registrations"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/draft_registrations/"
},
"meta": {
"per_page": 10,
"total": 1,
"version": "2.20"
}
}
PATCH
Update a Draft Registration
{{baseUrl}}/draft_registrations/:draft_id/
QUERY PARAMS
draft_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/draft_registrations/:draft_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/draft_registrations/:draft_id/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/draft_registrations/:draft_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/draft_registrations/:draft_id/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/draft_registrations/:draft_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/draft_registrations/:draft_id/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/draft_registrations/:draft_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/draft_registrations/:draft_id/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/draft_registrations/:draft_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/draft_registrations/:draft_id/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/draft_registrations/:draft_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/draft_registrations/:draft_id/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/draft_registrations/:draft_id/';
const options = {method: 'PATCH', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/draft_registrations/:draft_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/draft_registrations/:draft_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/draft_registrations/:draft_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/draft_registrations/:draft_id/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/draft_registrations/:draft_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/draft_registrations/:draft_id/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/draft_registrations/:draft_id/';
const options = {method: 'PATCH', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/draft_registrations/:draft_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/draft_registrations/:draft_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/draft_registrations/:draft_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/draft_registrations/:draft_id/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/draft_registrations/:draft_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/draft_registrations/:draft_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/draft_registrations/:draft_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/draft_registrations/:draft_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/draft_registrations/:draft_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/draft_registrations/:draft_id/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/draft_registrations/:draft_id/"
payload <- "{}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/draft_registrations/:draft_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/draft_registrations/:draft_id/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/draft_registrations/:draft_id/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/draft_registrations/:draft_id/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http PATCH {{baseUrl}}/draft_registrations/:draft_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/draft_registrations/:draft_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/draft_registrations/:draft_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"category": "",
"datetime_initiated": "2022-05-02T15:43:22.981108",
"datetime_updated": "2022-05-03T18:34:29.504428",
"description": "",
"node_license": "None",
"registration_metadata": {
"summary": {
"comments": [],
"extra": [],
"value": "Test"
},
"uploader": {
"comments": [],
"extra": [],
"value": ""
}
},
"registration_responses": {
"summary": "Test Value"
},
"tags": [],
"title": "test title change"
},
"id": "626ffc1ad90ebe0011fc7601",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/relationships/institutions/",
"meta": {}
}
}
},
"branched_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_nodes/ng4w2/",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/contributors/",
"meta": {}
}
}
},
"initiator": {
"data": {
"id": "fgvc6",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/",
"meta": {}
}
}
},
"provider": {
"data": {
"id": "osf",
"type": "registration-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/registrations/osf/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/61e02b6c90de34000ae3447a/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/626ffc1ad90ebe0011fc7601/relationships/subjects/",
"meta": {}
}
}
}
},
"type": "draft_registrations"
},
"meta": {
"version": "2.0"
}
}
GET
List all file versions
{{baseUrl}}/files/:file_id/versions/
QUERY PARAMS
file_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/files/:file_id/versions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/files/:file_id/versions/")
require "http/client"
url = "{{baseUrl}}/files/:file_id/versions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/files/:file_id/versions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/files/:file_id/versions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/files/:file_id/versions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/files/:file_id/versions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/files/:file_id/versions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/files/:file_id/versions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/files/:file_id/versions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/files/:file_id/versions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/files/:file_id/versions/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/files/:file_id/versions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/files/:file_id/versions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/files/:file_id/versions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/files/:file_id/versions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/files/:file_id/versions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/files/:file_id/versions/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/files/:file_id/versions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/files/:file_id/versions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/files/:file_id/versions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/files/:file_id/versions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/files/:file_id/versions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/files/:file_id/versions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/files/:file_id/versions/');
echo $response->getBody();
setUrl('{{baseUrl}}/files/:file_id/versions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/files/:file_id/versions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/files/:file_id/versions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/files/:file_id/versions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/files/:file_id/versions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/files/:file_id/versions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/files/:file_id/versions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/files/:file_id/versions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/files/:file_id/versions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/files/:file_id/versions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/files/:file_id/versions/
http GET {{baseUrl}}/files/:file_id/versions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/files/:file_id/versions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/files/:file_id/versions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"content_type": "application/octet-stream",
"date_created": "2017-01-01T12:34:56.78910",
"size": 216945
},
"id": "1",
"links": {
"html": "https://osf.io/ezcuj/files/osfstorage/553e69248c5e4a219919ea54?revision=1",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/1/"
},
"type": "file_versions"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
Retrieve a file version
{{baseUrl}}/files/:file_id/versions/:version_id/
QUERY PARAMS
file_id
version_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/files/:file_id/versions/:version_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/files/:file_id/versions/:version_id/")
require "http/client"
url = "{{baseUrl}}/files/:file_id/versions/:version_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/files/:file_id/versions/:version_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/files/:file_id/versions/:version_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/files/:file_id/versions/:version_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/files/:file_id/versions/:version_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/files/:file_id/versions/:version_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/files/:file_id/versions/:version_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/files/:file_id/versions/:version_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/files/:file_id/versions/:version_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/files/:file_id/versions/:version_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/files/:file_id/versions/:version_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/files/:file_id/versions/:version_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/files/:file_id/versions/:version_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/files/:file_id/versions/:version_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/files/:file_id/versions/:version_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/files/:file_id/versions/:version_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/files/:file_id/versions/:version_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/files/:file_id/versions/:version_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/files/:file_id/versions/:version_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/files/:file_id/versions/:version_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/files/:file_id/versions/:version_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/files/:file_id/versions/:version_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/files/:file_id/versions/:version_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/files/:file_id/versions/:version_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/files/:file_id/versions/:version_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/files/:file_id/versions/:version_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/files/:file_id/versions/:version_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/files/:file_id/versions/:version_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/files/:file_id/versions/:version_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/files/:file_id/versions/:version_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/files/:file_id/versions/:version_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/files/:file_id/versions/:version_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/files/:file_id/versions/:version_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/files/:file_id/versions/:version_id/
http GET {{baseUrl}}/files/:file_id/versions/:version_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/files/:file_id/versions/:version_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/files/:file_id/versions/:version_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"content_type": "application/octet-stream",
"date_created": "2017-01-01T12:34:56.78910",
"size": 216945
},
"id": "1",
"links": {
"html": "https://osf.io/ezcuj/files/osfstorage/553e69248c5e4a219919ea54?revision=1",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/1/"
},
"type": "file_versions"
}
}
GET
Retrieve a file
{{baseUrl}}/files/:file_id/
QUERY PARAMS
file_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/files/:file_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/files/:file_id/")
require "http/client"
url = "{{baseUrl}}/files/:file_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/files/:file_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/files/:file_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/files/:file_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/files/:file_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/files/:file_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/files/:file_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/files/:file_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/files/:file_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/files/:file_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/files/:file_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/files/:file_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/files/:file_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/files/:file_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/files/:file_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/files/:file_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/files/:file_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/files/:file_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/files/:file_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/files/:file_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/files/:file_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/files/:file_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/files/:file_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/files/:file_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/files/:file_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/files/:file_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/files/:file_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/files/:file_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/files/:file_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/files/:file_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/files/:file_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/files/:file_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/files/:file_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/files/:file_id/
http GET {{baseUrl}}/files/:file_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/files/:file_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/files/:file_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"checkout": null,
"current_user_can_comment": true,
"current_version": 1,
"date_created": "2014-10-17T19:24:12.264Z",
"date_modified": "2014-10-17T19:24:12.264Z",
"delete_allowed": true,
"extra": {
"downloads": 442,
"hashes": {
"md5": "44325d4f13b09f3769ede09d7c20a82c",
"sha256": "2450eb9ff3db92a1bff370368b0552b270bd4b5ca0745b773c37d2662f94df8e"
}
},
"guid": "sejcv",
"kind": "file",
"last_touched": "2015-09-18T01:11:16.328000",
"materialized_path": "/OSC2012.pdf",
"name": "OSC2012.pdf",
"path": "/553e69248c5e4a219919ea54",
"provider": "osfstorage",
"size": 216945,
"tags": []
},
"id": "553e69248c5e4a219919ea54",
"links": {
"delete": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"download": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"info": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"move": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=sejcv",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"versions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/",
"meta": {}
}
}
}
},
"type": "files"
}
}
PATCH
Update a file
{{baseUrl}}/files/:file_id/
QUERY PARAMS
file_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/files/:file_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/files/:file_id/" {:content-type :json
:form-params {:data {:attributes {:name "new file name.jpg"}
:id "{file_id}"
:type "files"}}})
require "http/client"
url = "{{baseUrl}}/files/:file_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/files/:file_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/files/:file_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/files/:file_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/files/:file_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 123
{
"data": {
"attributes": {
"name": "new file name.jpg"
},
"id": "{file_id}",
"type": "files"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/files/:file_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/files/:file_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/files/:file_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/files/:file_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
name: 'new file name.jpg'
},
id: '{file_id}',
type: 'files'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/files/:file_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/files/:file_id/',
headers: {'content-type': 'application/json'},
data: {
data: {attributes: {name: 'new file name.jpg'}, id: '{file_id}', type: 'files'}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/files/:file_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"name":"new file name.jpg"},"id":"{file_id}","type":"files"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/files/:file_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "name": "new file name.jpg"\n },\n "id": "{file_id}",\n "type": "files"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/files/:file_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/files/:file_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {attributes: {name: 'new file name.jpg'}, id: '{file_id}', type: 'files'}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/files/:file_id/',
headers: {'content-type': 'application/json'},
body: {
data: {attributes: {name: 'new file name.jpg'}, id: '{file_id}', type: 'files'}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/files/:file_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
name: 'new file name.jpg'
},
id: '{file_id}',
type: 'files'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/files/:file_id/',
headers: {'content-type': 'application/json'},
data: {
data: {attributes: {name: 'new file name.jpg'}, id: '{file_id}', type: 'files'}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/files/:file_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"name":"new file name.jpg"},"id":"{file_id}","type":"files"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"name": @"new file name.jpg" }, @"id": @"{file_id}", @"type": @"files" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/files/:file_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/files/:file_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/files/:file_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'name' => 'new file name.jpg'
],
'id' => '{file_id}',
'type' => 'files'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/files/:file_id/', [
'body' => '{
"data": {
"attributes": {
"name": "new file name.jpg"
},
"id": "{file_id}",
"type": "files"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/files/:file_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'name' => 'new file name.jpg'
],
'id' => '{file_id}',
'type' => 'files'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'name' => 'new file name.jpg'
],
'id' => '{file_id}',
'type' => 'files'
]
]));
$request->setRequestUrl('{{baseUrl}}/files/:file_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/files/:file_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"name": "new file name.jpg"
},
"id": "{file_id}",
"type": "files"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/files/:file_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"name": "new file name.jpg"
},
"id": "{file_id}",
"type": "files"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/files/:file_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/files/:file_id/"
payload = { "data": {
"attributes": { "name": "new file name.jpg" },
"id": "{file_id}",
"type": "files"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/files/:file_id/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/files/:file_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/files/:file_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"name\": \"new file name.jpg\"\n },\n \"id\": \"{file_id}\",\n \"type\": \"files\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/files/:file_id/";
let payload = json!({"data": json!({
"attributes": json!({"name": "new file name.jpg"}),
"id": "{file_id}",
"type": "files"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/files/:file_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"name": "new file name.jpg"
},
"id": "{file_id}",
"type": "files"
}
}'
echo '{
"data": {
"attributes": {
"name": "new file name.jpg"
},
"id": "{file_id}",
"type": "files"
}
}' | \
http PATCH {{baseUrl}}/files/:file_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "name": "new file name.jpg"\n },\n "id": "{file_id}",\n "type": "files"\n }\n}' \
--output-document \
- {{baseUrl}}/files/:file_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": ["name": "new file name.jpg"],
"id": "{file_id}",
"type": "files"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/files/:file_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all affiliated nodes
{{baseUrl}}/institutions/:institution_id/nodes/
QUERY PARAMS
institution_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/institutions/:institution_id/nodes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/institutions/:institution_id/nodes/")
require "http/client"
url = "{{baseUrl}}/institutions/:institution_id/nodes/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/institutions/:institution_id/nodes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/institutions/:institution_id/nodes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/institutions/:institution_id/nodes/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/institutions/:institution_id/nodes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/institutions/:institution_id/nodes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/institutions/:institution_id/nodes/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/nodes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/institutions/:institution_id/nodes/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/institutions/:institution_id/nodes/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/nodes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/institutions/:institution_id/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/institutions/:institution_id/nodes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/nodes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/institutions/:institution_id/nodes/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/nodes/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/institutions/:institution_id/nodes/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/nodes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/institutions/:institution_id/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/institutions/:institution_id/nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/institutions/:institution_id/nodes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/institutions/:institution_id/nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/institutions/:institution_id/nodes/');
echo $response->getBody();
setUrl('{{baseUrl}}/institutions/:institution_id/nodes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/institutions/:institution_id/nodes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/institutions/:institution_id/nodes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/institutions/:institution_id/nodes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/institutions/:institution_id/nodes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/institutions/:institution_id/nodes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/institutions/:institution_id/nodes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/institutions/:institution_id/nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/institutions/:institution_id/nodes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/institutions/:institution_id/nodes/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/institutions/:institution_id/nodes/
http GET {{baseUrl}}/institutions/:institution_id/nodes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/institutions/:institution_id/nodes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/institutions/:institution_id/nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read"
],
"date_created": "2017-02-08T18:27:00.135000",
"date_modified": "2017-02-09T14:19:23.054000",
"description": "A project storing mp4 files of all the webinar videos posted to the COS youtube channel",
"fork": false,
"node_license": {
"copyright_holders": [
""
],
"year": "2017"
},
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "COS Webinar Videos"
},
"id": "qpxv2",
"links": {
"html": "https://osf.io/qpxv2/",
"self": "https://api.osf.io/v2/nodes/qpxv2/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/qpxv2/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/comments/?filter%5Btarget%5D=qpxv2",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/identifiers/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/qpxv2/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qpxv2/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/institutions/cos/nodes/?page=330",
"meta": {
"per_page": 10,
"total": 337
},
"next": "https://api.osf.io/v2/institutions/cos/nodes/?page=2",
"prev": null
}
}
GET
List all affiliated registrations
{{baseUrl}}/institutions/:institution_id/registrations/
QUERY PARAMS
institution_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/institutions/:institution_id/registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/institutions/:institution_id/registrations/")
require "http/client"
url = "{{baseUrl}}/institutions/:institution_id/registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/institutions/:institution_id/registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/institutions/:institution_id/registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/institutions/:institution_id/registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/institutions/:institution_id/registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/institutions/:institution_id/registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/institutions/:institution_id/registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/institutions/:institution_id/registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/institutions/:institution_id/registrations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/institutions/:institution_id/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/institutions/:institution_id/registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/institutions/:institution_id/registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/registrations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/institutions/:institution_id/registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/institutions/:institution_id/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/institutions/:institution_id/registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/institutions/:institution_id/registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/institutions/:institution_id/registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/institutions/:institution_id/registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/institutions/:institution_id/registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/institutions/:institution_id/registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/institutions/:institution_id/registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/institutions/:institution_id/registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/institutions/:institution_id/registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/institutions/:institution_id/registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/institutions/:institution_id/registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/institutions/:institution_id/registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/institutions/:institution_id/registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/institutions/:institution_id/registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/institutions/:institution_id/registrations/
http GET {{baseUrl}}/institutions/:institution_id/registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/institutions/:institution_id/registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/institutions/:institution_id/registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read"
],
"date_created": "2016-05-26T14:56:27.310000",
"date_modified": "2016-12-14T20:48:58.147000",
"description": "This project contains the materials and proposal for the upcoming OASPA 2016 Conference",
"fork": false,
"node_license": {
"copyright_holders": [
""
],
"year": "2016"
},
"preprint": false,
"public": true,
"registration": true,
"tags": [
"TOP Guidelines",
"Open Practice Badges",
"Registered Reports",
"Prereg Challenge"
],
"title": "COASPA 2016, Center for Open Science"
},
"id": "xemzv",
"links": {
"html": "https://osf.io/xemzv/",
"self": "https://api.osf.io/v2/registrations/xemzv/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/xemzv/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/comments/?filter%5Btarget%5D=xemzv",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/identifiers/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/xemzv/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/node_links/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/xemzv/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/institutions/cos/registrations/?page=3",
"meta": {
"per_page": 10,
"total": 22
},
"next": "https://api.osf.io/v2/institutions/cos/registrations/?page=2",
"prev": null
}
}
GET
List all affiliated users
{{baseUrl}}/institutions/:institution_id/users/
QUERY PARAMS
institution_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/institutions/:institution_id/users/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/institutions/:institution_id/users/")
require "http/client"
url = "{{baseUrl}}/institutions/:institution_id/users/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/institutions/:institution_id/users/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/institutions/:institution_id/users/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/institutions/:institution_id/users/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/institutions/:institution_id/users/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/institutions/:institution_id/users/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/institutions/:institution_id/users/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/users/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/institutions/:institution_id/users/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/institutions/:institution_id/users/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/users/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/institutions/:institution_id/users/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/institutions/:institution_id/users/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/users/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/institutions/:institution_id/users/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/users/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/institutions/:institution_id/users/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/users/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/institutions/:institution_id/users/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/institutions/:institution_id/users/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/institutions/:institution_id/users/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/institutions/:institution_id/users/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/institutions/:institution_id/users/');
echo $response->getBody();
setUrl('{{baseUrl}}/institutions/:institution_id/users/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/institutions/:institution_id/users/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/institutions/:institution_id/users/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/institutions/:institution_id/users/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/institutions/:institution_id/users/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/institutions/:institution_id/users/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/institutions/:institution_id/users/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/institutions/:institution_id/users/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/institutions/:institution_id/users/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/institutions/:institution_id/users/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/institutions/:institution_id/users/
http GET {{baseUrl}}/institutions/:institution_id/users/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/institutions/:institution_id/users/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/institutions/:institution_id/users/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"active": true,
"date_registered": "2012-05-31T05:29:01.320000",
"family_name": "Nosek",
"full_name": "Brian A. Nosek",
"given_name": "Brian",
"locale": "en_US",
"middle_names": "A.",
"suffix": "",
"timezone": "America/New_York"
},
"id": "cdi38",
"links": {
"html": "https://osf.io/cdi38/",
"profile_image": "https://secure.gravatar.com/avatar/37fc491096861dae49fe23ba665af56b?d=identicon",
"self": "https://api.osf.io/v2/users/cdi38/"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/cdi38/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/cdi38/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/cdi38/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/institutions/cos/users/?page=8",
"meta": {
"per_page": 10,
"total": 77
},
"next": "https://api.osf.io/v2/institutions/cos/users/?page=2",
"prev": null
}
}
GET
List all institutions
{{baseUrl}}/institutions/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/institutions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/institutions/")
require "http/client"
url = "{{baseUrl}}/institutions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/institutions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/institutions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/institutions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/institutions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/institutions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/institutions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/institutions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/institutions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/institutions/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/institutions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/institutions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/institutions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/institutions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/institutions/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/institutions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/institutions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/institutions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/institutions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/institutions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/institutions/');
echo $response->getBody();
setUrl('{{baseUrl}}/institutions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/institutions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/institutions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/institutions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/institutions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/institutions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/institutions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/institutions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/institutions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/institutions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/institutions/
http GET {{baseUrl}}/institutions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/institutions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/institutions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"auth_url": null,
"description": "COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at cos.io.",
"logo_path": "/static/img/institutions/shields/cos-shield.png",
"name": "Center For Open Science"
},
"id": "cos",
"links": {
"self": "https://api.osf.io/v2/institutions/cos/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/users/",
"meta": {}
}
}
}
},
"type": "institutions"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/institutions/cos/nodes/?page=2",
"meta": {
"per_page": 10,
"total": 15
},
"next": "https://api.osf.io/v2/institutions/cos/nodes/?page=2",
"prev": null
}
}
GET
Retrieve an institution
{{baseUrl}}/institutions/:institution_id/
QUERY PARAMS
institution_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/institutions/:institution_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/institutions/:institution_id/")
require "http/client"
url = "{{baseUrl}}/institutions/:institution_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/institutions/:institution_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/institutions/:institution_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/institutions/:institution_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/institutions/:institution_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/institutions/:institution_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/institutions/:institution_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/institutions/:institution_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/institutions/:institution_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/institutions/:institution_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/institutions/:institution_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/institutions/:institution_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/institutions/:institution_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/institutions/:institution_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/institutions/:institution_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/institutions/:institution_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/institutions/:institution_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/institutions/:institution_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/institutions/:institution_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/institutions/:institution_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/institutions/:institution_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/institutions/:institution_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/institutions/:institution_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/institutions/:institution_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/institutions/:institution_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/institutions/:institution_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/institutions/:institution_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/institutions/:institution_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/institutions/:institution_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/institutions/:institution_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/institutions/:institution_id/
http GET {{baseUrl}}/institutions/:institution_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/institutions/:institution_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/institutions/:institution_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"auth_url": null,
"description": "COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at cos.io.",
"logo_path": "/static/img/institutions/shields/cos-shield.png",
"name": "Center For Open Science"
},
"id": "cos",
"links": {
"self": "https://api.osf.io/v2/institutions/cos/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/users/",
"meta": {}
}
}
}
},
"type": "institutions"
}
}
GET
List all licenses
{{baseUrl}}/licenses/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/licenses/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/licenses/")
require "http/client"
url = "{{baseUrl}}/licenses/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/licenses/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/licenses/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/licenses/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/licenses/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/licenses/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/licenses/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/licenses/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/licenses/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/licenses/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/licenses/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/licenses/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/licenses/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/licenses/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/licenses/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/licenses/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/licenses/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/licenses/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/licenses/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/licenses/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/licenses/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/licenses/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/licenses/');
echo $response->getBody();
setUrl('{{baseUrl}}/licenses/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/licenses/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/licenses/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/licenses/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/licenses/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/licenses/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/licenses/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/licenses/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/licenses/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/licenses/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/licenses/
http GET {{baseUrl}}/licenses/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/licenses/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/licenses/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"name": "BSD 2-Clause \"Simplified\" License",
"required_fields": [
"year",
"copyrightHolders"
],
"text": "Copyright (c) {{year}}, {{copyrightHolders}}\nAll rights reserved.\n\nThe full descriptive text of the License.\n"
},
"id": "563c1cf88c5e4a3877f9e968",
"links": {
"self": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e968/"
},
"type": "licenses"
}
],
"links": {
"first": "",
"last": "https://api.osf.io/v2/licenses/?page=2",
"meta": {
"per_page": 10,
"total": 16
},
"next": "https://api.osf.io/v2/licenses/?page=2",
"prev": ""
}
}
GET
Retrieve a license
{{baseUrl}}/license/:license_id/
QUERY PARAMS
license_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/license/:license_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/license/:license_id/")
require "http/client"
url = "{{baseUrl}}/license/:license_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/license/:license_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/license/:license_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/license/:license_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/license/:license_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/license/:license_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/license/:license_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/license/:license_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/license/:license_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/license/:license_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/license/:license_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/license/:license_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/license/:license_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/license/:license_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/license/:license_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/license/:license_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/license/:license_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/license/:license_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/license/:license_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/license/:license_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/license/:license_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/license/:license_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/license/:license_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/license/:license_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/license/:license_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/license/:license_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/license/:license_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/license/:license_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/license/:license_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/license/:license_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/license/:license_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/license/:license_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/license/:license_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/license/:license_id/
http GET {{baseUrl}}/license/:license_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/license/:license_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/license/:license_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"name": "BSD 2-Clause \"Simplified\" License",
"required_fields": [
"year",
"copyrightHolders"
],
"text": "Copyright (c) {{year}}, {{copyrightHolders}}\nAll rights reserved.\n\nThe full descriptive text of the License\n"
},
"id": "563c1cf88c5e4a3877f9e968",
"links": {
"self": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e968/"
},
"type": "licenses"
}
}
GET
Actions
{{baseUrl}}/actions/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/actions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/actions/")
require "http/client"
url = "{{baseUrl}}/actions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/actions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/actions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/actions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/actions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/actions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/actions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/actions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/actions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/actions/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/actions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/actions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/actions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/actions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/actions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/actions/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/actions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/actions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/actions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/actions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/actions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/actions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/actions/');
echo $response->getBody();
setUrl('{{baseUrl}}/actions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/actions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/actions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/actions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/actions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/actions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/actions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/actions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/actions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/actions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/actions/
http GET {{baseUrl}}/actions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/actions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/actions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Retrieve a log
{{baseUrl}}/logs/:log_id/
QUERY PARAMS
log_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/logs/:log_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/logs/:log_id/")
require "http/client"
url = "{{baseUrl}}/logs/:log_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/logs/:log_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/logs/:log_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/logs/:log_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/logs/:log_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/logs/:log_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/logs/:log_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/logs/:log_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/logs/:log_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/logs/:log_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/logs/:log_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/logs/:log_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/logs/:log_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/logs/:log_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/logs/:log_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/logs/:log_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/logs/:log_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/logs/:log_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/logs/:log_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/logs/:log_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/logs/:log_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/logs/:log_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/logs/:log_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/logs/:log_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/logs/:log_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/logs/:log_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/logs/:log_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/logs/:log_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/logs/:log_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/logs/:log_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/logs/:log_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/logs/:log_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/logs/:log_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/logs/:log_id/
http GET {{baseUrl}}/logs/:log_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/logs/:log_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/logs/:log_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"action": "contributor_added",
"date": "2012-05-31T05:50:32.083000",
"params": {
"contributors": [
{
"active": true,
"family_name": "Nosek",
"full_name": "Brian A. Nosek",
"given_name": "Brian",
"id": "cdi38",
"middle_names": "A."
}
],
"params_node": {
"id": "ezcuj",
"title": "Reproducibility Project: Psychology"
}
}
},
"id": "4fc706a80b6e9118ef000122",
"links": {
"self": "https://api.osf.io/v2/logs/4fc706a80b6e9118ef000122/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/jk5cv/",
"meta": {}
}
}
}
},
"type": "logs"
}
}
POST
Create a child node
{{baseUrl}}/nodes/:node_id/children/
QUERY PARAMS
node_id
BODY json
{
"attributes": {
"category": "",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [],
"date_created": "",
"date_modified": "",
"description": "",
"fork": false,
"forked_date": "",
"node_license": "",
"preprint": false,
"public": false,
"registration": false,
"tags": [],
"template_from": "",
"title": ""
},
"id": "",
"links": {
"html": "",
"self": ""
},
"relationships": {
"affiliated_institutions": "",
"children": "",
"citation": "",
"comments": "",
"contributors": "",
"draft_registrations": "",
"files": "",
"forked_from": "",
"forks": "",
"identifiers": "",
"license": "",
"linked_nodes": "",
"logs": "",
"node_links": "",
"parent": "",
"preprints": "",
"registrations": "",
"root": "",
"template_node": "",
"view_only_links": "",
"wikis": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/children/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/nodes/:node_id/children/" {:content-type :json
:form-params {:data {:attributes {:category "software"
:title "An Excellent Project Title"}
:type "nodes"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/children/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/children/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/children/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/children/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/nodes/:node_id/children/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 140
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/nodes/:node_id/children/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/children/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/children/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/nodes/:node_id/children/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
category: 'software',
title: 'An Excellent Project Title'
},
type: 'nodes'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/nodes/:node_id/children/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/children/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/children/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"category":"software","title":"An Excellent Project Title"},"type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/children/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "category": "software",\n "title": "An Excellent Project Title"\n },\n "type": "nodes"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/children/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/children/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/children/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/nodes/:node_id/children/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
category: 'software',
title: 'An Excellent Project Title'
},
type: 'nodes'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/children/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/children/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"category":"software","title":"An Excellent Project Title"},"type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"category": @"software", @"title": @"An Excellent Project Title" }, @"type": @"nodes" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/children/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/children/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/children/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/nodes/:node_id/children/', [
'body' => '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/children/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/children/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/children/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/children/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/nodes/:node_id/children/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/children/"
payload = { "data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/children/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/children/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/nodes/:node_id/children/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/children/";
let payload = json!({"data": json!({
"attributes": json!({
"category": "software",
"title": "An Excellent Project Title"
}),
"type": "nodes"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/nodes/:node_id/children/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
echo '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}' | \
http POST {{baseUrl}}/nodes/:node_id/children/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "category": "software",\n "title": "An Excellent Project Title"\n },\n "type": "nodes"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/children/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"category": "software",
"title": "An Excellent Project Title"
],
"type": "nodes"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/children/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a comment
{{baseUrl}}/nodes/:node_id/comments/
QUERY PARAMS
node_id
BODY json
{
"attributes": {
"can_edit": false,
"content": "",
"date_created": "",
"date_modified": "",
"deleted": false,
"has_children": false,
"has_report": false,
"is_abuse": false,
"is_ham": false,
"modified": false,
"page": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"replies": "",
"reports": "",
"target": "",
"user": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/comments/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/nodes/:node_id/comments/" {:content-type :json
:form-params {:data {:attributes {:content "comment content"}
:relationships {:target {:data {:id "{target_id}"
:type "{target_type}"}}}
:type "comments"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/comments/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/comments/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/comments/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/comments/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/nodes/:node_id/comments/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 253
{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/nodes/:node_id/comments/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/comments/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/comments/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/nodes/:node_id/comments/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
content: 'comment content'
},
relationships: {
target: {
data: {
id: '{target_id}',
type: '{target_type}'
}
}
},
type: 'comments'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/nodes/:node_id/comments/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/comments/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {content: 'comment content'},
relationships: {target: {data: {id: '{target_id}', type: '{target_type}'}}},
type: 'comments'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/comments/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"content":"comment content"},"relationships":{"target":{"data":{"id":"{target_id}","type":"{target_type}"}}},"type":"comments"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/comments/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "content": "comment content"\n },\n "relationships": {\n "target": {\n "data": {\n "id": "{target_id}",\n "type": "{target_type}"\n }\n }\n },\n "type": "comments"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/comments/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/comments/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {content: 'comment content'},
relationships: {target: {data: {id: '{target_id}', type: '{target_type}'}}},
type: 'comments'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/comments/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {content: 'comment content'},
relationships: {target: {data: {id: '{target_id}', type: '{target_type}'}}},
type: 'comments'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/nodes/:node_id/comments/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
content: 'comment content'
},
relationships: {
target: {
data: {
id: '{target_id}',
type: '{target_type}'
}
}
},
type: 'comments'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/comments/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {content: 'comment content'},
relationships: {target: {data: {id: '{target_id}', type: '{target_type}'}}},
type: 'comments'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/comments/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"content":"comment content"},"relationships":{"target":{"data":{"id":"{target_id}","type":"{target_type}"}}},"type":"comments"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"content": @"comment content" }, @"relationships": @{ @"target": @{ @"data": @{ @"id": @"{target_id}", @"type": @"{target_type}" } } }, @"type": @"comments" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/comments/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/comments/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/comments/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'content' => 'comment content'
],
'relationships' => [
'target' => [
'data' => [
'id' => '{target_id}',
'type' => '{target_type}'
]
]
],
'type' => 'comments'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/nodes/:node_id/comments/', [
'body' => '{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/comments/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'content' => 'comment content'
],
'relationships' => [
'target' => [
'data' => [
'id' => '{target_id}',
'type' => '{target_type}'
]
]
],
'type' => 'comments'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'content' => 'comment content'
],
'relationships' => [
'target' => [
'data' => [
'id' => '{target_id}',
'type' => '{target_type}'
]
]
],
'type' => 'comments'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/comments/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/comments/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/comments/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/nodes/:node_id/comments/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/comments/"
payload = { "data": {
"attributes": { "content": "comment content" },
"relationships": { "target": { "data": {
"id": "{target_id}",
"type": "{target_type}"
} } },
"type": "comments"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/comments/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/comments/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/nodes/:node_id/comments/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"content\": \"comment content\"\n },\n \"relationships\": {\n \"target\": {\n \"data\": {\n \"id\": \"{target_id}\",\n \"type\": \"{target_type}\"\n }\n }\n },\n \"type\": \"comments\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/comments/";
let payload = json!({"data": json!({
"attributes": json!({"content": "comment content"}),
"relationships": json!({"target": json!({"data": json!({
"id": "{target_id}",
"type": "{target_type}"
})})}),
"type": "comments"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/nodes/:node_id/comments/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}'
echo '{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}' | \
http POST {{baseUrl}}/nodes/:node_id/comments/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "content": "comment content"\n },\n "relationships": {\n "target": {\n "data": {\n "id": "{target_id}",\n "type": "{target_type}"\n }\n }\n },\n "type": "comments"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/comments/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": ["content": "comment content"],
"relationships": ["target": ["data": [
"id": "{target_id}",
"type": "{target_type}"
]]],
"type": "comments"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/comments/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a contributor
{{baseUrl}}/nodes/:node_id/contributors/
QUERY PARAMS
node_id
BODY json
{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/contributors/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/nodes/:node_id/contributors/" {:content-type :json
:form-params {:data {:attributes {}
:relationships {:user {:data {:id "guid0"
:type "users"}}}
:type "contributors"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/contributors/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/contributors/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/contributors/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/contributors/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/nodes/:node_id/contributors/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 201
{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/nodes/:node_id/contributors/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/contributors/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/nodes/:node_id/contributors/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {},
relationships: {
user: {
data: {
id: 'guid0',
type: 'users'
}
}
},
type: 'contributors'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/nodes/:node_id/contributors/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/contributors/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/contributors/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{},"relationships":{"user":{"data":{"id":"guid0","type":"users"}}},"type":"contributors"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/contributors/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {},\n "relationships": {\n "user": {\n "data": {\n "id": "guid0",\n "type": "users"\n }\n }\n },\n "type": "contributors"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/contributors/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/contributors/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/nodes/:node_id/contributors/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {},
relationships: {
user: {
data: {
id: 'guid0',
type: 'users'
}
}
},
type: 'contributors'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/contributors/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/contributors/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{},"relationships":{"user":{"data":{"id":"guid0","type":"users"}}},"type":"contributors"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ }, @"relationships": @{ @"user": @{ @"data": @{ @"id": @"guid0", @"type": @"users" } } }, @"type": @"contributors" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/contributors/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'user' => [
'data' => [
'id' => 'guid0',
'type' => 'users'
]
]
],
'type' => 'contributors'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/nodes/:node_id/contributors/', [
'body' => '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/contributors/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'user' => [
'data' => [
'id' => 'guid0',
'type' => 'users'
]
]
],
'type' => 'contributors'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'user' => [
'data' => [
'id' => 'guid0',
'type' => 'users'
]
]
],
'type' => 'contributors'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/contributors/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/contributors/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/contributors/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/nodes/:node_id/contributors/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/contributors/"
payload = { "data": {
"attributes": {},
"relationships": { "user": { "data": {
"id": "guid0",
"type": "users"
} } },
"type": "contributors"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/contributors/"
payload <- "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/nodes/:node_id/contributors/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/contributors/";
let payload = json!({"data": json!({
"attributes": json!({}),
"relationships": json!({"user": json!({"data": json!({
"id": "guid0",
"type": "users"
})})}),
"type": "contributors"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/nodes/:node_id/contributors/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}'
echo '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}' | \
http POST {{baseUrl}}/nodes/:node_id/contributors/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {},\n "relationships": {\n "user": {\n "data": {\n "id": "guid0",\n "type": "users"\n }\n }\n },\n "type": "contributors"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/contributors/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [],
"relationships": ["user": ["data": [
"id": "guid0",
"type": "users"
]]],
"type": "contributors"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a draft registration based on your current project Node.
{{baseUrl}}/nodes/:node_id/draft_registrations/
QUERY PARAMS
node_id
BODY json
{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/draft_registrations/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/nodes/:node_id/draft_registrations/" {:content-type :json
:form-params {:data {:relationships {:registration_schema {:data {:id "61e02b6c90de34000ae3447a"
:type "registration_schemas"}}}
:type "draft_registrations"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/draft_registrations/"),
Content = new StringContent("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/draft_registrations/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/draft_registrations/"
payload := strings.NewReader("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/nodes/:node_id/draft_registrations/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 235
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/nodes/:node_id/draft_registrations/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/draft_registrations/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/nodes/:node_id/draft_registrations/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
relationships: {
registration_schema: {
data: {
id: '61e02b6c90de34000ae3447a',
type: 'registration_schemas'
}
}
},
type: 'draft_registrations'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/nodes/:node_id/draft_registrations/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/',
headers: {'content-type': 'application/json'},
data: {
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"relationships":{"registration_schema":{"data":{"id":"61e02b6c90de34000ae3447a","type":"registration_schemas"}}},"type":"draft_registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "relationships": {\n "registration_schema": {\n "data": {\n "id": "61e02b6c90de34000ae3447a",\n "type": "registration_schemas"\n }\n }\n },\n "type": "draft_registrations"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/draft_registrations/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/',
headers: {'content-type': 'application/json'},
body: {
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/nodes/:node_id/draft_registrations/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
relationships: {
registration_schema: {
data: {
id: '61e02b6c90de34000ae3447a',
type: 'registration_schemas'
}
}
},
type: 'draft_registrations'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/',
headers: {'content-type': 'application/json'},
data: {
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"relationships":{"registration_schema":{"data":{"id":"61e02b6c90de34000ae3447a","type":"registration_schemas"}}},"type":"draft_registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"relationships": @{ @"registration_schema": @{ @"data": @{ @"id": @"61e02b6c90de34000ae3447a", @"type": @"registration_schemas" } } }, @"type": @"draft_registrations" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/draft_registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/draft_registrations/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/draft_registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'relationships' => [
'registration_schema' => [
'data' => [
'id' => '61e02b6c90de34000ae3447a',
'type' => 'registration_schemas'
]
]
],
'type' => 'draft_registrations'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/nodes/:node_id/draft_registrations/', [
'body' => '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'relationships' => [
'registration_schema' => [
'data' => [
'id' => '61e02b6c90de34000ae3447a',
'type' => 'registration_schemas'
]
]
],
'type' => 'draft_registrations'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'relationships' => [
'registration_schema' => [
'data' => [
'id' => '61e02b6c90de34000ae3447a',
'type' => 'registration_schemas'
]
]
],
'type' => 'draft_registrations'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/nodes/:node_id/draft_registrations/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/"
payload = { "data": {
"relationships": { "registration_schema": { "data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
} } },
"type": "draft_registrations"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/draft_registrations/"
payload <- "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/draft_registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/nodes/:node_id/draft_registrations/') do |req|
req.body = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/draft_registrations/";
let payload = json!({"data": json!({
"relationships": json!({"registration_schema": json!({"data": json!({
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
})})}),
"type": "draft_registrations"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/nodes/:node_id/draft_registrations/ \
--header 'content-type: application/json' \
--data '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}'
echo '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}' | \
http POST {{baseUrl}}/nodes/:node_id/draft_registrations/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "relationships": {\n "registration_schema": {\n "data": {\n "id": "61e02b6c90de34000ae3447a",\n "type": "registration_schemas"\n }\n }\n },\n "type": "draft_registrations"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/draft_registrations/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"relationships": ["registration_schema": ["data": [
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
]]],
"type": "draft_registrations"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/draft_registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a fork of this node
{{baseUrl}}/nodes/:node_id/forks/
QUERY PARAMS
node_id
BODY json
{
"attributes": {
"category": "",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [],
"date_created": "",
"date_modified": "",
"description": "",
"fork": false,
"forked_date": "",
"node_license": "",
"preprint": false,
"public": false,
"registration": false,
"tags": [],
"template_from": "",
"title": ""
},
"id": "",
"links": {
"html": "",
"self": ""
},
"relationships": {
"affiliated_institutions": "",
"children": "",
"citation": "",
"comments": "",
"contributors": "",
"draft_registrations": "",
"files": "",
"forked_from": "",
"forks": "",
"identifiers": "",
"license": "",
"linked_nodes": "",
"logs": "",
"node_links": "",
"parent": "",
"preprints": "",
"registrations": "",
"root": "",
"template_node": "",
"view_only_links": "",
"wikis": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/forks/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/nodes/:node_id/forks/" {:content-type :json
:form-params {:data {:attributes {:category "software"
:title "An Excellent Project Title"}
:type "nodes"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/forks/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/forks/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/forks/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/forks/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/nodes/:node_id/forks/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 140
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/nodes/:node_id/forks/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/forks/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/forks/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/nodes/:node_id/forks/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
category: 'software',
title: 'An Excellent Project Title'
},
type: 'nodes'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/nodes/:node_id/forks/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/forks/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/forks/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"category":"software","title":"An Excellent Project Title"},"type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/forks/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "category": "software",\n "title": "An Excellent Project Title"\n },\n "type": "nodes"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/forks/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/forks/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/forks/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/nodes/:node_id/forks/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
category: 'software',
title: 'An Excellent Project Title'
},
type: 'nodes'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/:node_id/forks/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/forks/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"category":"software","title":"An Excellent Project Title"},"type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"category": @"software", @"title": @"An Excellent Project Title" }, @"type": @"nodes" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/forks/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/forks/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/forks/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/nodes/:node_id/forks/', [
'body' => '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/forks/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/forks/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/forks/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/forks/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/nodes/:node_id/forks/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/forks/"
payload = { "data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/forks/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/forks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/nodes/:node_id/forks/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/forks/";
let payload = json!({"data": json!({
"attributes": json!({
"category": "software",
"title": "An Excellent Project Title"
}),
"type": "nodes"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/nodes/:node_id/forks/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
echo '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}' | \
http POST {{baseUrl}}/nodes/:node_id/forks/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "category": "software",\n "title": "An Excellent Project Title"\n },\n "type": "nodes"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/forks/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"category": "software",
"title": "An Excellent Project Title"
],
"type": "nodes"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/forks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a node
{{baseUrl}}/nodes/
BODY json
{
"attributes": {
"category": "",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [],
"date_created": "",
"date_modified": "",
"description": "",
"fork": false,
"forked_date": "",
"node_license": "",
"preprint": false,
"public": false,
"registration": false,
"tags": [],
"template_from": "",
"title": ""
},
"id": "",
"links": {
"html": "",
"self": ""
},
"relationships": {
"affiliated_institutions": "",
"children": "",
"citation": "",
"comments": "",
"contributors": "",
"draft_registrations": "",
"files": "",
"forked_from": "",
"forks": "",
"identifiers": "",
"license": "",
"linked_nodes": "",
"logs": "",
"node_links": "",
"parent": "",
"preprints": "",
"registrations": "",
"root": "",
"template_node": "",
"view_only_links": "",
"wikis": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/nodes/" {:content-type :json
:form-params {:data {:attributes {:category "software"
:title "An Excellent Project Title"}
:type "nodes"}}})
require "http/client"
url = "{{baseUrl}}/nodes/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/nodes/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/nodes/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 140
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/nodes/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/nodes/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
category: 'software',
title: 'An Excellent Project Title'
},
type: 'nodes'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/nodes/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"category":"software","title":"An Excellent Project Title"},"type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "category": "software",\n "title": "An Excellent Project Title"\n },\n "type": "nodes"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/nodes/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
category: 'software',
title: 'An Excellent Project Title'
},
type: 'nodes'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/nodes/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {category: 'software', title: 'An Excellent Project Title'},
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"category":"software","title":"An Excellent Project Title"},"type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"category": @"software", @"title": @"An Excellent Project Title" }, @"type": @"nodes" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/nodes/', [
'body' => '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'category' => 'software',
'title' => 'An Excellent Project Title'
],
'type' => 'nodes'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/nodes/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/"
payload = { "data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/nodes/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"category\": \"software\",\n \"title\": \"An Excellent Project Title\"\n },\n \"type\": \"nodes\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/";
let payload = json!({"data": json!({
"attributes": json!({
"category": "software",
"title": "An Excellent Project Title"
}),
"type": "nodes"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/nodes/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}'
echo '{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}' | \
http POST {{baseUrl}}/nodes/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "category": "software",\n "title": "An Excellent Project Title"\n },\n "type": "nodes"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"category": "software",
"title": "An Excellent Project Title"
],
"type": "nodes"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete a contributor
{{baseUrl}}/nodes/:node_id/contributors/:user_id/
QUERY PARAMS
node_id
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/contributors/:user_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/contributors/:user_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/contributors/:user_id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/nodes/:node_id/contributors/:user_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/contributors/:user_id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/contributors/:user_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/contributors/:user_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/contributors/:user_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/contributors/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/contributors/:user_id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/contributors/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/contributors/:user_id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/contributors/:user_id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/nodes/:node_id/contributors/:user_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/nodes/:node_id/contributors/:user_id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/nodes/:node_id/contributors/:user_id/
http DELETE {{baseUrl}}/nodes/:node_id/contributors/:user_id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/nodes/:node_id/contributors/:user_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete a draft registration (DELETE)
{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
QUERY PARAMS
node_id
draft_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/nodes/:node_id/draft_registrations/:draft_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/draft_registrations/:draft_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/nodes/:node_id/draft_registrations/:draft_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/nodes/:node_id/draft_registrations/:draft_id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
http DELETE {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete a node
{{baseUrl}}/nodes/:node_id/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/nodes/:node_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/nodes/:node_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/nodes/:node_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/nodes/:node_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/nodes/:node_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/nodes/:node_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/nodes/:node_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/nodes/:node_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/nodes/:node_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/nodes/:node_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/nodes/:node_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/nodes/:node_id/') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/nodes/:node_id/
http DELETE {{baseUrl}}/nodes/:node_id/
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/nodes/:node_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all addon folders
{{baseUrl}}/nodes/:node_id/addons/:provider/folders/
QUERY PARAMS
node_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/addons/:provider/folders/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/addons/:provider/folders/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/addons/:provider/folders/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/addons/:provider/folders/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/addons/:provider/folders/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/addons/:provider/folders/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/addons/:provider/folders/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/addons/:provider/folders/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/addons/:provider/folders/
http GET {{baseUrl}}/nodes/:node_id/addons/:provider/folders/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/addons/:provider/folders/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/addons/:provider/folders/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"folder_id": "/",
"kind": "folder",
"name": "/ ()",
"path": "/",
"provider": ""
},
"id": "/",
"links": {
"children": "https://api.osf.io/v2/nodes//addons//folders/?path=/&id=/",
"root": "https://api.osf.io/v2/nodes//addons//folders/"
},
"type": "node_addon_folders"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 1000,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all addons (GET)
{{baseUrl}}/nodes/:node_id/addons/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/addons/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/addons/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/addons/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/addons/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/addons/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/addons/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/addons/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/addons/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/addons/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/addons/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/addons/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/addons/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/addons/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/addons/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/addons/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/addons/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/addons/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/addons/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/addons/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/addons/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/addons/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/addons/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/addons/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/addons/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/addons/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/addons/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/addons/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/addons/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/addons/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/addons/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/addons/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/addons/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/addons/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/addons/
http GET {{baseUrl}}/nodes/:node_id/addons/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/addons/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/addons/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"configured": false,
"external_account_id": null,
"folder_id": null,
"folder_path": null,
"node_has_auth": false
},
"id": "",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/addons//"
},
"type": "node_addons"
},
{
"attributes": {
"configured": false,
"external_account_id": null,
"folder_id": null,
"folder_path": null,
"node_has_auth": false
},
"id": "",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/addons//"
},
"type": "node_addons"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all child nodes
{{baseUrl}}/nodes/:node_id/children/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/children/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/children/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/children/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/children/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/children/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/children/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/children/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/children/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/children/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/children/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/children/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/children/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/children/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/children/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/children/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/children/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/children/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/children/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/children/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/children/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/children/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/children/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/children/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/children/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/children/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/children/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/children/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/children/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/children/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/children/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/children/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/children/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/children/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/children/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/children/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/children/
http GET {{baseUrl}}/nodes/:node_id/children/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/children/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/children/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "communication",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2015-07-20T17:42:16.496000",
"date_modified": "2016-11-02T21:25:12.572000",
"description": "Reproducibility is a defining feature of science, but the extent to which it characterizes current research is unknown. We conducted replications of 100 experimental and correlational studies published in three psychology journals using high-powered designs and original materials when available. Replication effects were half the magnitude of original effects, representing a substantial decline. Ninety-seven percent of original studies had statistically significant results. Thirty-six percent of replications had statistically significant results; 47% of original effect sizes were in the 95% confidence interval of the replication effect size; 39% of effects were subjectively rated to have replicated the original result; and if no bias in original results is assumed, combining original and replication results left 68% with statistically significant effects. Correlational tests suggest that replication success was better predicted by the strength of original evidence than by characteristics of the original and replication teams.",
"fork": false,
"node_license": null,
"preprint": true,
"public": true,
"registration": false,
"tags": [
"replication",
"reproducibility",
"effect size"
],
"title": "Estimating the Reproducibility of Psychological Science"
},
"id": "ezum7",
"links": {
"html": "https://osf.io/ezum7/",
"self": "https://api.osf.io/v2/nodes/ezum7/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/ezum7/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/comments/?filter%5Btarget%5D=ezum7",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/ezum7/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/node_links/",
"meta": {}
}
}
},
"parent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezum7/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/nodes/ezcuj/children/?page=5",
"meta": {
"per_page": 10,
"total": 49
},
"next": "https://api.osf.io/v2/nodes/ezcuj/children/?page=2",
"prev": null
}
}
GET
List all comments
{{baseUrl}}/nodes/:node_id/comments/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/comments/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/comments/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/comments/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/comments/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/comments/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/comments/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/comments/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/comments/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/comments/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/comments/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/comments/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/comments/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/comments/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/comments/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/comments/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/comments/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/comments/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/comments/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/comments/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/comments/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/comments/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/comments/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/comments/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/comments/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/comments/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/comments/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/comments/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/comments/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/comments/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/comments/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/comments/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/comments/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/comments/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/comments/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/comments/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/comments/
http GET {{baseUrl}}/nodes/:node_id/comments/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/comments/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/comments/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"can_edit": false,
"content": "We have published a Bayesian reanalysis of this project at PLOS ONE: http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0149794\n\nI explain some of the context on my blog: http://alexanderetz.com/2016/02/26/the-bayesian-rpp-take-2/\n\nPlease note that the analysis we use in this paper is very different from the analysis used in the blog I posted in the previous comment, so the results are different as well.",
"date_created": "2016-02-27T13:50:24.240000",
"date_modified": "2016-04-01T04:45:44.123000",
"deleted": false,
"has_children": false,
"has_report": false,
"is_abuse": false,
"is_ham": false,
"modified": false,
"page": "node"
},
"id": "jg7sezmdnt93",
"links": {
"self": "https://api.osf.io/v2/comments/jg7sezmdnt93/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"replies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=jg7sezmdnt93",
"meta": {}
}
}
},
"reports": {
"links": {
"related": {
"href": "https://api.osf.io/v2/comments/jg7sezmdnt93/reports/",
"meta": {}
}
}
},
"target": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {
"type": "nodes"
}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/6yc8z/",
"meta": {}
}
}
}
},
"type": "comments"
},
{
"attributes": {
"can_edit": false,
"content": "In this blog http://wp.me/p4sgtg-o6 I conduct a Bayesian Re-analysis of the Reproducibility Project that gives a graded measure of replication success. In an attempt to avoid dichotomous success/fail replication outcomes, I calculate a continous outcome (Bayes factor) that answers the question, does the replication result fit more with the original reported effect or a null effect? Many replications are strong successes, many are strong failures, and there are many that lie somewhere in between.",
"date_created": "2015-08-30T14:50:21.093000",
"date_modified": "2016-04-01T04:45:37.437000",
"deleted": false,
"has_children": false,
"has_report": false,
"is_abuse": false,
"is_ham": false,
"modified": null,
"page": "node"
},
"id": "23pk9",
"links": {
"self": "https://api.osf.io/v2/comments/23pk9/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"replies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=23pk9",
"meta": {}
}
}
},
"reports": {
"links": {
"related": {
"href": "https://api.osf.io/v2/comments/23pk9/reports/",
"meta": {}
}
}
},
"target": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {
"type": "nodes"
}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/6yc8z/",
"meta": {}
}
}
}
},
"type": "comments"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all contributors
{{baseUrl}}/nodes/:node_id/contributors/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/contributors/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/contributors/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/contributors/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/contributors/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/contributors/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/contributors/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/contributors/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/contributors/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/contributors/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/contributors/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/contributors/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/contributors/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/contributors/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/contributors/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/contributors/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/contributors/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/contributors/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/contributors/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/contributors/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/contributors/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/contributors/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/contributors/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/contributors/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/contributors/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/contributors/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/contributors/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/contributors/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/contributors/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/contributors/
http GET {{baseUrl}}/nodes/:node_id/contributors/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/contributors/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2014-03-18T19:11:57.252000",
"family_name": "Geiger",
"full_name": "Brian J. Geiger",
"given_name": "Brian",
"locale": "en_us",
"middle_names": "J.",
"suffix": "",
"timezone": "America/New_York"
},
"id": "typ46",
"links": {
"html": "https://osf.io/typ46/",
"profile_image": "https://secure.gravatar.com/avatar/3dd8757ba100b8406413706886243811?d=identicon",
"self": "https://api.osf.io/v2/users/typ46/"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/typ46/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/typ46/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/typ46/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "y9jdt-typ46",
"links": {
"self": "https://api.osf.io/v2/nodes/y9jdt/contributors/typ46/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/y9jdt/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/typ46/",
"meta": {}
}
}
}
},
"type": "contributors"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 9,
"total_bibliographic": 1
},
"next": null,
"prev": null
}
}
GET
List all draft registrations
{{baseUrl}}/nodes/:node_id/draft_registrations/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/draft_registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/draft_registrations/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/draft_registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/draft_registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/draft_registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/draft_registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/draft_registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/draft_registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/draft_registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/draft_registrations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/draft_registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/draft_registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/draft_registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/draft_registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/draft_registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/draft_registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/draft_registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/draft_registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/draft_registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/draft_registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/draft_registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/draft_registrations/
http GET {{baseUrl}}/nodes/:node_id/draft_registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/draft_registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/draft_registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "",
"datetime_initiated": "2022-05-03T17:03:50.288542",
"datetime_updated": "2022-05-03T17:03:50.560153",
"description": "",
"node_license": null,
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": "Untitled"
},
"id": "62716076d90ebe0017f2bf42",
"links": {
"self": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/relationships/institutions/",
"meta": {}
}
}
},
"branched_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/nmj5w/",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/contributors/",
"meta": {}
}
}
},
"initiator": {
"data": {
"id": "fgvc6",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/",
"meta": {}
}
}
},
"provider": {
"data": {
"id": "osf",
"type": "registration-providers"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/providers/registrations/osf/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/61e02b6c90de34000ae3447a/",
"meta": {}
}
}
},
"subjects": {
"links": {
"related": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/subjects/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/draft_registrations/62716076d90ebe0017f2bf42/relationships/subjects/",
"meta": {}
}
}
}
},
"type": "draft_registrations"
}
],
"links": {
"first": "",
"last": "",
"meta": {
"per_page": 10,
"total": ""
},
"next": "",
"prev": ""
}
}
GET
List all forks of this node
{{baseUrl}}/nodes/:node_id/forks/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/forks/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/forks/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/forks/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/forks/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/forks/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/forks/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/forks/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/forks/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/forks/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/forks/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/forks/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/forks/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/forks/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/forks/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/forks/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/forks/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/forks/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/forks/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/forks/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/forks/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/forks/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/forks/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/forks/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/forks/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/forks/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/forks/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/forks/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/forks/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/forks/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/forks/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/forks/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/forks/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/forks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/forks/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/forks/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/forks/
http GET {{baseUrl}}/nodes/:node_id/forks/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/forks/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/forks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read",
"write",
"admin"
],
"date_created": "2012-04-01T15:49:07.702000",
"date_modified": "2016-07-23T00:21:05.371000",
"description": "",
"fork": true,
"forked_date": "2016-11-08T15:59:03.114000",
"node_license": null,
"preprint": false,
"public": false,
"registration": false,
"tags": [
"replication",
"reproducibility",
"open science",
"reproduction",
"psychological science",
"psychology",
"metascience",
"crowdsource"
],
"title": "Fork of Reproducibility Project: Psychology"
},
"id": "95q3e",
"links": {
"html": "https://osf.io/95q3e/",
"self": "https://api.osf.io/v2/nodes/95q3e/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/95q3e/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/comments/?filter%5Btarget%5D=95q3e",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/files/",
"meta": {}
}
}
},
"forked_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/95q3e/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/95q3e/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all identifiers
{{baseUrl}}/nodes/:node_id/identifiers/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/identifiers/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/identifiers/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/identifiers/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/identifiers/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/identifiers/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/identifiers/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/identifiers/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/identifiers/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/identifiers/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/identifiers/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/identifiers/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/identifiers/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/identifiers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/identifiers/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/identifiers/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/identifiers/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/identifiers/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/identifiers/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/identifiers/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/identifiers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/identifiers/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/identifiers/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/identifiers/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/identifiers/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/identifiers/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/identifiers/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/identifiers/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/identifiers/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/identifiers/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/identifiers/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/identifiers/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/identifiers/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/identifiers/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/identifiers/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/identifiers/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/identifiers/
http GET {{baseUrl}}/nodes/:node_id/identifiers/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/identifiers/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/identifiers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "doi",
"value": "10.17605/OSF.IO/73PND"
},
"id": "57f1641db83f6901ed94b459",
"links": {
"self": "https://api.osf.io/v2/identifiers/57f1641db83f6901ed94b459/"
},
"relationships": {
"referent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
}
},
"type": "identifiers"
},
{
"attributes": {
"category": "ark",
"value": "c7605/osf.io/73pnd"
},
"id": "57f1641db83f6901ed94b45a",
"links": {
"self": "https://api.osf.io/v2/identifiers/57f1641db83f6901ed94b45a/"
},
"relationships": {
"referent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
}
},
"type": "identifiers"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all institutions (GET)
{{baseUrl}}/nodes/:node_id/institutions/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/institutions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/institutions/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/institutions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/institutions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/institutions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/institutions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/institutions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/institutions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/institutions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/institutions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/institutions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/institutions/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/institutions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/institutions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/institutions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/institutions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/institutions/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/institutions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/institutions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/institutions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/institutions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/institutions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/institutions/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/institutions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/institutions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/institutions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/institutions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/institutions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/institutions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/institutions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/institutions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/institutions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/institutions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/institutions/
http GET {{baseUrl}}/nodes/:node_id/institutions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/institutions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/institutions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"auth_url": null,
"description": "COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at cos.io.",
"logo_path": "/static/img/institutions/shields/cos-shield.png",
"name": "Center For Open Science"
},
"id": "cos",
"links": {
"self": "https://api.osf.io/v2/institutions/cos/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/users/",
"meta": {}
}
}
}
},
"type": "institutions"
},
{
"attributes": {
"auth_url": "https://accounts.osf.io/Shibboleth.sso/Login?entityID=urn%3Amace%3Aincommon%3Avirginia.edu",
"description": "In partnership with the Vice President for Research, Data Science Institute, Health Sciences Library, and University Library. Learn more about UVA resources for computational and data-driven research. Projects must abide by the University Security and Data Protection Policies.",
"logo_path": "/static/img/institutions/shields/uva-shield.png",
"name": "University of Virginia"
},
"id": "uva",
"links": {
"self": "https://api.osf.io/v2/institutions/uva/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/users/",
"meta": {}
}
}
}
},
"type": "institutions"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all linked nodes
{{baseUrl}}/nodes/:node_id/linked_nodes/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/linked_nodes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/linked_nodes/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/linked_nodes/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/linked_nodes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/linked_nodes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/linked_nodes/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/linked_nodes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/linked_nodes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/linked_nodes/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/linked_nodes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/linked_nodes/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/linked_nodes/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/linked_nodes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/linked_nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/linked_nodes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/linked_nodes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/linked_nodes/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/linked_nodes/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/linked_nodes/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/linked_nodes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/linked_nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/linked_nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/linked_nodes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/linked_nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/linked_nodes/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/linked_nodes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/linked_nodes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/linked_nodes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/linked_nodes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/linked_nodes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/linked_nodes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/linked_nodes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/linked_nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/linked_nodes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/linked_nodes/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/linked_nodes/
http GET {{baseUrl}}/nodes/:node_id/linked_nodes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/linked_nodes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/linked_nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2014-07-28T13:53:04.508000",
"date_modified": "2017-03-03T05:00:31.512000",
"description": "This is an independent replication as part of the Reproducibility Project: Psychology.",
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "Replication of WA Cunningham, JJ Van Bavel, IR Johnsen (2008, PS 19(2))"
},
"id": "bifc7",
"links": {
"html": "https://osf.io/bifc7/",
"self": "https://api.osf.io/v2/nodes/bifc7/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/bifc7/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/comments/?filter%5Btarget%5D=bifc7",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/bifc7/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
},
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2012-10-31T18:50:46.111000",
"date_modified": "2016-10-02T19:50:23.605000",
"description": null,
"fork": true,
"node_license": {
"copyright_holders": [
""
],
"year": "2016"
},
"preprint": false,
"public": true,
"registration": false,
"tags": [
"anxiety",
"EMG",
"EEG",
"motivation",
"ERN"
],
"title": "Replication of Hajcak & Foti (2008, PS, Study 1)"
},
"id": "73pnd",
"links": {
"html": "https://osf.io/73pnd/",
"self": "https://api.osf.io/v2/nodes/73pnd/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/73pnd/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/comments/?filter%5Btarget%5D=73pnd",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/files/",
"meta": {}
}
}
},
"forked_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/kxhz5/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/identifiers/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/73pnd/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all logs
{{baseUrl}}/nodes/:node_id/logs/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/logs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/logs/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/logs/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/logs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/logs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/logs/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/logs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/logs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/logs/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/logs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/logs/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/logs/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/logs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/logs/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/logs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/logs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/logs/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/logs/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/logs/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/logs/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/logs/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/logs/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/logs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/logs/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/logs/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/logs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/logs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/logs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/logs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/logs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/logs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/logs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/logs/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/logs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/logs/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/logs/
http GET {{baseUrl}}/nodes/:node_id/logs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/logs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/logs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"action": "contributor_added",
"date": "2012-05-31T05:50:32.083000",
"params": {
"contributors": [
{
"active": true,
"family_name": "Nosek",
"full_name": "Brian A. Nosek",
"given_name": "Brian",
"id": "cdi38",
"middle_names": "A."
}
],
"params_node": {
"id": "ezcuj",
"title": "Reproducibility Project: Psychology"
}
}
},
"id": "4fc706a80b6e9118ef000122",
"links": {
"self": "https://api.osf.io/v2/logs/4fc706a80b6e9118ef000122/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/jk5cv/",
"meta": {}
}
}
}
},
"type": "logs"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"action": "pointer_created",
"date": "2017-01-23T16:30:07.321000",
"params": {
"contributors": [],
"params_node": {
"id": "fejxb",
"title": "Replication of Correll (2008, JPSP, Study 2)"
},
"params_project": null,
"pointer": {
"category": "project",
"id": "iraqy",
"title": "Independent Direct Replication #2 of Correll (2008, JPSP, Study 2)",
"url": "/iraqy/"
},
"preprint_provider": null
}
},
"id": "58862f8f594d9001f547f484",
"links": {
"self": "https://api.osf.io/v2/logs/58862f8f594d9001f547f484/"
},
"relationships": {
"linked_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/iraqy/",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/fejxb/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/fejxb/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/2z47w/",
"meta": {}
}
}
}
},
"type": "logs"
},
{
"attributes": {
"action": "project_registered",
"date": "2017-01-09T05:00:53.761000",
"params": {
"contributors": [],
"params_node": {
"id": "rtjws",
"title": "Analysis Audit"
},
"params_project": null,
"preprint_provider": null
}
},
"id": "5873190554be8101d7e30b3e",
"links": {
"self": "https://api.osf.io/v2/logs/5873190554be8101d7e30b3e/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/rtjws/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/rtjws/",
"meta": {}
}
}
}
},
"type": "logs"
}
],
"links": {
"first": null,
"last": null,
"meta": null,
"next": null,
"per_page": 10,
"prev": null,
"total": 2
}
}
GET
List all node files
{{baseUrl}}/nodes/:node_id/files/:provider/
QUERY PARAMS
node_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/files/:provider/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/files/:provider/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/files/:provider/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/files/:provider/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/files/:provider/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/files/:provider/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/files/:provider/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/files/:provider/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/files/:provider/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/:provider/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/files/:provider/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/files/:provider/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/files/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/files/:provider/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/:provider/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/files/:provider/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/:provider/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/files/:provider/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/files/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/files/:provider/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/files/:provider/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/files/:provider/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/files/:provider/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/files/:provider/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/files/:provider/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/files/:provider/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/files/:provider/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/files/:provider/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/files/:provider/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/files/:provider/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/files/:provider/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/files/:provider/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/files/:provider/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/files/:provider/
http GET {{baseUrl}}/nodes/:node_id/files/:provider/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/files/:provider/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/files/:provider/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"checkout": null,
"current_user_can_comment": true,
"current_version": 1,
"date_created": "2014-10-17T19:24:12.264Z",
"date_modified": "2014-10-17T19:24:12.264Z",
"delete_allowed": true,
"extra": {
"downloads": 447,
"hashes": {
"md5": "44325d4f13b09f3769ede09d7c20a82c",
"sha256": "2450eb9ff3db92a1bff370368b0552b270bd4b5ca0745b773c37d2662f94df8e"
}
},
"guid": "sejcv",
"kind": "file",
"last_touched": "2015-09-18T01:11:16.328000",
"materialized_path": "/OSC2012.pdf",
"name": "OSC2012.pdf",
"path": "/553e69248c5e4a219919ea54",
"provider": "osfstorage",
"size": 216945,
"tags": []
},
"id": "553e69248c5e4a219919ea54",
"links": {
"delete": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"download": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"info": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"move": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=sejcv",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"versions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/",
"meta": {}
}
}
}
},
"type": "files"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all nodes
{{baseUrl}}/nodes/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/")
require "http/client"
url = "{{baseUrl}}/nodes/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/
http GET {{baseUrl}}/nodes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read"
],
"date_created": "2012-04-01T15:49:07.702000",
"date_modified": "2016-12-08T21:45:17.058000",
"description": "",
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [
"replication",
"reproducibility",
"open science",
"reproduction",
"psychological science",
"psychology",
"metascience",
"crowdsource"
],
"title": "Reproducibility Project: Psychology"
},
"id": "ezcuj",
"links": {
"html": "https://osf.io/ezcuj/",
"self": "https://api.osf.io/v2/nodes/ezcuj/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/ezcuj/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=ezcuj",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/ezcuj/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/nodes/?page=1954",
"meta": {
"per_page": 10,
"total": 19536
},
"next": "https://api.osf.io/v2/nodes/?page=2",
"prev": null
}
}
GET
List all preprints
{{baseUrl}}/nodes/:node_id/preprints/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/preprints/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/preprints/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/preprints/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/preprints/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/preprints/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/preprints/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/preprints/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/preprints/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/preprints/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/preprints/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/preprints/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/preprints/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/preprints/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/preprints/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/preprints/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/preprints/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/preprints/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/preprints/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/preprints/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/preprints/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/preprints/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/preprints/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/preprints/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/preprints/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/preprints/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/preprints/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/preprints/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/preprints/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/preprints/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/preprints/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/preprints/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/preprints/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/preprints/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/preprints/
http GET {{baseUrl}}/nodes/:node_id/preprints/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/preprints/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/preprints/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_created": "2016-08-29T14:53:51.185000",
"date_modified": "2016-08-29T14:53:51.185000",
"date_published": "2016-08-29T14:53:51.185000",
"doi": "10.1371/journal.pbio.1002456",
"is_preprint_orphan": false,
"is_published": true,
"license_record": null,
"subjects": [
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecaab8",
"text": "Public Affairs, Public Policy and Public Administration"
},
{
"id": "584240d954be81056cecaa10",
"text": "Science and Technology Policy"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecab33",
"text": "Library and Information Science"
},
{
"id": "584240db54be81056cecacd2",
"text": "Scholarly Publishing"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac68",
"text": "Psychology"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac68",
"text": "Psychology"
}
]
]
},
"id": "khbvy",
"links": {
"doi": "https://dx.doi.org/10.1371/journal.pbio.1002456",
"html": "https://osf.io/khbvy/",
"self": "https://api.osf.io/v2/preprints/khbvy/"
},
"relationships": {
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/khbvy/citation/",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bnzx5/",
"meta": {}
}
}
},
"primary_file": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/57c44b1e594d90004a421ab1/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/",
"meta": {}
}
}
}
},
"type": "preprints"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all registrations
{{baseUrl}}/nodes/:node_id/registrations/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/registrations/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/registrations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/registrations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/registrations/
http GET {{baseUrl}}/nodes/:node_id/registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read"
],
"date_created": "2017-02-12T18:45:55.063000",
"date_modified": "2017-02-12T19:22:26.488000",
"date_registered": "2017-02-12T19:28:48.864000",
"description": "",
"embargo_end_date": null,
"fork": false,
"node_license": null,
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/node_links/",
"meta": {}
}
}
},
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": true,
"registered_meta": {
"summary": {
"comments": [],
"extra": [],
"value": "This pre-registration is an updated data collection and analysis plan. See https://osf.io/ptcqw/ for original data collection rule and https://osf.io/8jyu8/ for original analysis plan. We are collecting more data given that results after original data collection were inconclusive."
}
},
"registration": true,
"registration_supplement": "Open-Ended Registration",
"tags": [],
"title": "How Awareness Impacts Multiple Forms of Social Bias in Behavior (Final Data Collection and Analysis Plan)",
"withdrawal_justification": null,
"withdrawn": false
},
"id": "esa63",
"links": {
"html": "https://osf.io/esa63/",
"self": "https://api.osf.io/v2/registrations/esa63/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/comments/?filter%5Btarget%5D=esa63",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/esa63/relationships/linked_nodes/",
"meta": {}
}
}
},
"linked_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/linked_registrations/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/esa63/relationships/linked_registrations/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/logs/",
"meta": {}
}
}
},
"registered_by": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/ztdnp/",
"meta": {}
}
}
},
"registered_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/dpfyv/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"related": {
"href": "https://api.osf.io/v2/metaschemas/564d31db8c5e4a7c9694b2be/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/esa63/wikis/",
"meta": {}
}
}
}
},
"type": "registrations"
}
}
GET
List all storage providers
{{baseUrl}}/nodes/:node_id/files/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/files/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/files/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/files/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/files/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/files/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/files/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/files/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/files/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/files/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/files/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/files/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/files/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/files/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/files/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/files/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/files/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/files/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/files/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/files/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/files/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/files/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/files/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/files/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/files/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/files/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/files/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/files/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/files/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/files/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/files/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/files/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/files/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/files/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/files/
http GET {{baseUrl}}/nodes/:node_id/files/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/files/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/files/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"kind": "folder",
"name": "osfstorage",
"node": "ezcuj",
"path": "/",
"provider": "osfstorage"
},
"id": "ezcuj:osfstorage",
"links": {
"new_folder": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/?kind=folder",
"storage_addons": "https://api.osf.io/v2/addons/?filter%5Bcategories%5D=storage",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/"
},
"relationships": {
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/files/osfstorage/",
"meta": {}
}
}
}
},
"type": "files"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all view only links
{{baseUrl}}/nodes/:node_id/view_only_links/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/view_only_links/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/view_only_links/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/view_only_links/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/view_only_links/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/view_only_links/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/view_only_links/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/view_only_links/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/view_only_links/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/view_only_links/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/view_only_links/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/view_only_links/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/view_only_links/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/view_only_links/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/view_only_links/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/view_only_links/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/view_only_links/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/view_only_links/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/view_only_links/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/view_only_links/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/view_only_links/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/view_only_links/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/view_only_links/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/view_only_links/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/view_only_links/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/view_only_links/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/view_only_links/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/view_only_links/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/view_only_links/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/view_only_links/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/view_only_links/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/view_only_links/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/view_only_links/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/view_only_links/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/view_only_links/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/view_only_links/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/view_only_links/
http GET {{baseUrl}}/nodes/:node_id/view_only_links/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/view_only_links/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/view_only_links/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"anonymous": false,
"date_created": "2017-03-20T20:15:02.488643",
"key": "c1df490be3294a9bac01ff05c4097ab7",
"name": "vol name"
},
"id": "58d03846a170c50025baae61",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/view_only_links/58d03846a170c50025baae61/"
},
"relationships": {
"creator": {
"links": {
"related": {
"href": "http://api.osf.io/v2/users/4xpu9/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://api.osf.io/v2/view_only_links/58d03846a170c50025baae61/nodes/",
"meta": {}
},
"self": {
"href": "http://api.osf.io/v2/view_only_links/58d03846a170c50025baae61/relationships/nodes/",
"meta": {}
}
}
}
},
"type": "view_only_links"
},
{
"attributes": {
"anonymous": false,
"date_created": "2017-03-21T14:26:47.507504",
"key": "9794ac36085e4d7086ff4dab49daf1cb",
"name": "vol name"
},
"id": "58d13827a170c50025baae6e",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/view_only_links/58d13827a170c50025baae6e/"
},
"relationships": {
"creator": {
"links": {
"related": {
"href": "http://api.osf.io/v2/users/4xpu9/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://api.osf.io/v2/view_only_links/58d13827a170c50025baae6e/nodes/",
"meta": {}
},
"self": {
"href": "http://api.osf.io/v2/view_only_links/58d13827a170c50025baae6e/relationships/nodes/",
"meta": {}
}
}
}
},
"type": "view_only_links"
}
],
"links": {
"first": null,
"last": null,
"meta": null,
"next": null,
"per_page": 10,
"prev": null,
"total": 2
}
}
GET
List all wikis
{{baseUrl}}/nodes/:node_id/wikis/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/wikis/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/wikis/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/wikis/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/wikis/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/wikis/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/wikis/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/wikis/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/wikis/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/wikis/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/wikis/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/wikis/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/wikis/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/wikis/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/wikis/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/wikis/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/wikis/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/wikis/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/wikis/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/wikis/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/wikis/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/wikis/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/wikis/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/wikis/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/wikis/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/wikis/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/wikis/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/wikis/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/wikis/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/wikis/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/wikis/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/wikis/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/wikis/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/wikis/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/wikis/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/wikis/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/wikis/
http GET {{baseUrl}}/nodes/:node_id/wikis/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/wikis/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/wikis/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"content_type": "text/markdown",
"current_user_can_comment": true,
"date_modified": "2017-02-16T15:45:57.671957",
"extra": {
"version": 47
},
"kind": "file",
"materialized_path": "/zveyb",
"name": "home",
"path": "/zveyb",
"size": 552
},
"id": "xu77p",
"links": {
"download": "https://api.osf.io/v2/wikis/zveyb/content/",
"info": "https://api.osf.io/v2/wikis/zveyb/",
"self": "https://api.osf.io/v2/wikis/zveyb/"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/tvyxz/comments/?filter%5Btarget%5D=zveyb",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/tvyxz/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/5k3hq/",
"meta": {}
}
}
}
},
"type": "wikis"
}
],
"links": {
"first": "",
"last": "https://api.osf.io/v2/wikis/zveyb/?page=2",
"meta": {
"per_page": 10,
"total": 12
},
"next": "https://api.osf.io/v2/wikis/zveyb/?page=2",
"prev": ""
}
}
GET
Retrieve a contributor
{{baseUrl}}/nodes/:node_id/contributors/:user_id/
QUERY PARAMS
node_id
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/contributors/:user_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/contributors/:user_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/contributors/:user_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/contributors/:user_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/contributors/:user_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/contributors/:user_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/contributors/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/contributors/:user_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/contributors/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/contributors/:user_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/contributors/:user_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/contributors/:user_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/contributors/:user_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/contributors/:user_id/
http GET {{baseUrl}}/nodes/:node_id/contributors/:user_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/contributors/:user_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2014-03-18T19:11:57.252000",
"family_name": "Geiger",
"full_name": "Brian J. Geiger",
"given_name": "Brian",
"locale": "en_us",
"middle_names": "J.",
"suffix": "",
"timezone": "America/New_York"
},
"id": "typ46",
"links": {
"html": "https://osf.io/typ46/",
"profile_image": "https://secure.gravatar.com/avatar/3dd8757ba100b8406413706886243811?d=identicon",
"self": "https://api.osf.io/v2/users/typ46/"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/typ46/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/typ46/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/typ46/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "y9jdt-typ46",
"links": {
"self": "https://api.osf.io/v2/nodes/y9jdt/contributors/typ46/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/y9jdt/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/typ46/",
"meta": {}
}
}
}
},
"type": "contributors"
}
}
GET
Retrieve a file (GET)
{{baseUrl}}/nodes/:node_id/files/:provider/:path/
QUERY PARAMS
node_id
provider
path
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/files/:provider/:path/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/files/:provider/:path/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/files/:provider/:path/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/files/:provider/:path/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/files/:provider/:path/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/files/:provider/:path/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/files/:provider/:path/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/files/:provider/:path/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/files/:provider/:path/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/:provider/:path/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/files/:provider/:path/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/files/:provider/:path/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/:provider/:path/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/files/:provider/:path/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/files/:provider/:path/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/:provider/:path/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/files/:provider/:path/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/:provider/:path/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/files/:provider/:path/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/:provider/:path/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/files/:provider/:path/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/files/:provider/:path/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/files/:provider/:path/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/files/:provider/:path/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/files/:provider/:path/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/files/:provider/:path/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/files/:provider/:path/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/files/:provider/:path/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/files/:provider/:path/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/files/:provider/:path/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/files/:provider/:path/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/files/:provider/:path/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/files/:provider/:path/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/files/:provider/:path/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/files/:provider/:path/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/files/:provider/:path/
http GET {{baseUrl}}/nodes/:node_id/files/:provider/:path/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/files/:provider/:path/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/files/:provider/:path/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"checkout": null,
"current_user_can_comment": true,
"current_version": 1,
"date_created": "2014-10-17T19:24:12.264Z",
"date_modified": "2014-10-17T19:24:12.264Z",
"delete_allowed": true,
"extra": {
"downloads": 447,
"hashes": {
"md5": "44325d4f13b09f3769ede09d7c20a82c",
"sha256": "2450eb9ff3db92a1bff370368b0552b270bd4b5ca0745b773c37d2662f94df8e"
}
},
"guid": "sejcv",
"kind": "file",
"last_touched": "2015-09-18T01:11:16.328000",
"materialized_path": "/OSC2012.pdf",
"name": "OSC2012.pdf",
"path": "/553e69248c5e4a219919ea54",
"provider": "osfstorage",
"size": 216945,
"tags": []
},
"id": "553e69248c5e4a219919ea54",
"links": {
"delete": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"download": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"info": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"move": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=sejcv",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"versions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/",
"meta": {}
}
}
}
},
"type": "files"
}
}
GET
Retrieve a node
{{baseUrl}}/nodes/:node_id/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/
http GET {{baseUrl}}/nodes/:node_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read"
],
"date_created": "2013-10-08T23:31:56.153000",
"date_modified": "2017-01-18T20:46:11.076000",
"description": "We are conducting a study to investigate the replicability of cancer biology studies. Selected results from a substantial number of high-profile papers in the field of cancer biology published between 2010-2012 are being replicated by the Science Exchange network.",
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [
"cancer biology",
"reproducibility",
"replication",
"open science"
],
"title": "Reproducibility Project: Cancer Biology"
},
"id": "e81xl",
"links": {
"html": "https://osf.io/e81xl/",
"self": "https://api.osf.io/v2/nodes/e81xl/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/e81xl/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/comments/?filter%5Btarget%5D=e81xl",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/e81xl/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
}
GET
Retrieve a storage provider
{{baseUrl}}/nodes/:node_id/files/providers/:provider/
QUERY PARAMS
node_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/files/providers/:provider/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/files/providers/:provider/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/files/providers/:provider/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/files/providers/:provider/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/files/providers/:provider/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/files/providers/:provider/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/files/providers/:provider/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/files/providers/:provider/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/files/providers/:provider/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/providers/:provider/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/files/providers/:provider/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/files/providers/:provider/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/providers/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/files/providers/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/files/providers/:provider/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/files/providers/:provider/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/files/providers/:provider/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/providers/:provider/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/files/providers/:provider/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/files/providers/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/files/providers/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/files/providers/:provider/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/files/providers/:provider/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/files/providers/:provider/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/files/providers/:provider/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/files/providers/:provider/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/files/providers/:provider/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/files/providers/:provider/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/files/providers/:provider/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/files/providers/:provider/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/files/providers/:provider/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/files/providers/:provider/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/files/providers/:provider/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/files/providers/:provider/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/files/providers/:provider/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/files/providers/:provider/
http GET {{baseUrl}}/nodes/:node_id/files/providers/:provider/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/files/providers/:provider/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/files/providers/:provider/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"kind": "folder",
"name": "osfstorage",
"node": "ezcuj",
"path": "/",
"provider": "osfstorage"
},
"id": "ezcuj:osfstorage",
"links": {
"new_folder": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/?kind=folder",
"storage_addons": "https://api.osf.io/v2/addons/?filter%5Bcategories%5D=storage",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/"
},
"relationships": {
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/files/osfstorage/",
"meta": {}
}
}
}
},
"type": "files"
}
]
}
GET
Retrieve a styled citation
{{baseUrl}}/nodes/:node_id/citation/:style_id/
QUERY PARAMS
style_id
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/citation/:style_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/citation/:style_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/citation/:style_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/citation/:style_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/citation/:style_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/citation/:style_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/citation/:style_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/citation/:style_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/citation/:style_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/citation/:style_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/citation/:style_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/citation/:style_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/citation/:style_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/citation/:style_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/citation/:style_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/citation/:style_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/citation/:style_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/citation/:style_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/citation/:style_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/citation/:style_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/citation/:style_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/citation/:style_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/citation/:style_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/citation/:style_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/citation/:style_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/citation/:style_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/citation/:style_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/citation/:style_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/citation/:style_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/citation/:style_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/citation/:style_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/citation/:style_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/citation/:style_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/citation/:style_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/citation/:style_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/citation/:style_id/
http GET {{baseUrl}}/nodes/:node_id/citation/:style_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/citation/:style_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/citation/:style_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"citation": "Aarts, A. A., Anderson, C. J., Anderson, J., van Assen, M. A. L. M., Attridge, P. R., Attwood, A. S., … Grange, J. (2016, December 8). Reproducibility Project: Psychology. Retrieved from osf.io/ezcuj"
},
"id": "apa",
"links": {},
"type": "styled-citations"
}
}
GET
Retrieve a view only link
{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/
QUERY PARAMS
node_id
link_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/view_only_links/:link_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/view_only_links/:link_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/view_only_links/:link_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/view_only_links/:link_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/view_only_links/:link_id/
http GET {{baseUrl}}/nodes/:node_id/view_only_links/:link_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/view_only_links/:link_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/view_only_links/:link_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
null
GET
Retrieve an addon
{{baseUrl}}/nodes/:node_id/addons/:provider/
QUERY PARAMS
node_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/addons/:provider/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/addons/:provider/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/addons/:provider/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/addons/:provider/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/addons/:provider/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/addons/:provider/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/addons/:provider/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/addons/:provider/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/addons/:provider/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/:provider/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/addons/:provider/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/addons/:provider/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/addons/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/:provider/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/addons/:provider/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/addons/:provider/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/addons/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/addons/:provider/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/addons/:provider/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/addons/:provider/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/addons/:provider/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/addons/:provider/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/addons/:provider/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/addons/:provider/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/addons/:provider/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/addons/:provider/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/addons/:provider/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/addons/:provider/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/addons/:provider/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/addons/:provider/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/addons/:provider/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/addons/:provider/
http GET {{baseUrl}}/nodes/:node_id/addons/:provider/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/addons/:provider/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/addons/:provider/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"configured": false,
"external_account_id": null,
"folder_id": null,
"folder_path": null,
"node_has_auth": false
},
"id": "box",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/addons/box/"
},
"type": "node_addons"
}
}
GET
Retrieve citation details
{{baseUrl}}/nodes/:node_id/citation/
QUERY PARAMS
node_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/citation/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/nodes/:node_id/citation/")
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/citation/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/citation/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/citation/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/citation/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/nodes/:node_id/citation/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/nodes/:node_id/citation/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/citation/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/citation/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/nodes/:node_id/citation/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/nodes/:node_id/citation/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/citation/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/citation/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/citation/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/citation/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/citation/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/citation/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/nodes/:node_id/citation/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/nodes/:node_id/citation/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/citation/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/citation/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/citation/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/citation/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/nodes/:node_id/citation/');
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/citation/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/nodes/:node_id/citation/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/citation/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/citation/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/nodes/:node_id/citation/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/citation/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/citation/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/citation/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/nodes/:node_id/citation/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/citation/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/nodes/:node_id/citation/
http GET {{baseUrl}}/nodes/:node_id/citation/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/nodes/:node_id/citation/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/citation/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"author": [
{
"family": "Errington",
"given": "Timothy M"
},
{
"family": "Vasilevsky",
"given": "Nicole"
},
{
"family": "Haendel",
"given": "Melissa A"
}
],
"publisher": "Open Science Framework",
"title": "Identification Analysis of RP:CB",
"type": "webpage"
},
"id": "bg4di",
"links": {
"self": "osf.io/bg4di"
},
"type": "node-citation"
}
}
PATCH
Update a contributor
{{baseUrl}}/nodes/:node_id/contributors/:user_id/
QUERY PARAMS
node_id
user_id
BODY json
{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/contributors/:user_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/nodes/:node_id/contributors/:user_id/" {:content-type :json
:form-params {:data {:attributes {}
:relationships {:user {:data {:id "guid0"
:type "users"}}}
:type "contributors"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/contributors/:user_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/contributors/:user_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/nodes/:node_id/contributors/:user_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 201
{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/contributors/:user_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {},
relationships: {
user: {
data: {
id: 'guid0',
type: 'users'
}
}
},
type: 'contributors'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/contributors/:user_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{},"relationships":{"user":{"data":{"id":"guid0","type":"users"}}},"type":"contributors"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {},\n "relationships": {\n "user": {\n "data": {\n "id": "guid0",\n "type": "users"\n }\n }\n },\n "type": "contributors"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/contributors/:user_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {},
relationships: {
user: {
data: {
id: 'guid0',
type: 'users'
}
}
},
type: 'contributors'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/contributors/:user_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {},
relationships: {user: {data: {id: 'guid0', type: 'users'}}},
type: 'contributors'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/contributors/:user_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{},"relationships":{"user":{"data":{"id":"guid0","type":"users"}}},"type":"contributors"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ }, @"relationships": @{ @"user": @{ @"data": @{ @"id": @"guid0", @"type": @"users" } } }, @"type": @"contributors" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/contributors/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/contributors/:user_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/contributors/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'user' => [
'data' => [
'id' => 'guid0',
'type' => 'users'
]
]
],
'type' => 'contributors'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/nodes/:node_id/contributors/:user_id/', [
'body' => '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'user' => [
'data' => [
'id' => 'guid0',
'type' => 'users'
]
]
],
'type' => 'contributors'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'user' => [
'data' => [
'id' => 'guid0',
'type' => 'users'
]
]
],
'type' => 'contributors'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/contributors/:user_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/contributors/:user_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/contributors/:user_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/nodes/:node_id/contributors/:user_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
payload = { "data": {
"attributes": {},
"relationships": { "user": { "data": {
"id": "guid0",
"type": "users"
} } },
"type": "contributors"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/contributors/:user_id/"
payload <- "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/contributors/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/nodes/:node_id/contributors/:user_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"user\": {\n \"data\": {\n \"id\": \"guid0\",\n \"type\": \"users\"\n }\n }\n },\n \"type\": \"contributors\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/contributors/:user_id/";
let payload = json!({"data": json!({
"attributes": json!({}),
"relationships": json!({"user": json!({"data": json!({
"id": "guid0",
"type": "users"
})})}),
"type": "contributors"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/nodes/:node_id/contributors/:user_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}'
echo '{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}' | \
http PATCH {{baseUrl}}/nodes/:node_id/contributors/:user_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {},\n "relationships": {\n "user": {\n "data": {\n "id": "guid0",\n "type": "users"\n }\n }\n },\n "type": "contributors"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/contributors/:user_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [],
"relationships": ["user": ["data": [
"id": "guid0",
"type": "users"
]]],
"type": "contributors"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/contributors/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update a draft registration
{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
QUERY PARAMS
node_id
draft_id
BODY json
{
"attributes": {
"category": "",
"current_user_permissions": [],
"datetime_initiated": "",
"datetime_updated": "",
"description": "",
"has_project": false,
"node_license": {
"copyright_holders": [],
"year": 0
},
"registration_metadata": {},
"registration_responses": {},
"tags": [],
"title": ""
},
"id": "",
"links": {
"html": ""
},
"relationships": {
"branched_from": "",
"initiator": "",
"registration_schema": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/" {:content-type :json
:form-params {:data {:relationships {:registration_schema {:data {:id "61e02b6c90de34000ae3447a"
:type "registration_schemas"}}}
:type "draft_registrations"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"),
Content = new StringContent("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
payload := strings.NewReader("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/nodes/:node_id/draft_registrations/:draft_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 235
{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
relationships: {
registration_schema: {
data: {
id: '61e02b6c90de34000ae3447a',
type: 'registration_schemas'
}
}
},
type: 'draft_registrations'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"relationships":{"registration_schema":{"data":{"id":"61e02b6c90de34000ae3447a","type":"registration_schemas"}}},"type":"draft_registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "relationships": {\n "registration_schema": {\n "data": {\n "id": "61e02b6c90de34000ae3447a",\n "type": "registration_schemas"\n }\n }\n },\n "type": "draft_registrations"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/draft_registrations/:draft_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
relationships: {
registration_schema: {
data: {
id: '61e02b6c90de34000ae3447a',
type: 'registration_schemas'
}
}
},
type: 'draft_registrations'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
relationships: {
registration_schema: {data: {id: '61e02b6c90de34000ae3447a', type: 'registration_schemas'}}
},
type: 'draft_registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"relationships":{"registration_schema":{"data":{"id":"61e02b6c90de34000ae3447a","type":"registration_schemas"}}},"type":"draft_registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"relationships": @{ @"registration_schema": @{ @"data": @{ @"id": @"61e02b6c90de34000ae3447a", @"type": @"registration_schemas" } } }, @"type": @"draft_registrations" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'relationships' => [
'registration_schema' => [
'data' => [
'id' => '61e02b6c90de34000ae3447a',
'type' => 'registration_schemas'
]
]
],
'type' => 'draft_registrations'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/', [
'body' => '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'relationships' => [
'registration_schema' => [
'data' => [
'id' => '61e02b6c90de34000ae3447a',
'type' => 'registration_schemas'
]
]
],
'type' => 'draft_registrations'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'relationships' => [
'registration_schema' => [
'data' => [
'id' => '61e02b6c90de34000ae3447a',
'type' => 'registration_schemas'
]
]
],
'type' => 'draft_registrations'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/nodes/:node_id/draft_registrations/:draft_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
payload = { "data": {
"relationships": { "registration_schema": { "data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
} } },
"type": "draft_registrations"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/"
payload <- "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/nodes/:node_id/draft_registrations/:draft_id/') do |req|
req.body = "{\n \"data\": {\n \"relationships\": {\n \"registration_schema\": {\n \"data\": {\n \"id\": \"61e02b6c90de34000ae3447a\",\n \"type\": \"registration_schemas\"\n }\n }\n },\n \"type\": \"draft_registrations\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/";
let payload = json!({"data": json!({
"relationships": json!({"registration_schema": json!({"data": json!({
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
})})}),
"type": "draft_registrations"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}'
echo '{
"data": {
"relationships": {
"registration_schema": {
"data": {
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
}
}
},
"type": "draft_registrations"
}
}' | \
http PATCH {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "relationships": {\n "registration_schema": {\n "data": {\n "id": "61e02b6c90de34000ae3447a",\n "type": "registration_schemas"\n }\n }\n },\n "type": "draft_registrations"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"relationships": ["registration_schema": ["data": [
"id": "61e02b6c90de34000ae3447a",
"type": "registration_schemas"
]]],
"type": "draft_registrations"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/draft_registrations/:draft_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update a node
{{baseUrl}}/nodes/:node_id/
QUERY PARAMS
node_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/nodes/:node_id/" {:content-type :json
:form-params {:data {:attributes {:description "An updated abstract."
:public true
:tags ["cancer biology" "reproducibility"]}
:id "{node_id}"
:type "nodes"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/nodes/:node_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 232
{
"data": {
"attributes": {
"description": "An updated abstract.",
"public": true,
"tags": [
"cancer biology",
"reproducibility"
]
},
"id": "{node_id}",
"type": "nodes"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/nodes/:node_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/nodes/:node_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
description: 'An updated abstract.',
public: true,
tags: [
'cancer biology',
'reproducibility'
]
},
id: '{node_id}',
type: 'nodes'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/nodes/:node_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
description: 'An updated abstract.',
public: true,
tags: ['cancer biology', 'reproducibility']
},
id: '{node_id}',
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"description":"An updated abstract.","public":true,"tags":["cancer biology","reproducibility"]},"id":"{node_id}","type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "description": "An updated abstract.",\n "public": true,\n "tags": [\n "cancer biology",\n "reproducibility"\n ]\n },\n "id": "{node_id}",\n "type": "nodes"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {
description: 'An updated abstract.',
public: true,
tags: ['cancer biology', 'reproducibility']
},
id: '{node_id}',
type: 'nodes'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {
description: 'An updated abstract.',
public: true,
tags: ['cancer biology', 'reproducibility']
},
id: '{node_id}',
type: 'nodes'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/nodes/:node_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
description: 'An updated abstract.',
public: true,
tags: [
'cancer biology',
'reproducibility'
]
},
id: '{node_id}',
type: 'nodes'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
description: 'An updated abstract.',
public: true,
tags: ['cancer biology', 'reproducibility']
},
id: '{node_id}',
type: 'nodes'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"description":"An updated abstract.","public":true,"tags":["cancer biology","reproducibility"]},"id":"{node_id}","type":"nodes"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"description": @"An updated abstract.", @"public": @YES, @"tags": @[ @"cancer biology", @"reproducibility" ] }, @"id": @"{node_id}", @"type": @"nodes" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'description' => 'An updated abstract.',
'public' => null,
'tags' => [
'cancer biology',
'reproducibility'
]
],
'id' => '{node_id}',
'type' => 'nodes'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/nodes/:node_id/', [
'body' => '{
"data": {
"attributes": {
"description": "An updated abstract.",
"public": true,
"tags": [
"cancer biology",
"reproducibility"
]
},
"id": "{node_id}",
"type": "nodes"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'description' => 'An updated abstract.',
'public' => null,
'tags' => [
'cancer biology',
'reproducibility'
]
],
'id' => '{node_id}',
'type' => 'nodes'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'description' => 'An updated abstract.',
'public' => null,
'tags' => [
'cancer biology',
'reproducibility'
]
],
'id' => '{node_id}',
'type' => 'nodes'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"description": "An updated abstract.",
"public": true,
"tags": [
"cancer biology",
"reproducibility"
]
},
"id": "{node_id}",
"type": "nodes"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"description": "An updated abstract.",
"public": true,
"tags": [
"cancer biology",
"reproducibility"
]
},
"id": "{node_id}",
"type": "nodes"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/nodes/:node_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/"
payload = { "data": {
"attributes": {
"description": "An updated abstract.",
"public": True,
"tags": ["cancer biology", "reproducibility"]
},
"id": "{node_id}",
"type": "nodes"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/nodes/:node_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"description\": \"An updated abstract.\",\n \"public\": true,\n \"tags\": [\n \"cancer biology\",\n \"reproducibility\"\n ]\n },\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/";
let payload = json!({"data": json!({
"attributes": json!({
"description": "An updated abstract.",
"public": true,
"tags": ("cancer biology", "reproducibility")
}),
"id": "{node_id}",
"type": "nodes"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/nodes/:node_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"description": "An updated abstract.",
"public": true,
"tags": [
"cancer biology",
"reproducibility"
]
},
"id": "{node_id}",
"type": "nodes"
}
}'
echo '{
"data": {
"attributes": {
"description": "An updated abstract.",
"public": true,
"tags": [
"cancer biology",
"reproducibility"
]
},
"id": "{node_id}",
"type": "nodes"
}
}' | \
http PATCH {{baseUrl}}/nodes/:node_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "description": "An updated abstract.",\n "public": true,\n "tags": [\n "cancer biology",\n "reproducibility"\n ]\n },\n "id": "{node_id}",\n "type": "nodes"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"description": "An updated abstract.",
"public": true,
"tags": ["cancer biology", "reproducibility"]
],
"id": "{node_id}",
"type": "nodes"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update an addon
{{baseUrl}}/nodes/:node_id/addons/:provider/
QUERY PARAMS
node_id
provider
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/nodes/:node_id/addons/:provider/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/nodes/:node_id/addons/:provider/" {:content-type :json
:form-params {:data {:attributes {:external_account_id "{account_id}"
:folder_id "{folder_id}"
:folder_path "{folder_path}"
:label "{label}"
:url "{url}"}
:id "{provider}"
:type "node_addons"}}})
require "http/client"
url = "{{baseUrl}}/nodes/:node_id/addons/:provider/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/nodes/:node_id/addons/:provider/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/nodes/:node_id/addons/:provider/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/nodes/:node_id/addons/:provider/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/nodes/:node_id/addons/:provider/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 260
{
"data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/nodes/:node_id/addons/:provider/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/nodes/:node_id/addons/:provider/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/:provider/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/nodes/:node_id/addons/:provider/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
external_account_id: '{account_id}',
folder_id: '{folder_id}',
folder_path: '{folder_path}',
label: '{label}',
url: '{url}'
},
id: '{provider}',
type: 'node_addons'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/nodes/:node_id/addons/:provider/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
external_account_id: '{account_id}',
folder_id: '{folder_id}',
folder_path: '{folder_path}',
label: '{label}',
url: '{url}'
},
id: '{provider}',
type: 'node_addons'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/nodes/:node_id/addons/:provider/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"external_account_id":"{account_id}","folder_id":"{folder_id}","folder_path":"{folder_path}","label":"{label}","url":"{url}"},"id":"{provider}","type":"node_addons"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "external_account_id": "{account_id}",\n "folder_id": "{folder_id}",\n "folder_path": "{folder_path}",\n "label": "{label}",\n "url": "{url}"\n },\n "id": "{provider}",\n "type": "node_addons"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/nodes/:node_id/addons/:provider/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/nodes/:node_id/addons/:provider/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {
external_account_id: '{account_id}',
folder_id: '{folder_id}',
folder_path: '{folder_path}',
label: '{label}',
url: '{url}'
},
id: '{provider}',
type: 'node_addons'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {
external_account_id: '{account_id}',
folder_id: '{folder_id}',
folder_path: '{folder_path}',
label: '{label}',
url: '{url}'
},
id: '{provider}',
type: 'node_addons'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/nodes/:node_id/addons/:provider/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
external_account_id: '{account_id}',
folder_id: '{folder_id}',
folder_path: '{folder_path}',
label: '{label}',
url: '{url}'
},
id: '{provider}',
type: 'node_addons'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/nodes/:node_id/addons/:provider/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
external_account_id: '{account_id}',
folder_id: '{folder_id}',
folder_path: '{folder_path}',
label: '{label}',
url: '{url}'
},
id: '{provider}',
type: 'node_addons'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/nodes/:node_id/addons/:provider/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"external_account_id":"{account_id}","folder_id":"{folder_id}","folder_path":"{folder_path}","label":"{label}","url":"{url}"},"id":"{provider}","type":"node_addons"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"external_account_id": @"{account_id}", @"folder_id": @"{folder_id}", @"folder_path": @"{folder_path}", @"label": @"{label}", @"url": @"{url}" }, @"id": @"{provider}", @"type": @"node_addons" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/nodes/:node_id/addons/:provider/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/nodes/:node_id/addons/:provider/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/nodes/:node_id/addons/:provider/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'external_account_id' => '{account_id}',
'folder_id' => '{folder_id}',
'folder_path' => '{folder_path}',
'label' => '{label}',
'url' => '{url}'
],
'id' => '{provider}',
'type' => 'node_addons'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/nodes/:node_id/addons/:provider/', [
'body' => '{
"data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/nodes/:node_id/addons/:provider/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'external_account_id' => '{account_id}',
'folder_id' => '{folder_id}',
'folder_path' => '{folder_path}',
'label' => '{label}',
'url' => '{url}'
],
'id' => '{provider}',
'type' => 'node_addons'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'external_account_id' => '{account_id}',
'folder_id' => '{folder_id}',
'folder_path' => '{folder_path}',
'label' => '{label}',
'url' => '{url}'
],
'id' => '{provider}',
'type' => 'node_addons'
]
]));
$request->setRequestUrl('{{baseUrl}}/nodes/:node_id/addons/:provider/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/nodes/:node_id/addons/:provider/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/nodes/:node_id/addons/:provider/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/nodes/:node_id/addons/:provider/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/nodes/:node_id/addons/:provider/"
payload = { "data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/nodes/:node_id/addons/:provider/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/nodes/:node_id/addons/:provider/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/nodes/:node_id/addons/:provider/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"external_account_id\": \"{account_id}\",\n \"folder_id\": \"{folder_id}\",\n \"folder_path\": \"{folder_path}\",\n \"label\": \"{label}\",\n \"url\": \"{url}\"\n },\n \"id\": \"{provider}\",\n \"type\": \"node_addons\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/nodes/:node_id/addons/:provider/";
let payload = json!({"data": json!({
"attributes": json!({
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
}),
"id": "{provider}",
"type": "node_addons"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/nodes/:node_id/addons/:provider/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
}
}'
echo '{
"data": {
"attributes": {
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
},
"id": "{provider}",
"type": "node_addons"
}
}' | \
http PATCH {{baseUrl}}/nodes/:node_id/addons/:provider/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "external_account_id": "{account_id}",\n "folder_id": "{folder_id}",\n "folder_path": "{folder_path}",\n "label": "{label}",\n "url": "{url}"\n },\n "id": "{provider}",\n "type": "node_addons"\n }\n}' \
--output-document \
- {{baseUrl}}/nodes/:node_id/addons/:provider/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"external_account_id": "{account_id}",
"folder_id": "{folder_id}",
"folder_path": "{folder_path}",
"label": "{label}",
"url": "{url}"
],
"id": "{provider}",
"type": "node_addons"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/nodes/:node_id/addons/:provider/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all licenses (GET)
{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/
QUERY PARAMS
preprint_provider_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")
require "http/client"
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprint_providers/:preprint_provider_id/licenses/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprint_providers/:preprint_provider_id/licenses/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprint_providers/:preprint_provider_id/licenses/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprint_providers/:preprint_provider_id/licenses/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/
http GET {{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprint_providers/:preprint_provider_id/licenses/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"name": "No license",
"required_fields": [
"year",
"copyrightHolders"
],
"text": "Copyright {{year}} {{copyrightHolders}}"
},
"id": "563c1cf88c5e4a3877f9e965",
"links": {
"self": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e965/"
},
"type": "licenses"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 3
},
"next": null,
"prev": null
}
}
GET
List all preprint providers
{{baseUrl}}/preprint_providers/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprint_providers/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprint_providers/")
require "http/client"
url = "{{baseUrl}}/preprint_providers/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprint_providers/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprint_providers/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprint_providers/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprint_providers/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprint_providers/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprint_providers/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprint_providers/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprint_providers/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprint_providers/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/preprint_providers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprint_providers/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprint_providers/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprint_providers/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprint_providers/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/preprint_providers/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprint_providers/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/preprint_providers/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprint_providers/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprint_providers/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprint_providers/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprint_providers/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprint_providers/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprint_providers/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprint_providers/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprint_providers/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprint_providers/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprint_providers/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprint_providers/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprint_providers/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprint_providers/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprint_providers/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprint_providers/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprint_providers/
http GET {{baseUrl}}/preprint_providers/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprint_providers/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprint_providers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"advisory_board": "",
"banner_path": "/static/img/preprint_providers/cos-logo.png",
"description": "A scholarly commons to connect the entire research cycle",
"domain": "osf.io",
"email_contact": "",
"email_support": "",
"example": "khbvy",
"header_text": "",
"logo_path": "/static/img/preprint_providers/cos-logo.png",
"name": "Open Science Framework",
"social_facebook": "",
"social_instagram": "",
"social_twitter": "",
"subjects_acceptable": []
},
"id": "osf",
"links": {
"external_url": "https://osf.io/preprints/",
"preprints": "https://api.osf.io/v2/preprint_providers/osf/preprints/",
"self": "https://api.osf.io/v2/preprint_providers/osf/"
},
"relationships": {
"licenses_acceptable": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/licenses/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/preprints/",
"meta": {}
}
}
},
"taxonomies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/taxonomies/",
"meta": {}
}
}
}
},
"type": "preprint_providers"
}
]
}
GET
List all preprints (GET)
{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/
QUERY PARAMS
preprint_provider_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")
require "http/client"
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprint_providers/:preprint_provider_id/preprints/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprint_providers/:preprint_provider_id/preprints/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprint_providers/:preprint_provider_id/preprints/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprint_providers/:preprint_provider_id/preprints/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/
http GET {{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprint_providers/:preprint_provider_id/preprints/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_created": "2017-02-03T06:16:57.129000",
"date_modified": "2017-02-03T06:19:00.158000",
"date_published": "2017-02-03T06:18:59.788000",
"doi": null,
"is_preprint_orphan": false,
"is_published": true,
"license_record": {
"copyright_holders": [],
"year": "2017"
},
"subjects": [
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac1a",
"text": "Political Science"
}
]
]
},
"id": "hqb2p",
"links": {
"html": "https://osf.io/preprints/socarxiv/hqb2p/",
"self": "https://api.osf.io/v2/preprints/hqb2p/"
},
"relationships": {
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/hqb2p/citation/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/5xuck/",
"meta": {}
}
}
},
"primary_file": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/5894204f594d900200ed23f2/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/socarxiv/",
"meta": {}
}
}
}
},
"type": "preprints"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/preprints/?page=172",
"meta": {
"per_page": 10,
"total": 1720
},
"next": "https://api.osf.io/v2/preprints/?page=2",
"prev": null
}
}
GET
List all taxonomies
{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/
QUERY PARAMS
preprint_provider_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")
require "http/client"
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprint_providers/:preprint_provider_id/taxonomies/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprint_providers/:preprint_provider_id/taxonomies/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprint_providers/:preprint_provider_id/taxonomies/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprint_providers/:preprint_provider_id/taxonomies/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/
http GET {{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprint_providers/:preprint_provider_id/taxonomies/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240d954be81056ceca97a",
"text": "Philosophy"
}
],
"text": "History of Philosophy"
},
"id": "584240d854be81056ceca838",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240d954be81056ceca97a/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d854be81056ceca838/"
},
"type": "taxonomies"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/preprint_providers/osf/taxonomies/?page=122",
"meta": {
"per_page": 10,
"total": 1217
},
"next": "https://api.osf.io/v2/preprint_providers/osf/taxonomies/?page=2",
"prev": null
}
}
GET
Retrieve a preprint provider
{{baseUrl}}/preprint_providers/:preprint_provider_id/
QUERY PARAMS
preprint_provider_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprint_providers/:preprint_provider_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprint_providers/:preprint_provider_id/")
require "http/client"
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprint_providers/:preprint_provider_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprint_providers/:preprint_provider_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprint_providers/:preprint_provider_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprint_providers/:preprint_provider_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprint_providers/:preprint_provider_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprint_providers/:preprint_provider_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprint_providers/:preprint_provider_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprint_providers/:preprint_provider_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprint_providers/:preprint_provider_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprint_providers/:preprint_provider_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprint_providers/:preprint_provider_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprint_providers/:preprint_provider_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprint_providers/:preprint_provider_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprint_providers/:preprint_provider_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprint_providers/:preprint_provider_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprint_providers/:preprint_provider_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprint_providers/:preprint_provider_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprint_providers/:preprint_provider_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprint_providers/:preprint_provider_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprint_providers/:preprint_provider_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprint_providers/:preprint_provider_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprint_providers/:preprint_provider_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprint_providers/:preprint_provider_id/
http GET {{baseUrl}}/preprint_providers/:preprint_provider_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprint_providers/:preprint_provider_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprint_providers/:preprint_provider_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"advisory_board": "",
"banner_path": "/static/img/preprint_providers/cos-logo.png",
"description": "A scholarly commons to connect the entire research cycle",
"domain": "osf.io",
"email_contact": "",
"email_support": "",
"example": "khbvy",
"header_text": "",
"logo_path": "/static/img/preprint_providers/cos-logo.png",
"name": "Open Science Framework",
"social_facebook": "",
"social_instagram": "",
"social_twitter": "",
"subjects_acceptable": []
},
"id": "osf",
"links": {
"external_url": "https://osf.io/preprints/",
"preprints": "https://api.osf.io/v2/preprint_providers/osf/preprints/",
"self": "https://api.osf.io/v2/preprint_providers/osf/"
},
"relationships": {
"licenses_acceptable": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/licenses/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/preprints/",
"meta": {}
}
}
},
"taxonomies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/taxonomies/",
"meta": {}
}
}
}
},
"type": "preprint_providers"
},
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 5
},
"next": null,
"prev": null
}
}
POST
Create a Contributor
{{baseUrl}}/preprints/:preprint_id/contributors/
QUERY PARAMS
preprint_id
BODY json
{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/contributors/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/preprints/:preprint_id/contributors/" {:content-type :json
:form-params {:attributes {:bibliographic false
:index 0
:permission ""
:unregistered_contributor ""}
:id ""
:links {:self ""}
:relationships {:node ""
:user ""}
:type ""}})
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/contributors/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/contributors/"),
Content = new StringContent("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/contributors/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/contributors/"
payload := strings.NewReader("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/preprints/:preprint_id/contributors/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 242
{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/preprints/:preprint_id/contributors/")
.setHeader("content-type", "application/json")
.setBody("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/contributors/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/contributors/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/preprints/:preprint_id/contributors/")
.header("content-type", "application/json")
.body("{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
attributes: {
bibliographic: false,
index: 0,
permission: '',
unregistered_contributor: ''
},
id: '',
links: {
self: ''
},
relationships: {
node: '',
user: ''
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/preprints/:preprint_id/contributors/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/',
headers: {'content-type': 'application/json'},
data: {
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/contributors/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"bibliographic":false,"index":0,"permission":"","unregistered_contributor":""},"id":"","links":{"self":""},"relationships":{"node":"","user":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/contributors/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attributes": {\n "bibliographic": false,\n "index": 0,\n "permission": "",\n "unregistered_contributor": ""\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "node": "",\n "user": ""\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/contributors/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/contributors/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/',
headers: {'content-type': 'application/json'},
body: {
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/preprints/:preprint_id/contributors/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attributes: {
bibliographic: false,
index: 0,
permission: '',
unregistered_contributor: ''
},
id: '',
links: {
self: ''
},
relationships: {
node: '',
user: ''
},
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/',
headers: {'content-type': 'application/json'},
data: {
attributes: {bibliographic: false, index: 0, permission: '', unregistered_contributor: ''},
id: '',
links: {self: ''},
relationships: {node: '', user: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/contributors/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"bibliographic":false,"index":0,"permission":"","unregistered_contributor":""},"id":"","links":{"self":""},"relationships":{"node":"","user":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"attributes": @{ @"bibliographic": @NO, @"index": @0, @"permission": @"", @"unregistered_contributor": @"" },
@"id": @"",
@"links": @{ @"self": @"" },
@"relationships": @{ @"node": @"", @"user": @"" },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/contributors/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
'bibliographic' => null,
'index' => 0,
'permission' => '',
'unregistered_contributor' => ''
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'node' => '',
'user' => ''
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/preprints/:preprint_id/contributors/', [
'body' => '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/contributors/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attributes' => [
'bibliographic' => null,
'index' => 0,
'permission' => '',
'unregistered_contributor' => ''
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'node' => '',
'user' => ''
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attributes' => [
'bibliographic' => null,
'index' => 0,
'permission' => '',
'unregistered_contributor' => ''
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'node' => '',
'user' => ''
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/preprints/:preprint_id/contributors/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/contributors/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/contributors/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/preprints/:preprint_id/contributors/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/contributors/"
payload = {
"attributes": {
"bibliographic": False,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": { "self": "" },
"relationships": {
"node": "",
"user": ""
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/contributors/"
payload <- "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/preprints/:preprint_id/contributors/') do |req|
req.body = "{\n \"attributes\": {\n \"bibliographic\": false,\n \"index\": 0,\n \"permission\": \"\",\n \"unregistered_contributor\": \"\"\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"node\": \"\",\n \"user\": \"\"\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/contributors/";
let payload = json!({
"attributes": json!({
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
}),
"id": "",
"links": json!({"self": ""}),
"relationships": json!({
"node": "",
"user": ""
}),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/preprints/:preprint_id/contributors/ \
--header 'content-type: application/json' \
--data '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}'
echo '{
"attributes": {
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"node": "",
"user": ""
},
"type": ""
}' | \
http POST {{baseUrl}}/preprints/:preprint_id/contributors/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "attributes": {\n "bibliographic": false,\n "index": 0,\n "permission": "",\n "unregistered_contributor": ""\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "node": "",\n "user": ""\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/contributors/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attributes": [
"bibliographic": false,
"index": 0,
"permission": "",
"unregistered_contributor": ""
],
"id": "",
"links": ["self": ""],
"relationships": [
"node": "",
"user": ""
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bibliographic": true,
"index": 1,
"permission": "write",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2022-05-04T19:39:33.138339",
"education": [],
"employment": [],
"family_name": "Mercury1",
"full_name": "Freddie Mercury1",
"given_name": "Freddie",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "faqpw",
"links": {
"html": "https://osf.io/faqpw/",
"profile_image": "https://secure.gravatar.com/avatar/c9ac5d6cc7964ba7eb2bb96f877bc983?d=identicon",
"self": "https://api.osf.io/v2/users/faqpw/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/faqpw/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "bg8v7-faqpw",
"links": {
"self": "https://api.osf.io/v2/preprints/bg8v7/contributors/faqpw/"
},
"relationships": {
"preprint": {
"data": {
"id": "bg8v7",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/bg8v7/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "faqpw",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/",
"meta": {}
}
}
}
},
"type": "contributors"
},
"meta": {
"version": "2.0"
}
}
POST
Create a preprint
{{baseUrl}}/preprints/
BODY json
{
"attributes": {
"date_created": "",
"date_modified": "",
"date_published": "",
"doi": "",
"is_preprint_orphan": false,
"license_record": "",
"subjects": []
},
"id": "",
"links": {
"doi": "",
"html": "",
"preprint_doi": "",
"self": ""
},
"relationships": {
"bibliographic_contributors": "",
"citation": "",
"identifiers": "",
"license": "",
"node": "",
"primary_file": "",
"provider": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/preprints/" {:content-type :json
:form-params {:data {:attributes {}
:relationships {:node {:data {:id "{node_id}"
:type "nodes"}}
:primary_file {:data {:id "{primary_file_id}"
:type "primary_files"}}
:provider {:data {:id "{preprint_provider_id}"
:type "providers"}}}}}})
require "http/client"
url = "{{baseUrl}}/preprints/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/preprints/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/preprints/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 438
{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/preprints/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/preprints/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {},
relationships: {
node: {
data: {
id: '{node_id}',
type: 'nodes'
}
},
primary_file: {
data: {
id: '{primary_file_id}',
type: 'primary_files'
}
},
provider: {
data: {
id: '{preprint_provider_id}',
type: 'providers'
}
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/preprints/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/preprints/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {},
relationships: {
node: {data: {id: '{node_id}', type: 'nodes'}},
primary_file: {data: {id: '{primary_file_id}', type: 'primary_files'}},
provider: {data: {id: '{preprint_provider_id}', type: 'providers'}}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{},"relationships":{"node":{"data":{"id":"{node_id}","type":"nodes"}},"primary_file":{"data":{"id":"{primary_file_id}","type":"primary_files"}},"provider":{"data":{"id":"{preprint_provider_id}","type":"providers"}}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {},\n "relationships": {\n "node": {\n "data": {\n "id": "{node_id}",\n "type": "nodes"\n }\n },\n "primary_file": {\n "data": {\n "id": "{primary_file_id}",\n "type": "primary_files"\n }\n },\n "provider": {\n "data": {\n "id": "{preprint_provider_id}",\n "type": "providers"\n }\n }\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/preprints/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {},
relationships: {
node: {data: {id: '{node_id}', type: 'nodes'}},
primary_file: {data: {id: '{primary_file_id}', type: 'primary_files'}},
provider: {data: {id: '{preprint_provider_id}', type: 'providers'}}
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/preprints/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {},
relationships: {
node: {data: {id: '{node_id}', type: 'nodes'}},
primary_file: {data: {id: '{primary_file_id}', type: 'primary_files'}},
provider: {data: {id: '{preprint_provider_id}', type: 'providers'}}
}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/preprints/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {},
relationships: {
node: {
data: {
id: '{node_id}',
type: 'nodes'
}
},
primary_file: {
data: {
id: '{primary_file_id}',
type: 'primary_files'
}
},
provider: {
data: {
id: '{preprint_provider_id}',
type: 'providers'
}
}
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/preprints/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {},
relationships: {
node: {data: {id: '{node_id}', type: 'nodes'}},
primary_file: {data: {id: '{primary_file_id}', type: 'primary_files'}},
provider: {data: {id: '{preprint_provider_id}', type: 'providers'}}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{},"relationships":{"node":{"data":{"id":"{node_id}","type":"nodes"}},"primary_file":{"data":{"id":"{primary_file_id}","type":"primary_files"}},"provider":{"data":{"id":"{preprint_provider_id}","type":"providers"}}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ }, @"relationships": @{ @"node": @{ @"data": @{ @"id": @"{node_id}", @"type": @"nodes" } }, @"primary_file": @{ @"data": @{ @"id": @"{primary_file_id}", @"type": @"primary_files" } }, @"provider": @{ @"data": @{ @"id": @"{preprint_provider_id}", @"type": @"providers" } } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'node' => [
'data' => [
'id' => '{node_id}',
'type' => 'nodes'
]
],
'primary_file' => [
'data' => [
'id' => '{primary_file_id}',
'type' => 'primary_files'
]
],
'provider' => [
'data' => [
'id' => '{preprint_provider_id}',
'type' => 'providers'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/preprints/', [
'body' => '{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'node' => [
'data' => [
'id' => '{node_id}',
'type' => 'nodes'
]
],
'primary_file' => [
'data' => [
'id' => '{primary_file_id}',
'type' => 'primary_files'
]
],
'provider' => [
'data' => [
'id' => '{preprint_provider_id}',
'type' => 'providers'
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
],
'relationships' => [
'node' => [
'data' => [
'id' => '{node_id}',
'type' => 'nodes'
]
],
'primary_file' => [
'data' => [
'id' => '{primary_file_id}',
'type' => 'primary_files'
]
],
'provider' => [
'data' => [
'id' => '{preprint_provider_id}',
'type' => 'providers'
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/preprints/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/preprints/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/"
payload = { "data": {
"attributes": {},
"relationships": {
"node": { "data": {
"id": "{node_id}",
"type": "nodes"
} },
"primary_file": { "data": {
"id": "{primary_file_id}",
"type": "primary_files"
} },
"provider": { "data": {
"id": "{preprint_provider_id}",
"type": "providers"
} }
}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/"
payload <- "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/preprints/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {},\n \"relationships\": {\n \"node\": {\n \"data\": {\n \"id\": \"{node_id}\",\n \"type\": \"nodes\"\n }\n },\n \"primary_file\": {\n \"data\": {\n \"id\": \"{primary_file_id}\",\n \"type\": \"primary_files\"\n }\n },\n \"provider\": {\n \"data\": {\n \"id\": \"{preprint_provider_id}\",\n \"type\": \"providers\"\n }\n }\n }\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/";
let payload = json!({"data": json!({
"attributes": json!({}),
"relationships": json!({
"node": json!({"data": json!({
"id": "{node_id}",
"type": "nodes"
})}),
"primary_file": json!({"data": json!({
"id": "{primary_file_id}",
"type": "primary_files"
})}),
"provider": json!({"data": json!({
"id": "{preprint_provider_id}",
"type": "providers"
})})
})
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/preprints/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}'
echo '{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}' | \
http POST {{baseUrl}}/preprints/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {},\n "relationships": {\n "node": {\n "data": {\n "id": "{node_id}",\n "type": "nodes"\n }\n },\n "primary_file": {\n "data": {\n "id": "{primary_file_id}",\n "type": "primary_files"\n }\n },\n "provider": {\n "data": {\n "id": "{preprint_provider_id}",\n "type": "providers"\n }\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/preprints/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [],
"relationships": [
"node": ["data": [
"id": "{node_id}",
"type": "nodes"
]],
"primary_file": ["data": [
"id": "{primary_file_id}",
"type": "primary_files"
]],
"provider": ["data": [
"id": "{preprint_provider_id}",
"type": "providers"
]]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all Bibliographic Contributors
{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/
QUERY PARAMS
preprint_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/:preprint_id/bibliographic_contributors/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/bibliographic_contributors/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/:preprint_id/bibliographic_contributors/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/:preprint_id/bibliographic_contributors/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/
http GET {{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/bibliographic_contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"accepted_terms_of_service": true,
"active": true,
"can_view_reviews": [],
"date_registered": "2022-01-13T13:47:07.685511",
"education": [],
"employment": [],
"family_name": "Mercury0",
"full_name": "Freddie Mercury0",
"given_name": "Freddie",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "fgvc6",
"links": {
"html": "https://osf.io/fgvc6/",
"profile_image": "https://secure.gravatar.com/avatar/a61b3827662ddbc604c78e1c8f6a3636?d=identicon",
"self": "https://api.osf.io/v2/users/fgvc6/"
},
"relationships": {
"default_region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"emails": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/settings/emails/",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/fgvc6/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/registrations/",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "fgvc6",
"type": "user-settings"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/settings/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "bg8v7-fgvc6",
"links": {
"self": "https://api.osf.io/v2/preprints/bg8v7/contributors/fgvc6/"
},
"relationships": {
"preprint": {
"data": {
"id": "bg8v7",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/bg8v7/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "fgvc6",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/",
"meta": {}
}
}
}
},
"type": "contributors"
},
{
"attributes": {
"bibliographic": true,
"index": 1,
"permission": "write",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2022-05-04T19:39:33.138339",
"education": [],
"employment": [],
"family_name": "Mercury1",
"full_name": "Freddie Mercury1",
"given_name": "Freddie",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "faqpw",
"links": {
"html": "https://osf.io/faqpw/",
"profile_image": "https://secure.gravatar.com/avatar/c9ac5d6cc7964ba7eb2bb96f877bc983?d=identicon",
"self": "https://api.osf.io/v2/users/faqpw/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/faqpw/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "bg8v7-faqpw",
"links": {
"self": "https://api.osf.io/v2/preprints/bg8v7/contributors/faqpw/"
},
"relationships": {
"preprint": {
"data": {
"id": "bg8v7",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/bg8v7/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "faqpw",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/",
"meta": {}
}
}
}
},
"type": "contributors"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2,
"total_bibliographic": 2
},
"next": null,
"prev": null
},
"meta": {
"version": "2.0"
}
}
GET
List all Contributors for a Preprint
{{baseUrl}}/preprints/:preprint_id/contributors/
QUERY PARAMS
preprint_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/contributors/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/:preprint_id/contributors/")
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/contributors/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/contributors/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/contributors/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/contributors/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/:preprint_id/contributors/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/:preprint_id/contributors/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/contributors/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/contributors/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/:preprint_id/contributors/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/:preprint_id/contributors/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/contributors/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/contributors/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/contributors/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/:preprint_id/contributors/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/contributors/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/:preprint_id/contributors/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/contributors/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/:preprint_id/contributors/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/contributors/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/contributors/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/:preprint_id/contributors/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/contributors/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/contributors/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/:preprint_id/contributors/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/contributors/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/:preprint_id/contributors/
http GET {{baseUrl}}/preprints/:preprint_id/contributors/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/contributors/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"accepted_terms_of_service": true,
"active": true,
"can_view_reviews": [],
"date_registered": "2022-01-13T13:47:07.685511",
"education": [],
"employment": [],
"family_name": "Mercury0",
"full_name": "Freddie Mercury0",
"given_name": "Freddie",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "fgvc6",
"links": {
"html": "https://osf.io/fgvc6/",
"profile_image": "https://secure.gravatar.com/avatar/a61b3827662ddbc604c78e1c8f6a3636?d=identicon",
"self": "https://api.osf.io/v2/users/fgvc6/"
},
"relationships": {
"default_region": {
"data": {
"id": "us",
"type": "regions"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/regions/us/",
"meta": {}
}
}
},
"emails": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/settings/emails/",
"meta": {}
}
}
},
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/fgvc6/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/registrations/",
"meta": {}
}
}
},
"settings": {
"data": {
"id": "fgvc6",
"type": "user-settings"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/settings/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "bg8v7-fgvc6",
"links": {
"self": "https://api.osf.io/v2/preprints/bg8v7/contributors/fgvc6/"
},
"relationships": {
"preprint": {
"data": {
"id": "bg8v7",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/bg8v7/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "fgvc6",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/fgvc6/",
"meta": {}
}
}
}
},
"type": "contributors"
},
{
"attributes": {
"bibliographic": true,
"index": 1,
"permission": "write",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2022-05-04T19:39:33.138339",
"education": [],
"employment": [],
"family_name": "Mercury1",
"full_name": "Freddie Mercury1",
"given_name": "Freddie",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "faqpw",
"links": {
"html": "https://osf.io/faqpw/",
"profile_image": "https://secure.gravatar.com/avatar/c9ac5d6cc7964ba7eb2bb96f877bc983?d=identicon",
"self": "https://api.osf.io/v2/users/faqpw/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/faqpw/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "bg8v7-faqpw",
"links": {
"self": "https://api.osf.io/v2/preprints/bg8v7/contributors/faqpw/"
},
"relationships": {
"preprint": {
"data": {
"id": "bg8v7",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/bg8v7/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "faqpw",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/",
"meta": {}
}
}
}
},
"type": "contributors"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2,
"total_bibliographic": 2
},
"next": null,
"prev": null
},
"meta": {
"version": "2.0"
}
}
GET
List all preprints (1)
{{baseUrl}}/preprints/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/")
require "http/client"
url = "{{baseUrl}}/preprints/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/preprints/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/preprints/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/preprints/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/
http GET {{baseUrl}}/preprints/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_created": "2017-02-03T06:16:57.129000",
"date_modified": "2017-02-03T06:19:00.158000",
"date_published": "2017-02-03T06:18:59.788000",
"doi": null,
"is_preprint_orphan": false,
"is_published": true,
"license_record": {
"copyright_holders": [],
"year": "2017"
},
"subjects": [
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac1a",
"text": "Political Science"
}
]
]
},
"id": "hqb2p",
"links": {
"html": "https://osf.io/preprints/socarxiv/hqb2p/",
"preprint_doi": "https://dx.doi.org/10.5072/FK2OSF.IO/HQB2P",
"self": "https://api.osf.io/v2/preprints/hqb2p/"
},
"relationships": {
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/hqb2p/citation/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/hqb2p/identifiers/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/5xuck/",
"meta": {}
}
}
},
"primary_file": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/5894204f594d900200ed23f2/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/socarxiv/",
"meta": {}
}
}
}
},
"type": "preprints"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/preprints/?page=172",
"meta": {
"per_page": 10,
"total": 1720
},
"next": "https://api.osf.io/v2/preprints/?page=2",
"prev": null
}
}
GET
Retrieve a contributor (GET)
{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/
QUERY PARAMS
preprint_id
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/:preprint_id/contributors/:user_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/contributors/:user_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/:preprint_id/contributors/:user_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/:preprint_id/contributors/:user_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/:preprint_id/contributors/:user_id/
http GET {{baseUrl}}/preprints/:preprint_id/contributors/:user_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/contributors/:user_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/contributors/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bibliographic": true,
"index": 1,
"permission": "write",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2022-05-04T19:39:33.138339",
"education": [],
"employment": [],
"family_name": "Mercury1",
"full_name": "Freddie Mercury1",
"given_name": "Freddie",
"locale": "en_US",
"middle_names": "",
"social": {},
"suffix": "",
"timezone": "Etc/UTC"
},
"id": "faqpw",
"links": {
"html": "https://osf.io/faqpw/",
"profile_image": "https://secure.gravatar.com/avatar/c9ac5d6cc7964ba7eb2bb96f877bc983?d=identicon",
"self": "https://api.osf.io/v2/users/faqpw/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/faqpw/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "bg8v7-faqpw",
"links": {
"self": "https://api.osf.io/v2/preprints/bg8v7/contributors/faqpw/"
},
"relationships": {
"preprint": {
"data": {
"id": "bg8v7",
"type": "preprints"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/bg8v7/",
"meta": {}
}
}
},
"users": {
"data": {
"id": "faqpw",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/faqpw/",
"meta": {}
}
}
}
},
"type": "contributors"
},
"meta": {
"version": "2.0"
}
}
GET
Retrieve a preprint
{{baseUrl}}/preprints/:preprint_id/
QUERY PARAMS
preprint_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/:preprint_id/")
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/:preprint_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/:preprint_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/:preprint_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/:preprint_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/preprints/:preprint_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/preprints/:preprint_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/:preprint_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/preprints/:preprint_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/:preprint_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/:preprint_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/:preprint_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/:preprint_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/:preprint_id/
http GET {{baseUrl}}/preprints/:preprint_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"date_created": "2016-08-29T14:53:51.185000",
"date_modified": "2016-08-29T14:53:51.185000",
"date_published": "2016-08-29T14:53:51.185000",
"doi": "10.1371/journal.pbio.1002456",
"is_preprint_orphan": false,
"is_published": true,
"license_record": null,
"subjects": [
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecaab8",
"text": "Public Affairs, Public Policy and Public Administration"
},
{
"id": "584240d954be81056cecaa10",
"text": "Science and Technology Policy"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecab33",
"text": "Library and Information Science"
},
{
"id": "584240db54be81056cecacd2",
"text": "Scholarly Publishing"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac68",
"text": "Psychology"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac68",
"text": "Psychology"
}
]
]
},
"id": "khbvy",
"links": {
"doi": "https://dx.doi.org/10.1371/journal.pbio.1002456",
"html": "https://osf.io/khbvy/",
"preprint_doi": "https://dx.doi.org/10.5072/FK2OSF.IO/KHBVY",
"self": "https://api.osf.io/v2/preprints/khbvy/"
},
"relationships": {
"bibliographic_contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/khbvy/bibliographic_contributors",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/khbvy/citation/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/khbvy/identifiers/",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bnzx5/",
"meta": {}
}
}
},
"primary_file": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/57c44b1e594d90004a421ab1/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/",
"meta": {}
}
}
}
},
"type": "preprints"
}
}
GET
Retrieve a styled citation (GET)
{{baseUrl}}/preprints/:preprint_id/citation/:style_id/
QUERY PARAMS
style_id
preprint_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/:preprint_id/citation/:style_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/citation/:style_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/citation/:style_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/citation/:style_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/:preprint_id/citation/:style_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/citation/:style_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/:preprint_id/citation/:style_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/:preprint_id/citation/:style_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/:preprint_id/citation/:style_id/
http GET {{baseUrl}}/preprints/:preprint_id/citation/:style_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/citation/:style_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/citation/:style_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"citation": "Kidwell, M., Lazarevic, L. B., Baranski, E., Hardwicke, T. E., Piechowski, S., Falkenberg, L.-S., … Nosek, B. A. (2016, August 29). Badges to Acknowledge Open Practices: A Simple, Low-Cost, Effective Method for Increasing Transparency. http://doi.org/10.1371/journal.pbio.1002456"
},
"id": "apa",
"links": {},
"type": "styled-citations"
}
}
GET
Retrieve citation details (GET)
{{baseUrl}}/preprints/:preprint_id/citation/
QUERY PARAMS
preprint_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/citation/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/preprints/:preprint_id/citation/")
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/citation/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/citation/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/citation/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/citation/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/preprints/:preprint_id/citation/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/preprints/:preprint_id/citation/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/citation/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/citation/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/preprints/:preprint_id/citation/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/preprints/:preprint_id/citation/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/citation/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/citation/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/citation/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/citation/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/citation/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/citation/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/preprints/:preprint_id/citation/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/preprints/:preprint_id/citation/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/citation/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/citation/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/citation/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/citation/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/preprints/:preprint_id/citation/');
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/citation/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/preprints/:preprint_id/citation/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/citation/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/citation/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/preprints/:preprint_id/citation/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/citation/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/citation/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/citation/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/preprints/:preprint_id/citation/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/citation/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/preprints/:preprint_id/citation/
http GET {{baseUrl}}/preprints/:preprint_id/citation/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/citation/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/citation/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"author": [
{
"family": "Kidwell",
"given": "Mallory"
},
{
"family": "Lazarevic",
"given": "Ljiljana B"
},
{
"family": "Baranski",
"given": "Erica"
},
{
"family": "Hardwicke",
"given": "Tom E"
},
{
"family": "Piechowski",
"given": "Sarah"
},
{
"family": "Falkenberg",
"given": "Lina-Sophia"
},
{
"family": "Kennett",
"given": "Curtis A"
},
{
"family": "Slowik",
"given": "Agnieszka"
},
{
"family": "Sonnleitner",
"given": "Carina"
},
{
"family": "Hess-Holden",
"given": "Chelsey L"
},
{
"family": "Errington",
"given": "Timothy M"
},
{
"family": "Fiedler",
"given": "Susann"
},
{
"family": "Nosek",
"given": "Brian A"
}
],
"publisher": "Open Science Framework",
"title": "Badges to Acknowledge Open Practices: A Simple, Low-Cost, Effective Method for Increasing Transparency",
"type": "webpage"
},
"id": "khbvy",
"links": {
"self": "osf.io/khbvy"
},
"type": "preprint-citation"
}
}
PATCH
Update a preprint
{{baseUrl}}/preprints/:preprint_id/
QUERY PARAMS
preprint_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/preprints/:preprint_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/preprints/:preprint_id/" {:content-type :json
:form-params {:data {:attributes {:doi "{doi}"}
:id "{preprint_id}"
:relationships {:primary_file {:data {:id "{file_id}"
:type "primary_files"}}}}}})
require "http/client"
url = "{{baseUrl}}/preprints/:preprint_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/preprints/:preprint_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/preprints/:preprint_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/preprints/:preprint_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/preprints/:preprint_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 246
{
"data": {
"attributes": {
"doi": "{doi}"
},
"id": "{preprint_id}",
"relationships": {
"primary_file": {
"data": {
"id": "{file_id}",
"type": "primary_files"
}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/preprints/:preprint_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/preprints/:preprint_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/preprints/:preprint_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
doi: '{doi}'
},
id: '{preprint_id}',
relationships: {
primary_file: {
data: {
id: '{file_id}',
type: 'primary_files'
}
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/preprints/:preprint_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/preprints/:preprint_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {doi: '{doi}'},
id: '{preprint_id}',
relationships: {primary_file: {data: {id: '{file_id}', type: 'primary_files'}}}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/preprints/:preprint_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"doi":"{doi}"},"id":"{preprint_id}","relationships":{"primary_file":{"data":{"id":"{file_id}","type":"primary_files"}}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/preprints/:preprint_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "doi": "{doi}"\n },\n "id": "{preprint_id}",\n "relationships": {\n "primary_file": {\n "data": {\n "id": "{file_id}",\n "type": "primary_files"\n }\n }\n }\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/preprints/:preprint_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/preprints/:preprint_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {doi: '{doi}'},
id: '{preprint_id}',
relationships: {primary_file: {data: {id: '{file_id}', type: 'primary_files'}}}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/preprints/:preprint_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {doi: '{doi}'},
id: '{preprint_id}',
relationships: {primary_file: {data: {id: '{file_id}', type: 'primary_files'}}}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/preprints/:preprint_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
doi: '{doi}'
},
id: '{preprint_id}',
relationships: {
primary_file: {
data: {
id: '{file_id}',
type: 'primary_files'
}
}
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/preprints/:preprint_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {doi: '{doi}'},
id: '{preprint_id}',
relationships: {primary_file: {data: {id: '{file_id}', type: 'primary_files'}}}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/preprints/:preprint_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"doi":"{doi}"},"id":"{preprint_id}","relationships":{"primary_file":{"data":{"id":"{file_id}","type":"primary_files"}}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"doi": @"{doi}" }, @"id": @"{preprint_id}", @"relationships": @{ @"primary_file": @{ @"data": @{ @"id": @"{file_id}", @"type": @"primary_files" } } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/preprints/:preprint_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/preprints/:preprint_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/preprints/:preprint_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'doi' => '{doi}'
],
'id' => '{preprint_id}',
'relationships' => [
'primary_file' => [
'data' => [
'id' => '{file_id}',
'type' => 'primary_files'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/preprints/:preprint_id/', [
'body' => '{
"data": {
"attributes": {
"doi": "{doi}"
},
"id": "{preprint_id}",
"relationships": {
"primary_file": {
"data": {
"id": "{file_id}",
"type": "primary_files"
}
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/preprints/:preprint_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'doi' => '{doi}'
],
'id' => '{preprint_id}',
'relationships' => [
'primary_file' => [
'data' => [
'id' => '{file_id}',
'type' => 'primary_files'
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'doi' => '{doi}'
],
'id' => '{preprint_id}',
'relationships' => [
'primary_file' => [
'data' => [
'id' => '{file_id}',
'type' => 'primary_files'
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/preprints/:preprint_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/preprints/:preprint_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"doi": "{doi}"
},
"id": "{preprint_id}",
"relationships": {
"primary_file": {
"data": {
"id": "{file_id}",
"type": "primary_files"
}
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/preprints/:preprint_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"doi": "{doi}"
},
"id": "{preprint_id}",
"relationships": {
"primary_file": {
"data": {
"id": "{file_id}",
"type": "primary_files"
}
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/preprints/:preprint_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/preprints/:preprint_id/"
payload = { "data": {
"attributes": { "doi": "{doi}" },
"id": "{preprint_id}",
"relationships": { "primary_file": { "data": {
"id": "{file_id}",
"type": "primary_files"
} } }
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/preprints/:preprint_id/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/preprints/:preprint_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/preprints/:preprint_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"doi\": \"{doi}\"\n },\n \"id\": \"{preprint_id}\",\n \"relationships\": {\n \"primary_file\": {\n \"data\": {\n \"id\": \"{file_id}\",\n \"type\": \"primary_files\"\n }\n }\n }\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/preprints/:preprint_id/";
let payload = json!({"data": json!({
"attributes": json!({"doi": "{doi}"}),
"id": "{preprint_id}",
"relationships": json!({"primary_file": json!({"data": json!({
"id": "{file_id}",
"type": "primary_files"
})})})
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/preprints/:preprint_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"doi": "{doi}"
},
"id": "{preprint_id}",
"relationships": {
"primary_file": {
"data": {
"id": "{file_id}",
"type": "primary_files"
}
}
}
}
}'
echo '{
"data": {
"attributes": {
"doi": "{doi}"
},
"id": "{preprint_id}",
"relationships": {
"primary_file": {
"data": {
"id": "{file_id}",
"type": "primary_files"
}
}
}
}
}' | \
http PATCH {{baseUrl}}/preprints/:preprint_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "doi": "{doi}"\n },\n "id": "{preprint_id}",\n "relationships": {\n "primary_file": {\n "data": {\n "id": "{file_id}",\n "type": "primary_files"\n }\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/preprints/:preprint_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": ["doi": "{doi}"],
"id": "{preprint_id}",
"relationships": ["primary_file": ["data": [
"id": "{file_id}",
"type": "primary_files"
]]]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/preprints/:preprint_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Retrieve a Registration Schema Block
{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id
QUERY PARAMS
schema_response_id
schema_response_block_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id
http GET {{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/:schema_response_block_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"block_type": "page-heading",
"display_text": "Background and Study Intent",
"help_text": "",
"index": 0,
"registration_response_key": null,
"required": false,
"schema_block_group_key": ""
},
"id": "61b79f9eadbb5701424a2d5e",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/"
},
"relationships": {
"schema": {
"links": {
"data": {
"id": "6176c9d45e01f100091d4f94",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/",
"meta": {}
}
}
}
},
"type": "schema-blocks"
}
}
GET
Retrieve a list of Registration Schema Blocks for a Schema Response
{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/
QUERY PARAMS
schema_response_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schema_responses/:schema_response_id/schema_blocks/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id/schema_blocks/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schema_responses/:schema_response_id/schema_blocks/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schema_responses/:schema_response_id/schema_blocks/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/
http GET {{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id/schema_blocks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"block_type": "page-heading",
"display_text": "Background and Study Intent",
"help_text": "",
"index": 0,
"registration_response_key": null,
"required": false,
"schema_block_group_key": ""
},
"id": "61b79f9eadbb5701424a2d5e",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/"
},
"relationships": {
"schema": {
"links": {
"data": {
"id": "6176c9d45e01f100091d4f94",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/",
"meta": {}
}
}
}
},
"type": "schema-blocks"
},
{
"attributes": {
"block_type": "question-label",
"display_text": "Question 1",
"help_text": "I am a question",
"index": 1,
"registration_response_key": null,
"required": false,
"schema_block_group_key": ""
},
"id": "61b79f9eadbb5701424a2d53",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d53/"
},
"relationships": {
"schema": {
"links": {
"data": {
"id": "6176c9d45e01f100091d4f94",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/",
"meta": {}
}
}
}
},
"type": "schema-blocks"
},
{
"attributes": {
"block_type": "long-text-input",
"display_text": "",
"help_text": "",
"index": 2,
"registration_response_key": "Q1",
"required": false,
"schema_block_group_key": ""
},
"id": "61b79f9eadbb5701424a2d53",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d53/"
},
"relationships": {
"schema": {
"links": {
"data": {
"id": "6176c9d45e01f100091d4f94",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/",
"meta": {}
}
}
}
},
"type": "schema-blocks"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/schema_blocks/"
},
"meta": {
"per_page": 10,
"total": 3,
"version": 2.2
}
}
GET
Retrieve a Registration Schema
{{baseUrl}}/schemas/registrations/:registration_schema_id
QUERY PARAMS
registration_schema_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schemas/registrations/:registration_schema_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schemas/registrations/:registration_schema_id")
require "http/client"
url = "{{baseUrl}}/schemas/registrations/:registration_schema_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schemas/registrations/:registration_schema_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schemas/registrations/:registration_schema_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schemas/registrations/:registration_schema_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schemas/registrations/:registration_schema_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schemas/registrations/:registration_schema_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schemas/registrations/:registration_schema_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schemas/registrations/:registration_schema_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schemas/registrations/:registration_schema_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schemas/registrations/:registration_schema_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/schemas/registrations/:registration_schema_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schemas/registrations/:registration_schema_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schemas/registrations/:registration_schema_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schemas/registrations/:registration_schema_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schemas/registrations/:registration_schema_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/schemas/registrations/:registration_schema_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schemas/registrations/:registration_schema_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/schemas/registrations/:registration_schema_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schemas/registrations/:registration_schema_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schemas/registrations/:registration_schema_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schemas/registrations/:registration_schema_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schemas/registrations/:registration_schema_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schemas/registrations/:registration_schema_id');
echo $response->getBody();
setUrl('{{baseUrl}}/schemas/registrations/:registration_schema_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schemas/registrations/:registration_schema_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schemas/registrations/:registration_schema_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schemas/registrations/:registration_schema_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schemas/registrations/:registration_schema_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schemas/registrations/:registration_schema_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schemas/registrations/:registration_schema_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schemas/registrations/:registration_schema_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schemas/registrations/:registration_schema_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schemas/registrations/:registration_schema_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schemas/registrations/:registration_schema_id
http GET {{baseUrl}}/schemas/registrations/:registration_schema_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schemas/registrations/:registration_schema_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schemas/registrations/:registration_schema_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"active": true,
"description": "This is a test form for documentation purposes.",
"name": "Test Long-Form Registration Schema",
"schema": {
"atomicSchema": true,
"blocks": [
{
"block_type": "page-heading",
"display_text": "The title of the page"
},
{
"block_type": "question-label",
"display_text": "The first question, put answer below."
},
{
"block_type": "long-text-input",
"registration_response_key": "Q1"
}
],
"description": "This is a test form for documentation purposes.",
"name": "Test Long-Form Registration Schema",
"pages": [],
"title": "Test Long-Form Registration Schema",
"version": 2
},
"schema_version": 2
},
"id": "6176c9d45e01f100091d4f94",
"links": {
"self": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/"
},
"relationships": {
"schema_blocks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/schema_blocks/",
"meta": {}
}
}
}
},
"type": "registration-schemas"
}
}
GET
Retrieve a list of Registration Schemas
{{baseUrl}}/schemas/registrations/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schemas/registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schemas/registrations/")
require "http/client"
url = "{{baseUrl}}/schemas/registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schemas/registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schemas/registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schemas/registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schemas/registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schemas/registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schemas/registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schemas/registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schemas/registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schemas/registrations/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/schemas/registrations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schemas/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schemas/registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schemas/registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schemas/registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/schemas/registrations/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schemas/registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/schemas/registrations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schemas/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schemas/registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schemas/registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schemas/registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schemas/registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/schemas/registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schemas/registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schemas/registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schemas/registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schemas/registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schemas/registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schemas/registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schemas/registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schemas/registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schemas/registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schemas/registrations/
http GET {{baseUrl}}/schemas/registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schemas/registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schemas/registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"active": true,
"description": "This is a test form for documentation purposes.",
"name": "Test Long-Form Registration Schema",
"schema": {
"atomicSchema": true,
"blocks": [
{
"block_type": "page-heading",
"display_text": "The title of the page"
},
{
"block_type": "question-label",
"display_text": "The first question, put answer below."
},
{
"block_type": "long-text-input",
"registration_response_key": "Q1"
}
],
"description": "This is a test form for documentation purposes.",
"name": "Test Long-Form Registration Schema",
"pages": [],
"title": "Test Long-Form Registration Schema",
"version": 2
},
"schema_version": 2
},
"id": "6176c9d45e01f100091d4f94",
"links": {
"self": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/"
},
"relationships": {
"schema_blocks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/6176c9d45e01f100091d4f94/schema_blocks/",
"meta": {}
}
}
}
},
"type": "registration-schemas"
}
],
"links": {
"first": null,
"last": "https://api.test.osf.io/v2/schemas/registrations/?page=2",
"next": "https://api.test.osf.io/v2/schemas/registrations/?page=2",
"prev": null,
"self": "https://api.test.osf.io/v2/schemas/registrations/"
},
"meta": {
"per_page": 20,
"total": 1,
"version": 2.2
}
}
POST
Create a fork
{{baseUrl}}/registrations/:registration_id/forks/
QUERY PARAMS
registration_id
BODY json
{
"attributes": {
"category": "",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [],
"date_created": "",
"date_modified": "",
"date_registered": "",
"date_withdrawn": "",
"description": "",
"embargo_end_date": "",
"fork": false,
"node_license": "",
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": false,
"registered_meta": "",
"registration": false,
"registration_supplement": "",
"tags": [],
"template_from": "",
"title": "",
"withdrawal_justification": "",
"withdrawn": false
},
"id": "",
"links": {
"html": "",
"self": ""
},
"relationships": {
"affiliated_institutions": "",
"children": "",
"citation": "",
"comments": "",
"contributors": "",
"files": "",
"forks": "",
"identifiers": "",
"linked_nodes": "",
"logs": "",
"node_links": "",
"parent": "",
"registered_by": "",
"registered_from": "",
"registration_schema": "",
"root": "",
"view_only_links": "",
"wikis": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/forks/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/registrations/:registration_id/forks/" {:content-type :json
:form-params {:data {:attributes {:draft_registration "{draft_registration_id}"
:lift_embargo "2017-05-10T20:44:03.185000"
:registration_choice "embargo"}
:type "registrations"}}})
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/forks/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/forks/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/forks/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/forks/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/registrations/:registration_id/forks/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 220
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/registrations/:registration_id/forks/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/forks/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/forks/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/registrations/:registration_id/forks/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/registrations/:registration_id/forks/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/registrations/:registration_id/forks/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/forks/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"draft_registration":"{draft_registration_id}","lift_embargo":"2017-05-10T20:44:03.185000","registration_choice":"embargo"},"type":"registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/forks/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "draft_registration": "{draft_registration_id}",\n "lift_embargo": "2017-05-10T20:44:03.185000",\n "registration_choice": "embargo"\n },\n "type": "registrations"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/forks/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/forks/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/registrations/:registration_id/forks/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/registrations/:registration_id/forks/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/registrations/:registration_id/forks/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/forks/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"draft_registration":"{draft_registration_id}","lift_embargo":"2017-05-10T20:44:03.185000","registration_choice":"embargo"},"type":"registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"draft_registration": @"{draft_registration_id}", @"lift_embargo": @"2017-05-10T20:44:03.185000", @"registration_choice": @"embargo" }, @"type": @"registrations" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/forks/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/forks/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/forks/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'draft_registration' => '{draft_registration_id}',
'lift_embargo' => '2017-05-10T20:44:03.185000',
'registration_choice' => 'embargo'
],
'type' => 'registrations'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/registrations/:registration_id/forks/', [
'body' => '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/forks/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'draft_registration' => '{draft_registration_id}',
'lift_embargo' => '2017-05-10T20:44:03.185000',
'registration_choice' => 'embargo'
],
'type' => 'registrations'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'draft_registration' => '{draft_registration_id}',
'lift_embargo' => '2017-05-10T20:44:03.185000',
'registration_choice' => 'embargo'
],
'type' => 'registrations'
]
]));
$request->setRequestUrl('{{baseUrl}}/registrations/:registration_id/forks/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/forks/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/forks/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/registrations/:registration_id/forks/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/forks/"
payload = { "data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/forks/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/forks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/registrations/:registration_id/forks/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/forks/";
let payload = json!({"data": json!({
"attributes": json!({
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
}),
"type": "registrations"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/registrations/:registration_id/forks/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}'
echo '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}' | \
http POST {{baseUrl}}/registrations/:registration_id/forks/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "draft_registration": "{draft_registration_id}",\n "lift_embargo": "2017-05-10T20:44:03.185000",\n "registration_choice": "embargo"\n },\n "type": "registrations"\n }\n}' \
--output-document \
- {{baseUrl}}/registrations/:registration_id/forks/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
],
"type": "registrations"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/forks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all child registrations
{{baseUrl}}/registrations/:registration_id/children/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/children/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/children/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/children/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/children/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/children/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/children/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/children/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/children/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/children/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/children/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/children/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/children/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/children/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/children/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/children/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/children/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/children/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/children/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/children/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/children/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/children/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/children/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/children/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/children/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/children/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/children/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/children/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/children/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/children/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/children/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/children/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/children/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/children/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/children/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/children/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/children/
http GET {{baseUrl}}/registrations/:registration_id/children/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/children/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/children/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2016-05-23T12:11:14.853000",
"date_modified": "2016-05-23T14:22:03.885000",
"date_registered": "2016-05-23T14:24:25.478000",
"description": "",
"embargo_end_date": null,
"fork": false,
"node_license": null,
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/node_links/",
"meta": {}
}
}
},
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": true,
"registered_meta": {
"comments": {
"comments": [],
"extra": [],
"value": "Data collection for measurement time T1 is underway, but no data has been collected for T2 (when menstrual cycle information will be assessed). Therefore, data cannot be analysed at the time of preregistration."
},
"datacompletion": {
"comments": [],
"extra": [],
"value": "Yes, data collection is underway or complete"
},
"looked": {
"comments": [],
"extra": [],
"value": "No"
}
},
"registration": true,
"registration_supplement": "OSF-Standard Pre-Data Collection Registration",
"tags": [],
"title": "Full Project Description",
"withdrawal_justification": null,
"withdrawn": false
},
"id": "4cmnz",
"links": {
"html": "https://osf.io/4cmnz/",
"self": "https://api.osf.io/v2/registrations/4cmnz/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/comments/?filter%5Btarget%5D=4cmnz",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/4cmnz/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/logs/",
"meta": {}
}
}
},
"parent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wucr8/",
"meta": {}
}
}
},
"registered_by": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
},
"registered_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/5wprs/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"related": {
"href": "https://api.osf.io/v2/metaschemas/564d31db8c5e4a7c9694b2c0/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wucr8/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/wikis/",
"meta": {}
}
}
}
},
"type": "registrations"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all citation styles (GET)
{{baseUrl}}/registrations/:registration_id/citations/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/citations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/citations/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/citations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/citations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/citations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/citations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/citations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/citations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/citations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/citations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/citations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/citations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/citations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/citations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/citations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/citations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/citations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/citations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/citations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/citations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/citations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/citations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/citations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/citations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/citations/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/citations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/citations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/citations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/citations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/citations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/citations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/citations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/citations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/citations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/citations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/citations/
http GET {{baseUrl}}/registrations/:registration_id/citations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/citations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/citations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_parsed": "2015-02-16T04:16:25.732000",
"short_title": "AMR",
"summary": null,
"title": "Academy of Management Review"
},
"id": "academy-of-management-review",
"links": {},
"type": "citation-styles"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all comments (GET)
{{baseUrl}}/registrations/:registration_id/comments/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/comments/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/comments/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/comments/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/comments/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/comments/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/comments/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/comments/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/comments/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/comments/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/comments/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/comments/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/comments/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/comments/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/comments/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/comments/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/comments/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/comments/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/comments/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/comments/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/comments/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/comments/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/comments/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/comments/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/comments/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/comments/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/comments/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/comments/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/comments/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/comments/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/comments/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/comments/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/comments/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/comments/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/comments/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/comments/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/comments/
http GET {{baseUrl}}/registrations/:registration_id/comments/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/comments/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/comments/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"content": "comment content"
},
"relationships": {
"target": {
"data": {
"id": "{target_id}",
"type": "{target_type}"
}
}
},
"type": "comments"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"can_edit": false,
"content": "We have published a Bayesian reanalysis of this project at PLOS ONE: http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0149794\n\nI explain some of the context on my blog: http://alexanderetz.com/2016/02/26/the-bayesian-rpp-take-2/\n\nPlease note that the analysis we use in this paper is very different from the analysis used in the blog I posted in the previous comment, so the results are different as well.",
"date_created": "2016-02-27T13:50:24.240000",
"date_modified": "2016-04-01T04:45:44.123000",
"deleted": false,
"has_children": false,
"has_report": false,
"is_abuse": false,
"is_ham": false,
"modified": false,
"page": "node"
},
"id": "jg7sezmdnt93",
"links": {
"self": "https://api.osf.io/v2/comments/jg7sezmdnt93/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"replies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=jg7sezmdnt93",
"meta": {}
}
}
},
"reports": {
"links": {
"related": {
"href": "https://api.osf.io/v2/comments/jg7sezmdnt93/reports/",
"meta": {}
}
}
},
"target": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {
"type": "nodes"
}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/6yc8z/",
"meta": {}
}
}
}
},
"type": "comments"
},
{
"attributes": {
"can_edit": false,
"content": "In this blog http://wp.me/p4sgtg-o6 I conduct a Bayesian Re-analysis of the Reproducibility Project that gives a graded measure of replication success. In an attempt to avoid dichotomous success/fail replication outcomes, I calculate a continous outcome (Bayes factor) that answers the question, does the replication result fit more with the original reported effect or a null effect? Many replications are strong successes, many are strong failures, and there are many that lie somewhere in between.",
"date_created": "2015-08-30T14:50:21.093000",
"date_modified": "2016-04-01T04:45:37.437000",
"deleted": false,
"has_children": false,
"has_report": false,
"is_abuse": false,
"is_ham": false,
"modified": null,
"page": "node"
},
"id": "23pk9",
"links": {
"self": "https://api.osf.io/v2/comments/23pk9/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"replies": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=23pk9",
"meta": {}
}
}
},
"reports": {
"links": {
"related": {
"href": "https://api.osf.io/v2/comments/23pk9/reports/",
"meta": {}
}
}
},
"target": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {
"type": "nodes"
}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/6yc8z/",
"meta": {}
}
}
}
},
"type": "comments"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all contributors (GET)
{{baseUrl}}/registrations/:registration_id/contributors/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/contributors/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/contributors/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/contributors/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/contributors/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/contributors/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/contributors/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/contributors/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/contributors/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/contributors/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/contributors/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/contributors/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/contributors/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/contributors/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/contributors/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/contributors/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/contributors/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/contributors/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/contributors/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/contributors/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/contributors/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/contributors/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/contributors/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/contributors/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/contributors/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/contributors/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/contributors/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/contributors/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/contributors/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/contributors/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/contributors/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/contributors/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/contributors/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/contributors/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/contributors/
http GET {{baseUrl}}/registrations/:registration_id/contributors/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/contributors/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/contributors/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2014-10-22T13:48:22.652000",
"family_name": "Anderl",
"full_name": "Christine Anderl",
"given_name": "Christine",
"locale": "de",
"middle_names": "",
"suffix": "",
"timezone": "America/Los_Angeles"
},
"id": "7xea5",
"links": {
"html": "https://osf.io/7xea5/",
"profile_image": "https://secure.gravatar.com/avatar/0ddf92ef0f0a7011c21cd07d7940bc32?d=identicon"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/7xea5/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "wucr8-7xea5",
"links": {
"self": "https://api.osf.io/v2/registrations/wucr8/contributors/7xea5/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/wucr8/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
}
},
"type": "contributors"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all files
{{baseUrl}}/registrations/:registration_id/files/:provider/
QUERY PARAMS
registration_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/files/:provider/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/files/:provider/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/files/:provider/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/files/:provider/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/files/:provider/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/files/:provider/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/files/:provider/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/files/:provider/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/files/:provider/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/files/:provider/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/files/:provider/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/files/:provider/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/files/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/files/:provider/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/files/:provider/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/files/:provider/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/files/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/files/:provider/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/files/:provider/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/files/:provider/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/files/:provider/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/files/:provider/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/files/:provider/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/files/:provider/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/files/:provider/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/files/:provider/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/files/:provider/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/files/:provider/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/files/:provider/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/files/:provider/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/files/:provider/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/files/:provider/
http GET {{baseUrl}}/registrations/:registration_id/files/:provider/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/files/:provider/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/files/:provider/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"checkout": null,
"current_user_can_comment": true,
"current_version": 1,
"date_created": "2014-10-17T19:24:12.264Z",
"date_modified": "2014-10-17T19:24:12.264Z",
"delete_allowed": true,
"extra": {
"downloads": 447,
"hashes": {
"md5": "44325d4f13b09f3769ede09d7c20a82c",
"sha256": "2450eb9ff3db92a1bff370368b0552b270bd4b5ca0745b773c37d2662f94df8e"
}
},
"guid": "sejcv",
"kind": "file",
"last_touched": "2015-09-18T01:11:16.328000",
"materialized_path": "/OSC2012.pdf",
"name": "OSC2012.pdf",
"path": "/553e69248c5e4a219919ea54",
"provider": "osfstorage",
"size": 216945,
"tags": []
},
"id": "553e69248c5e4a219919ea54",
"links": {
"delete": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"download": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"info": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"move": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=sejcv",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"versions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/",
"meta": {}
}
}
}
},
"type": "files"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all forks
{{baseUrl}}/registrations/:registration_id/forks/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/forks/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/forks/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/forks/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/forks/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/forks/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/forks/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/forks/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/forks/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/forks/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/forks/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/forks/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/forks/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/forks/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/forks/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/forks/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/forks/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/forks/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/forks/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/forks/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/forks/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/forks/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/forks/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/forks/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/forks/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/forks/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/forks/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/forks/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/forks/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/forks/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/forks/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/forks/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/forks/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/forks/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/forks/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/forks/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/forks/
http GET {{baseUrl}}/registrations/:registration_id/forks/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/forks/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/forks/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2016-05-23T12:11:14.853000",
"date_modified": "2016-05-23T14:22:03.885000",
"date_registered": "2016-05-23T14:24:25.478000",
"description": "",
"embargo_end_date": null,
"fork": false,
"node_license": null,
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/node_links/",
"meta": {}
}
}
},
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": true,
"registered_meta": {
"comments": {
"comments": [],
"extra": [],
"value": "Data collection for measurement time T1 is underway, but no data has been collected for T2 (when menstrual cycle information will be assessed). Therefore, data cannot be analysed at the time of preregistration."
},
"datacompletion": {
"comments": [],
"extra": [],
"value": "Yes, data collection is underway or complete"
},
"looked": {
"comments": [],
"extra": [],
"value": "No"
}
},
"registration": true,
"registration_supplement": "OSF-Standard Pre-Data Collection Registration",
"tags": [],
"title": "Full Project Description",
"withdrawal_justification": null,
"withdrawn": false
},
"id": "4cmnz",
"links": {
"html": "https://osf.io/4cmnz/",
"self": "https://api.osf.io/v2/registrations/4cmnz/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/comments/?filter%5Btarget%5D=4cmnz",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/4cmnz/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/logs/",
"meta": {}
}
}
},
"parent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wucr8/",
"meta": {}
}
}
},
"registered_by": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
},
"registered_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/5wprs/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"related": {
"href": "https://api.osf.io/v2/metaschemas/564d31db8c5e4a7c9694b2c0/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wucr8/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/wikis/",
"meta": {}
}
}
}
},
"type": "registrations"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all identifiers (GET)
{{baseUrl}}/registrations/:registration_id/identifiers/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/identifiers/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/identifiers/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/identifiers/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/identifiers/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/identifiers/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/identifiers/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/identifiers/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/identifiers/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/identifiers/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/identifiers/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/identifiers/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/identifiers/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/identifiers/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/identifiers/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/identifiers/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/identifiers/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/identifiers/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/identifiers/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/identifiers/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/identifiers/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/identifiers/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/identifiers/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/identifiers/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/identifiers/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/identifiers/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/identifiers/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/identifiers/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/identifiers/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/identifiers/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/identifiers/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/identifiers/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/identifiers/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/identifiers/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/identifiers/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/identifiers/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/identifiers/
http GET {{baseUrl}}/registrations/:registration_id/identifiers/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/identifiers/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/identifiers/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "doi",
"value": "10.17605/OSF.IO/73PND"
},
"id": "57f1641db83f6901ed94b459",
"links": {
"self": "https://api.osf.io/v2/identifiers/57f1641db83f6901ed94b459/"
},
"relationships": {
"referent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
}
},
"type": "identifiers"
},
{
"attributes": {
"category": "ark",
"value": "c7605/osf.io/73pnd"
},
"id": "57f1641db83f6901ed94b45a",
"links": {
"self": "https://api.osf.io/v2/identifiers/57f1641db83f6901ed94b45a/"
},
"relationships": {
"referent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
}
},
"type": "identifiers"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all institutions (1)
{{baseUrl}}/registrations/:registration_id/institutions/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/institutions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/institutions/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/institutions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/institutions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/institutions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/institutions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/institutions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/institutions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/institutions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/institutions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/institutions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/institutions/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/institutions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/institutions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/institutions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/institutions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/institutions/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/institutions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/institutions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/institutions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/institutions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/institutions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/institutions/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/institutions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/institutions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/institutions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/institutions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/institutions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/institutions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/institutions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/institutions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/institutions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/institutions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/institutions/
http GET {{baseUrl}}/registrations/:registration_id/institutions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/institutions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/institutions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"auth_url": null,
"description": "COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at cos.io.",
"logo_path": "/static/img/institutions/shields/cos-shield.png",
"name": "Center For Open Science"
},
"id": "cos",
"links": {
"self": "https://api.osf.io/v2/institutions/cos/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/cos/users/",
"meta": {}
}
}
}
},
"type": "institutions"
},
{
"attributes": {
"auth_url": "https://accounts.osf.io/Shibboleth.sso/Login?entityID=urn%3Amace%3Aincommon%3Avirginia.edu",
"description": "In partnership with the Vice President for Research, Data Science Institute, Health Sciences Library, and University Library. Learn more about UVA resources for computational and data-driven research. Projects must abide by the University Security and Data Protection Policies.",
"logo_path": "/static/img/institutions/shields/uva-shield.png",
"name": "University of Virginia"
},
"id": "uva",
"links": {
"self": "https://api.osf.io/v2/institutions/uva/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/users/",
"meta": {}
}
}
}
},
"type": "institutions"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all linked nodes (GET)
{{baseUrl}}/registrations/:registration_id/linked_nodes/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/linked_nodes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/linked_nodes/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/linked_nodes/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/linked_nodes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/linked_nodes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/linked_nodes/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/linked_nodes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/linked_nodes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/linked_nodes/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/linked_nodes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/linked_nodes/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/linked_nodes/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/linked_nodes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/linked_nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/linked_nodes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/linked_nodes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/linked_nodes/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/linked_nodes/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/linked_nodes/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/linked_nodes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/linked_nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/linked_nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/linked_nodes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/linked_nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/linked_nodes/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/linked_nodes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/linked_nodes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/linked_nodes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/linked_nodes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/linked_nodes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/linked_nodes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/linked_nodes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/linked_nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/linked_nodes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/linked_nodes/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/linked_nodes/
http GET {{baseUrl}}/registrations/:registration_id/linked_nodes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/linked_nodes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/linked_nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2014-07-28T13:53:04.508000",
"date_modified": "2017-03-03T05:00:31.512000",
"description": "This is an independent replication as part of the Reproducibility Project: Psychology.",
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "Replication of WA Cunningham, JJ Van Bavel, IR Johnsen (2008, PS 19(2))"
},
"id": "bifc7",
"links": {
"html": "https://osf.io/bifc7/",
"self": "https://api.osf.io/v2/nodes/bifc7/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/bifc7/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/comments/?filter%5Btarget%5D=bifc7",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/bifc7/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
},
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2012-10-31T18:50:46.111000",
"date_modified": "2016-10-02T19:50:23.605000",
"description": null,
"fork": true,
"node_license": {
"copyright_holders": [
""
],
"year": "2016"
},
"preprint": false,
"public": true,
"registration": false,
"tags": [
"anxiety",
"EMG",
"EEG",
"motivation",
"ERN"
],
"title": "Replication of Hajcak & Foti (2008, PS, Study 1)"
},
"id": "73pnd",
"links": {
"html": "https://osf.io/73pnd/",
"self": "https://api.osf.io/v2/nodes/73pnd/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/73pnd/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/comments/?filter%5Btarget%5D=73pnd",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/files/",
"meta": {}
}
}
},
"forked_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/kxhz5/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/identifiers/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/73pnd/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all logs (GET)
{{baseUrl}}/registrations/:registration_id/logs/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/logs/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/logs/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/logs/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/logs/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/logs/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/logs/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/logs/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/logs/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/logs/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/logs/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/logs/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/logs/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/logs/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/logs/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/logs/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/logs/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/logs/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/logs/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/logs/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/logs/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/logs/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/logs/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/logs/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/logs/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/logs/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/logs/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/logs/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/logs/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/logs/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/logs/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/logs/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/logs/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/logs/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/logs/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/logs/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/logs/
http GET {{baseUrl}}/registrations/:registration_id/logs/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/logs/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/logs/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"action": "contributor_added",
"date": "2012-05-31T05:50:32.083000",
"params": {
"contributors": [
{
"active": true,
"family_name": "Nosek",
"full_name": "Brian A. Nosek",
"given_name": "Brian",
"id": "cdi38",
"middle_names": "A."
}
],
"params_node": {
"id": "ezcuj",
"title": "Reproducibility Project: Psychology"
}
}
},
"id": "4fc706a80b6e9118ef000122",
"links": {
"self": "https://api.osf.io/v2/logs/4fc706a80b6e9118ef000122/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/jk5cv/",
"meta": {}
}
}
}
},
"type": "logs"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"action": "osf_storage_file_updated",
"date": "2016-05-23T14:22:20.142000",
"params": {
"contributors": [],
"params_node": {
"id": "7eshv",
"title": "Full Questionnaire [in original language]"
},
"params_project": {
"id": "5wprs",
"title": "Full Project Description"
},
"path": "/StudyMaterials_UEH1.pdf",
"preprint_provider": null,
"urls": {
"download": "/project/7eshv/files/osfstorage/5742f41c6c613b01de5b15dd/?action=download",
"view": "/project/7eshv/files/osfstorage/5742f41c6c613b01de5b15dd/"
}
}
},
"id": "57431299594d9001ead7174f",
"links": {
"self": "https://api.osf.io/v2/logs/57431299594d9001ead7174f/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/n32tp/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/7eshv/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
}
},
"type": "logs"
},
{
"attributes": {
"action": "project_created",
"date": "2016-05-23T12:13:58.371000",
"params": {
"contributors": [],
"params_node": {
"id": "7eshv",
"title": "Full Questionnaire [in original language]"
},
"params_project": null,
"preprint_provider": null
}
},
"id": "57431299594d9001ead7174d",
"links": {
"self": "https://api.osf.io/v2/logs/57431299594d9001ead7174d/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/n32tp/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/7eshv/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
}
},
"type": "logs"
},
{
"attributes": {
"action": "project_created",
"date": "2016-05-23T12:11:14.853000",
"params": {
"contributors": [],
"params_node": {
"id": "5wprs",
"title": "Full Project Description"
},
"params_project": null,
"preprint_provider": null
}
},
"id": "57431299594d9001ead71746",
"links": {
"self": "https://api.osf.io/v2/logs/57431299594d9001ead71746/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/4cmnz/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/5wprs/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
}
},
"type": "logs"
},
{
"attributes": {
"action": "project_created",
"date": "2016-05-23T12:10:48.868000",
"params": {
"contributors": [],
"params_node": {
"id": "6gbkh",
"title": "Investigating fluctuations in cooperative preferences across the natural female menstrual cycle in a within-subjects-design"
},
"params_project": null,
"preprint_provider": null
}
},
"id": "57431299594d9001ead71742",
"links": {
"self": "https://api.osf.io/v2/logs/57431299594d9001ead71742/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wucr8/",
"meta": {}
}
}
},
"original_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/6gbkh/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
}
},
"type": "logs"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 5
},
"next": null,
"prev": null
}
}
GET
List all registrations (GET)
{{baseUrl}}/registrations/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/")
require "http/client"
url = "{{baseUrl}}/registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/registrations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/registrations/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/registrations/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/
http GET {{baseUrl}}/registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2015-05-21T19:38:55.398000",
"date_modified": "2016-02-04T20:58:11.042000",
"date_registered": "2015-06-01T14:47:40.064000",
"date_withdrawn": null,
"description": "This investigation seeks to evaluate the impact of badges on the availability and accessibility of open data and materials.",
"embargo_end_date": null,
"fork": false,
"node_license": null,
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": true,
"registered_meta": {
"comments": {
"value": ""
},
"datacompletion": {
"value": "No"
},
"looked": {
"value": "No"
}
},
"registration": true,
"registration_supplement": "OSF-Standard Pre-Data Collection Registration",
"tags": [
"badges",
"methodology",
"signals",
"open science",
"open data",
"open materials"
],
"title": "The Effect of Badges on Availability of Data and Materials",
"withdrawal_justification": null,
"withdrawn": false
},
"id": "ipkea",
"links": {
"html": "https://osf.io/ipkea/",
"self": "https://api.osf.io/v2/registrations/ipkea/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/comments/?filter%5Btarget%5D=ipkea",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/ipkea/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/logs/",
"meta": {}
}
}
},
"registered_by": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/z2u9w/",
"meta": {}
}
}
},
"registered_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/rfgdw/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"related": {
"href": "https://api.osf.io/v2/metaschemas/564d31db8c5e4a7c9694b2c0/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/ipkea/wikis/",
"meta": {}
}
}
}
},
"type": "registrations"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/registrations/?page=856",
"meta": {
"per_page": 10,
"total": 8559
},
"next": "https://api.osf.io/v2/registrations/?page=2",
"prev": null
}
}
GET
List all storage providers (GET)
{{baseUrl}}/registrations/:registration_id/files/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/files/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/files/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/files/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/files/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/files/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/files/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/files/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/files/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/files/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/files/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/files/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/files/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/files/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/files/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/files/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/files/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/files/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/files/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/files/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/files/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/files/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/files/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/files/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/files/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/files/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/files/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/files/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/files/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/files/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/files/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/files/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/files/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/files/
http GET {{baseUrl}}/registrations/:registration_id/files/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/files/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/files/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"kind": "folder",
"name": "osfstorage",
"node": "ezcuj",
"path": "/",
"provider": "osfstorage"
},
"id": "ezcuj:osfstorage",
"links": {
"new_folder": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/?kind=folder",
"storage_addons": "https://api.osf.io/v2/addons/?filter%5Bcategories%5D=storage",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/"
},
"relationships": {
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/files/osfstorage/",
"meta": {}
}
}
}
},
"type": "files"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all view only links (GET)
{{baseUrl}}/registrations/:registration_id/view_only_links/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/view_only_links/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/view_only_links/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/view_only_links/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/view_only_links/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/view_only_links/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/view_only_links/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/view_only_links/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/view_only_links/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/view_only_links/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/view_only_links/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/view_only_links/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/view_only_links/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/view_only_links/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/view_only_links/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/view_only_links/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/view_only_links/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/view_only_links/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/view_only_links/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/view_only_links/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/view_only_links/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/view_only_links/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/view_only_links/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/view_only_links/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/view_only_links/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/view_only_links/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/view_only_links/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/view_only_links/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/view_only_links/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/view_only_links/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/view_only_links/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/view_only_links/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/view_only_links/
http GET {{baseUrl}}/registrations/:registration_id/view_only_links/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/view_only_links/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/view_only_links/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"anonymous": false,
"date_created": "2017-03-20T20:15:02.488643",
"key": "c1df490be3294a9bac01ff05c4097ab7",
"name": "vol name"
},
"id": "58d03846a170c50025baae61",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/view_only_links/58d03846a170c50025baae61/"
},
"relationships": {
"creator": {
"links": {
"related": {
"href": "http://api.osf.io/v2/users/4xpu9/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://api.osf.io/v2/view_only_links/58d03846a170c50025baae61/nodes/",
"meta": {}
},
"self": {
"href": "http://api.osf.io/v2/view_only_links/58d03846a170c50025baae61/relationships/nodes/",
"meta": {}
}
}
}
},
"type": "view_only_links"
},
{
"attributes": {
"anonymous": false,
"date_created": "2017-03-21T14:26:47.507504",
"key": "9794ac36085e4d7086ff4dab49daf1cb",
"name": "vol name"
},
"id": "58d13827a170c50025baae6e",
"links": {
"self": "http://api.osf.io/v2/nodes/gaz5n/view_only_links/58d13827a170c50025baae6e/"
},
"relationships": {
"creator": {
"links": {
"related": {
"href": "http://api.osf.io/v2/users/4xpu9/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://api.osf.io/v2/view_only_links/58d13827a170c50025baae6e/nodes/",
"meta": {}
},
"self": {
"href": "http://api.osf.io/v2/view_only_links/58d13827a170c50025baae6e/relationships/nodes/",
"meta": {}
}
}
}
},
"type": "view_only_links"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all wikis (GET)
{{baseUrl}}/registrations/:registration_id/wikis/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/wikis/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/wikis/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/wikis/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/wikis/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/wikis/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/wikis/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/wikis/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/wikis/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/wikis/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/wikis/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/wikis/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/wikis/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/wikis/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/wikis/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/wikis/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/wikis/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/wikis/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/wikis/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/wikis/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/wikis/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/wikis/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/wikis/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/wikis/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/wikis/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/wikis/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/wikis/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/wikis/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/wikis/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/wikis/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/wikis/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/wikis/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/wikis/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/wikis/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/wikis/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/wikis/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/wikis/
http GET {{baseUrl}}/registrations/:registration_id/wikis/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/wikis/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/wikis/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"content_type": "text/markdown",
"current_user_can_comment": false,
"date_modified": "2015-02-11T21:16:50.918000",
"extra": {
"version": 1
},
"kind": "file",
"materialized_path": "/9rb7g",
"name": "home",
"path": "/9rb7g",
"size": 1544
},
"id": "9rb7g",
"links": {
"download": "https://api.osf.io/v2/wikis/9rb7g/content/",
"info": "https://api.osf.io/v2/wikis/9rb7g/",
"self": "https://api.osf.io/v2/wikis/9rb7g/"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wu3a4/comments/?filter%5Btarget%5D=9rb7g",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/wu3a4/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/edb8y/",
"meta": {}
}
}
}
},
"type": "wikis"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
Retrieve a citation
{{baseUrl}}/registrations/:registration_id/citations/:citation_id/
QUERY PARAMS
registration_id
citation_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/citations/:citation_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/citations/:citation_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/citations/:citation_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/citations/:citation_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/citations/:citation_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/citations/:citation_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/citations/:citation_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/citations/:citation_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/citations/:citation_id/
http GET {{baseUrl}}/registrations/:registration_id/citations/:citation_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/citations/:citation_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/citations/:citation_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"author": [
{
"family": "Errington",
"given": "Timothy M"
},
{
"family": "Vasilevsky",
"given": "Nicole"
},
{
"family": "Haendel",
"given": "Melissa A"
}
],
"publisher": "Open Science Framework",
"title": "Identification Analysis of RP:CB",
"type": "webpage"
},
"id": "bg4di",
"links": {
"self": "osf.io/bg4di"
},
"type": "node-citation"
}
}
GET
Retrieve a contributor (1)
{{baseUrl}}/registrations/:registration_id/contributors/:user_id/
QUERY PARAMS
registration_id
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/contributors/:user_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/contributors/:user_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/contributors/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/contributors/:user_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/contributors/:user_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/contributors/:user_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/contributors/:user_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/contributors/:user_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/contributors/:user_id/
http GET {{baseUrl}}/registrations/:registration_id/contributors/:user_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/contributors/:user_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/contributors/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"user": {
"data": {
"id": "guid0",
"type": "users"
}
}
},
"type": "contributors"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"bibliographic": true,
"index": 0,
"permission": "admin",
"unregistered_contributor": null
},
"embeds": {
"users": {
"data": {
"attributes": {
"active": true,
"date_registered": "2014-10-22T13:48:22.652000",
"family_name": "Anderl",
"full_name": "Christine Anderl",
"given_name": "Christine",
"locale": "de",
"middle_names": "",
"suffix": "",
"timezone": "America/Los_Angeles"
},
"id": "7xea5",
"links": {
"html": "https://osf.io/7xea5/",
"profile_image": "https://secure.gravatar.com/avatar/0ddf92ef0f0a7011c21cd07d7940bc32?d=identicon"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/7xea5/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "wucr8-7xea5",
"links": {
"self": "https://api.osf.io/v2/registrations/wucr8/contributors/7xea5/"
},
"relationships": {
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/wucr8/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/7xea5/",
"meta": {}
}
}
}
},
"type": "contributors"
}
}
GET
Retrieve a file (1)
{{baseUrl}}/registrations/:registration_id/files/:provider/:path/
QUERY PARAMS
registration_id
provider
path
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/files/:provider/:path/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/files/:provider/:path/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/files/:provider/:path/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/files/:provider/:path/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/files/:provider/:path/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/files/:provider/:path/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/files/:provider/:path/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/files/:provider/:path/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/files/:provider/:path/
http GET {{baseUrl}}/registrations/:registration_id/files/:provider/:path/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/files/:provider/:path/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/files/:provider/:path/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"checkout": null,
"current_user_can_comment": true,
"current_version": 1,
"date_created": "2014-10-17T19:24:12.264Z",
"date_modified": "2014-10-17T19:24:12.264Z",
"delete_allowed": true,
"extra": {
"downloads": 447,
"hashes": {
"md5": "44325d4f13b09f3769ede09d7c20a82c",
"sha256": "2450eb9ff3db92a1bff370368b0552b270bd4b5ca0745b773c37d2662f94df8e"
}
},
"guid": "sejcv",
"kind": "file",
"last_touched": "2015-09-18T01:11:16.328000",
"materialized_path": "/OSC2012.pdf",
"name": "OSC2012.pdf",
"path": "/553e69248c5e4a219919ea54",
"provider": "osfstorage",
"size": 216945,
"tags": []
},
"id": "553e69248c5e4a219919ea54",
"links": {
"delete": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"download": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"info": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"move": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54",
"self": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/",
"upload": "https://files.osf.io/v1/resources/ezcuj/providers/osfstorage/553e69248c5e4a219919ea54"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/comments/?filter%5Btarget%5D=sejcv",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/ezcuj/",
"meta": {}
}
}
},
"versions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/553e69248c5e4a219919ea54/versions/",
"meta": {}
}
}
}
},
"type": "files"
}
}
GET
Retrieve a registration
{{baseUrl}}/registrations/:registration_id/
QUERY PARAMS
registration_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/
http GET {{baseUrl}}/registrations/:registration_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
GET
Retrieve a view only link (GET)
{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/
QUERY PARAMS
registration_id
link_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/registrations/:registration_id/view_only_links/:link_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/view_only_links/:link_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/registrations/:registration_id/view_only_links/:link_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/registrations/:registration_id/view_only_links/:link_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/
http GET {{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/view_only_links/:link_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"anonymous": false,
"date_created": "2017-03-20T20:11:01.603851",
"key": "",
"name": "Test View Only Link"
},
"id": "",
"relationships": {
"creator": {
"links": {
"related": {
"href": "http://api.osf.io/v2/users//",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://api.osf.io/v2/view_only_links//nodes/",
"meta": {}
},
"self": {
"href": "http://api.osf.io/v2/view_only_links//relationships/nodes/",
"meta": {}
}
}
}
},
"type": "view-only-links"
}
}
PATCH
Update a registration
{{baseUrl}}/registrations/:registration_id/
QUERY PARAMS
registration_id
BODY json
{
"attributes": {
"category": "",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [],
"date_created": "",
"date_modified": "",
"date_registered": "",
"date_withdrawn": "",
"description": "",
"embargo_end_date": "",
"fork": false,
"node_license": "",
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": false,
"registered_meta": "",
"registration": false,
"registration_supplement": "",
"tags": [],
"template_from": "",
"title": "",
"withdrawal_justification": "",
"withdrawn": false
},
"id": "",
"links": {
"html": "",
"self": ""
},
"relationships": {
"affiliated_institutions": "",
"children": "",
"citation": "",
"comments": "",
"contributors": "",
"files": "",
"forks": "",
"identifiers": "",
"linked_nodes": "",
"logs": "",
"node_links": "",
"parent": "",
"registered_by": "",
"registered_from": "",
"registration_schema": "",
"root": "",
"view_only_links": "",
"wikis": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/registrations/:registration_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/registrations/:registration_id/" {:content-type :json
:form-params {:data {:attributes {:draft_registration "{draft_registration_id}"
:lift_embargo "2017-05-10T20:44:03.185000"
:registration_choice "embargo"}
:type "registrations"}}})
require "http/client"
url = "{{baseUrl}}/registrations/:registration_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/registrations/:registration_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/registrations/:registration_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/registrations/:registration_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/registrations/:registration_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 220
{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/registrations/:registration_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/registrations/:registration_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/registrations/:registration_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/registrations/:registration_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/registrations/:registration_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/registrations/:registration_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"draft_registration":"{draft_registration_id}","lift_embargo":"2017-05-10T20:44:03.185000","registration_choice":"embargo"},"type":"registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/registrations/:registration_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "draft_registration": "{draft_registration_id}",\n "lift_embargo": "2017-05-10T20:44:03.185000",\n "registration_choice": "embargo"\n },\n "type": "registrations"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/registrations/:registration_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/registrations/:registration_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/registrations/:registration_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/registrations/:registration_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/registrations/:registration_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {
draft_registration: '{draft_registration_id}',
lift_embargo: '2017-05-10T20:44:03.185000',
registration_choice: 'embargo'
},
type: 'registrations'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/registrations/:registration_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"draft_registration":"{draft_registration_id}","lift_embargo":"2017-05-10T20:44:03.185000","registration_choice":"embargo"},"type":"registrations"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"draft_registration": @"{draft_registration_id}", @"lift_embargo": @"2017-05-10T20:44:03.185000", @"registration_choice": @"embargo" }, @"type": @"registrations" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/registrations/:registration_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/registrations/:registration_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/registrations/:registration_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'draft_registration' => '{draft_registration_id}',
'lift_embargo' => '2017-05-10T20:44:03.185000',
'registration_choice' => 'embargo'
],
'type' => 'registrations'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/registrations/:registration_id/', [
'body' => '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/registrations/:registration_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'draft_registration' => '{draft_registration_id}',
'lift_embargo' => '2017-05-10T20:44:03.185000',
'registration_choice' => 'embargo'
],
'type' => 'registrations'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'draft_registration' => '{draft_registration_id}',
'lift_embargo' => '2017-05-10T20:44:03.185000',
'registration_choice' => 'embargo'
],
'type' => 'registrations'
]
]));
$request->setRequestUrl('{{baseUrl}}/registrations/:registration_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/registrations/:registration_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/registrations/:registration_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/registrations/:registration_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/registrations/:registration_id/"
payload = { "data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/registrations/:registration_id/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/registrations/:registration_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/registrations/:registration_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"draft_registration\": \"{draft_registration_id}\",\n \"lift_embargo\": \"2017-05-10T20:44:03.185000\",\n \"registration_choice\": \"embargo\"\n },\n \"type\": \"registrations\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/registrations/:registration_id/";
let payload = json!({"data": json!({
"attributes": json!({
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
}),
"type": "registrations"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/registrations/:registration_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}'
echo '{
"data": {
"attributes": {
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
},
"type": "registrations"
}
}' | \
http PATCH {{baseUrl}}/registrations/:registration_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "draft_registration": "{draft_registration_id}",\n "lift_embargo": "2017-05-10T20:44:03.185000",\n "registration_choice": "embargo"\n },\n "type": "registrations"\n }\n}' \
--output-document \
- {{baseUrl}}/registrations/:registration_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"draft_registration": "{draft_registration_id}",
"lift_embargo": "2017-05-10T20:44:03.185000",
"registration_choice": "embargo"
],
"type": "registrations"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/registrations/:registration_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
A Schema Response Action from a Schema Response
{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id
QUERY PARAMS
schema_response_id
schema_response_action_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schema_responses/:schema_response_id/actions/:schema_response_action_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id/actions/:schema_response_action_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schema_responses/:schema_response_id/actions/:schema_response_action_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schema_responses/:schema_response_id/actions/:schema_response_action_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id
http GET {{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id/actions/:schema_response_action_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"auto": false,
"comment": "",
"date_created": "2021-12-15T13:17:21.845573Z",
"date_modified": "2021-12-15T13:17:21.845622Z",
"from_state": "in_progress",
"to_state": "unapproved",
"trigger": "submit",
"visible": true
},
"embeds": {
"creator": {
"data": {
"attributes": {
"active": true,
"date_registered": "2017-02-02T21:32:45.495000Z",
"education": [],
"employment": [
{
"department": "Social Neuroscience Lab",
"endMonth": 0,
"endYear": "",
"institution": "Institute of Psychology, Polish Academy of Sciences",
"ongoing": true,
"startMonth": 9,
"startYear": "2016",
"title": "Head"
}
],
"family_name": "Okruszek",
"full_name": "Lukasz Okruszek",
"given_name": "Łukasz",
"locale": "pl",
"middle_names": "",
"social": {
"academiaInstitution": "",
"academiaProfileID": "",
"baiduScholar": "",
"github": [],
"impactStory": "",
"linkedIn": [],
"orcid": "0000-0002-7136-2864",
"profileWebsites": [],
"researchGate": "Lukasz-Okruszek",
"researcherId": "",
"scholar": "CHyWD84AAAAJ&hl",
"ssrn": "",
"twitter": []
},
"suffix": "",
"timezone": "Europe/Budapest"
},
"id": "zfsr2",
"links": {
"html": "https://osf.io/zfsr2/",
"profile_image": "https://secure.gravatar.com/avatar/8a25f4601ac997f113b3145aa5cf907e?d=identicon",
"self": "https://api.osf.io/v2/users/zfsr2/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/zfsr2/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/preprints/",
"meta": {}
}
}
},
"quickfiles": {
"links": {
"download": {
"href": "https://files.osf.io/v1/resources/ytg45jbs3r/providers/osfstorage/?zip=",
"meta": {}
},
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/quickfiles/",
"meta": {}
},
"upload": {
"href": "https://files.osf.io/v1/resources/ytg45jbs3r/providers/osfstorage/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
},
"links": {
"self": "https://api.osf.io/v2/actions/61b9eae1a7d8ac025c4c46d3/"
}
},
"id": "61b9eae1a7d8ac025c4c46d3",
"relationships": {
"creator": {
"data": {
"id": "zfsr2",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/",
"meta": {}
}
}
},
"target": {
"data": {
"id": "61b9cd62eb66180215222669",
"type": "schema_responses"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61b9cd62eb66180215222669/",
"meta": {}
}
}
}
},
"type": "schema-response-actions"
},
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/schema_responses/61b9cd62eb66180215222669/actions/"
},
"meta": {
"per_page": 10,
"total": 2,
"version": "2.20"
}
}
POST
Create a new Schema Response Action
{{baseUrl}}/schema_responses/:schema_response_id/actions/
QUERY PARAMS
schema_response_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id/actions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/schema_responses/:schema_response_id/actions/")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id/actions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id/actions/");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/schema_responses/:schema_response_id/actions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id/actions/"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/schema_responses/:schema_response_id/actions/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id/actions/';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id/actions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/schema_responses/:schema_response_id/actions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id/actions/';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id/actions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id/actions/" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id/actions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/schema_responses/:schema_response_id/actions/');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id/actions/');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id/actions/');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id/actions/' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id/actions/' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/schema_responses/:schema_response_id/actions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/schema_responses/:schema_response_id/actions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/schema_responses/:schema_response_id/actions/
http POST {{baseUrl}}/schema_responses/:schema_response_id/actions/
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id/actions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id/actions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Retrieve a list of Schema Response Actions for a Schema Response
{{baseUrl}}/schema_responses/:schema_response_id/actions/
QUERY PARAMS
schema_response_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id/actions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schema_responses/:schema_response_id/actions/")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id/actions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id/actions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schema_responses/:schema_response_id/actions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id/actions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schema_responses/:schema_response_id/actions/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id/actions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id/actions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schema_responses/:schema_response_id/actions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id/actions/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id/actions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id/actions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id/actions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id/actions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schema_responses/:schema_response_id/actions/');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id/actions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id/actions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id/actions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id/actions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schema_responses/:schema_response_id/actions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id/actions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id/actions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schema_responses/:schema_response_id/actions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id/actions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schema_responses/:schema_response_id/actions/
http GET {{baseUrl}}/schema_responses/:schema_response_id/actions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id/actions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id/actions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"auto": false,
"comment": "",
"date_created": "2021-12-15T13:17:21.845573Z",
"date_modified": "2021-12-15T13:17:21.845622Z",
"from_state": "in_progress",
"to_state": "unapproved",
"trigger": "submit",
"visible": true
},
"embeds": {
"creator": {
"data": {
"attributes": {
"active": true,
"date_registered": "2017-02-02T21:32:45.495000Z",
"education": [],
"employment": [
{
"department": "Social Neuroscience Lab",
"endMonth": 0,
"endYear": "",
"institution": "Institute of Psychology, Polish Academy of Sciences",
"ongoing": true,
"startMonth": 9,
"startYear": "2016",
"title": "Head"
}
],
"family_name": "Okruszek",
"full_name": "Lukasz Okruszek",
"given_name": "Łukasz",
"locale": "pl",
"middle_names": "",
"social": {
"academiaInstitution": "",
"academiaProfileID": "",
"baiduScholar": "",
"github": [],
"impactStory": "",
"linkedIn": [],
"orcid": "0000-0002-7136-2864",
"profileWebsites": [],
"researchGate": "Lukasz-Okruszek",
"researcherId": "",
"scholar": "CHyWD84AAAAJ&hl",
"ssrn": "",
"twitter": []
},
"suffix": "",
"timezone": "Europe/Budapest"
},
"id": "zfsr2",
"links": {
"html": "https://osf.io/zfsr2/",
"profile_image": "https://secure.gravatar.com/avatar/8a25f4601ac997f113b3145aa5cf907e?d=identicon",
"self": "https://api.osf.io/v2/users/zfsr2/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/zfsr2/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/preprints/",
"meta": {}
}
}
},
"quickfiles": {
"links": {
"download": {
"href": "https://files.osf.io/v1/resources/ytg45jbs3r/providers/osfstorage/?zip=",
"meta": {}
},
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/quickfiles/",
"meta": {}
},
"upload": {
"href": "https://files.osf.io/v1/resources/ytg45jbs3r/providers/osfstorage/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "61b9eae1a7d8ac025c4c46d3",
"links": {
"self": "https://api.osf.io/v2/actions/61b9eae1a7d8ac025c4c46d3/"
},
"relationships": {
"creator": {
"data": {
"id": "zfsr2",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/",
"meta": {}
}
}
},
"target": {
"data": {
"id": "61b9cd62eb66180215222669",
"type": "schema_responses"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61b9cd62eb66180215222669/",
"meta": {}
}
}
}
},
"type": "schema-response-actions"
},
{
"attributes": {
"auto": false,
"comment": "",
"date_created": "2021-12-15T13:17:37.195568Z",
"date_modified": "2021-12-15T13:17:37.195597Z",
"from_state": "unapproved",
"to_state": "approved",
"trigger": "approve",
"visible": true
},
"embeds": {
"creator": {
"data": {
"attributes": {
"active": true,
"date_registered": "2017-02-02T21:32:45.495000Z",
"education": [],
"employment": [
{
"department": "Denfense",
"endMonth": 0,
"endYear": "",
"institution": "Institute of the Stars",
"ongoing": true,
"startMonth": 9,
"startYear": "2017",
"title": "Developer"
}
],
"family_name": "User",
"full_name": "Test User",
"given_name": "Test",
"locale": "pl",
"middle_names": "",
"social": {
"academiaInstitution": "",
"academiaProfileID": "",
"baiduScholar": "",
"github": [],
"impactStory": "",
"linkedIn": [],
"orcid": "0000-0002-7136-286X",
"profileWebsites": [],
"researchGate": "test-user",
"researcherId": "",
"scholar": "",
"ssrn": "",
"twitter": []
},
"suffix": "",
"timezone": "Europe/Budapest"
},
"id": "zfsr2",
"links": {
"html": "https://osf.io/zfsr2/",
"profile_image": "https://secure.gravatar.com/avatar/8a25f4601ac997f113b3145aa5cf907e?d=identicon",
"self": "https://api.osf.io/v2/users/sfsr2/"
},
"relationships": {
"groups": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/sfsr2/groups/",
"meta": {}
}
}
},
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/sfsr2/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/sfsr2/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/sfsr2/nodes/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/sfsr2/preprints/",
"meta": {}
}
}
},
"quickfiles": {
"links": {
"download": {
"href": "https://files.osf.io/v1/resources/ytg45jbs3r/providers/osfstorage/?zip=",
"meta": {}
},
"related": {
"href": "https://api.osf.io/v2/users/sfsr2/quickfiles/",
"meta": {}
},
"upload": {
"href": "https://files.osf.io/v1/resources/ytg45jbs3r/providers/osfstorage/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/sfsr2/registrations/",
"meta": {}
}
}
}
},
"type": "users"
}
}
},
"id": "61b9eaf13cddaa026ef7245d",
"links": {
"self": "https://api.osf.io/v2/actions/61b9eaf13cddaa026ef7245d/"
},
"relationships": {
"creator": {
"data": {
"id": "zfsr2",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zfsr2/",
"meta": {}
}
}
},
"target": {
"data": {
"id": "61b9cd62eb66180215222669",
"type": "schema_responses"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61b9cd62eb66180215222669/",
"meta": {}
}
}
}
},
"type": "schema-response-actions"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.osf.io/v2/schema_responses/61b9cd62eb66180215222669/actions/"
},
"meta": {
"per_page": 10,
"total": 2,
"version": "2.20"
}
}
POST
Create a new Schema Response
{{baseUrl}}/schema_responses/
BODY json
{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/schema_responses/" {:content-type :json
:form-params {:attributes {:date_created 0
:date_modified 0
:date_submitted 0
:is_original_response false
:is_pending_current_user_approval false
:reviews_state ""
:revision_justification ""
:revision_responses {}
:updated_response_keys []}
:id ""
:links {:self ""}
:relationships {:actions ""
:initiated_by ""
:registration ""
:registration_schema ""}
:type ""}})
require "http/client"
url = "{{baseUrl}}/schema_responses/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/schema_responses/"),
Content = new StringContent("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/"
payload := strings.NewReader("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/schema_responses/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 482
{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/schema_responses/")
.setHeader("content-type", "application/json")
.setBody("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/schema_responses/")
.header("content-type", "application/json")
.body("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {
self: ''
},
relationships: {
actions: '',
initiated_by: '',
registration: '',
registration_schema: ''
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/schema_responses/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/schema_responses/',
headers: {'content-type': 'application/json'},
data: {
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"date_created":0,"date_modified":0,"date_submitted":0,"is_original_response":false,"is_pending_current_user_approval":false,"reviews_state":"","revision_justification":"","revision_responses":{},"updated_response_keys":[]},"id":"","links":{"self":""},"relationships":{"actions":"","initiated_by":"","registration":"","registration_schema":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attributes": {\n "date_created": 0,\n "date_modified": 0,\n "date_submitted": 0,\n "is_original_response": false,\n "is_pending_current_user_approval": false,\n "reviews_state": "",\n "revision_justification": "",\n "revision_responses": {},\n "updated_response_keys": []\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "actions": "",\n "initiated_by": "",\n "registration": "",\n "registration_schema": ""\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/schema_responses/',
headers: {'content-type': 'application/json'},
body: {
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/schema_responses/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {
self: ''
},
relationships: {
actions: '',
initiated_by: '',
registration: '',
registration_schema: ''
},
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/schema_responses/',
headers: {'content-type': 'application/json'},
data: {
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"date_created":0,"date_modified":0,"date_submitted":0,"is_original_response":false,"is_pending_current_user_approval":false,"reviews_state":"","revision_justification":"","revision_responses":{},"updated_response_keys":[]},"id":"","links":{"self":""},"relationships":{"actions":"","initiated_by":"","registration":"","registration_schema":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"attributes": @{ @"date_created": @0, @"date_modified": @0, @"date_submitted": @0, @"is_original_response": @NO, @"is_pending_current_user_approval": @NO, @"reviews_state": @"", @"revision_justification": @"", @"revision_responses": @{ }, @"updated_response_keys": @[ ] },
@"id": @"",
@"links": @{ @"self": @"" },
@"relationships": @{ @"actions": @"", @"initiated_by": @"", @"registration": @"", @"registration_schema": @"" },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
'date_created' => 0,
'date_modified' => 0,
'date_submitted' => 0,
'is_original_response' => null,
'is_pending_current_user_approval' => null,
'reviews_state' => '',
'revision_justification' => '',
'revision_responses' => [
],
'updated_response_keys' => [
]
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'actions' => '',
'initiated_by' => '',
'registration' => '',
'registration_schema' => ''
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/schema_responses/', [
'body' => '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attributes' => [
'date_created' => 0,
'date_modified' => 0,
'date_submitted' => 0,
'is_original_response' => null,
'is_pending_current_user_approval' => null,
'reviews_state' => '',
'revision_justification' => '',
'revision_responses' => [
],
'updated_response_keys' => [
]
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'actions' => '',
'initiated_by' => '',
'registration' => '',
'registration_schema' => ''
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attributes' => [
'date_created' => 0,
'date_modified' => 0,
'date_submitted' => 0,
'is_original_response' => null,
'is_pending_current_user_approval' => null,
'reviews_state' => '',
'revision_justification' => '',
'revision_responses' => [
],
'updated_response_keys' => [
]
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'actions' => '',
'initiated_by' => '',
'registration' => '',
'registration_schema' => ''
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/schema_responses/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/schema_responses/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/"
payload = {
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": False,
"is_pending_current_user_approval": False,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": { "self": "" },
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/"
payload <- "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/schema_responses/') do |req|
req.body = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/";
let payload = json!({
"attributes": json!({
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": json!({}),
"updated_response_keys": ()
}),
"id": "",
"links": json!({"self": ""}),
"relationships": json!({
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
}),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/schema_responses/ \
--header 'content-type: application/json' \
--data '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}'
echo '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}' | \
http POST {{baseUrl}}/schema_responses/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "attributes": {\n "date_created": 0,\n "date_modified": 0,\n "date_submitted": 0,\n "is_original_response": false,\n "is_pending_current_user_approval": false,\n "reviews_state": "",\n "revision_justification": "",\n "revision_responses": {},\n "updated_response_keys": []\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "actions": "",\n "initiated_by": "",\n "registration": "",\n "registration_schema": ""\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/schema_responses/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attributes": [
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": [],
"updated_response_keys": []
],
"id": "",
"links": ["self": ""],
"relationships": [
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"revision_justification": "I made a mistake.",
"revision_responses": {
"Q1": "updated response"
}
},
"type": "schema-responses"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"date_created": "2021-12-21T14:10:32.665084",
"date_modified": "2021-12-21T14:10:32.665111",
"date_submitted": null,
"reviews_state": "in_progress",
"revision_justification": "",
"revision_responses": {
"summary": "A summary of what is contained in this registration.",
"uploader": []
},
"updated_response_keys": []
},
"id": "61c1e058e88376000a90e5dd",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61c1e058e88376000a90e5dd/"
},
"relationships": {
"actions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61c1e058e88376000a90e5dd/actions/",
"meta": {}
}
}
},
"initiated_by": {
"data": {
"id": "zpw9n",
"type": "users"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/users/zpw9n/",
"meta": {}
}
}
},
"registration": {
"data": {
"id": "e4ygz",
"type": "registrations"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/e4ygz/",
"meta": {}
}
}
},
"registration_schema": {
"data": {
"id": "5e13965879bee100010a790f",
"type": "registration-schemas"
},
"links": {
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/5e13965879bee100010a790f/",
"meta": {}
}
}
}
},
"type": "schema-responses"
},
"meta": {
"version": "2.0"
}
}
DELETE
Delete a Incomplete Schema Response
{{baseUrl}}/schema_responses/:schema_response_id
QUERY PARAMS
schema_response_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/schema_responses/:schema_response_id")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/schema_responses/:schema_response_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/schema_responses/:schema_response_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/schema_responses/:schema_response_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/schema_responses/:schema_response_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/schema_responses/:schema_response_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/schema_responses/:schema_response_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/schema_responses/:schema_response_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/schema_responses/:schema_response_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/schema_responses/:schema_response_id');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/schema_responses/:schema_response_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/schema_responses/:schema_response_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/schema_responses/:schema_response_id
http DELETE {{baseUrl}}/schema_responses/:schema_response_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all Schema Responses
{{baseUrl}}/schema_responses/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schema_responses/")
require "http/client"
url = "{{baseUrl}}/schema_responses/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schema_responses/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schema_responses/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schema_responses/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schema_responses/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schema_responses/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/schema_responses/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/schema_responses/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schema_responses/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/schema_responses/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schema_responses/');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schema_responses/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schema_responses/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schema_responses/
http GET {{baseUrl}}/schema_responses/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schema_responses/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"revision_justification": "I made a mistake.",
"revision_responses": {
"Q1": "updated response"
}
},
"type": "schema-responses"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_created": "2021-12-13T19:31:42.058Z",
"date_modified": "2021-12-13T19:53:05.015Z",
"date_submitted": "2021-12-13T19:53:02.837Z",
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "approved",
"revision_justification": "I made a mistake",
"revision_responses": {
"q1": "Answer 1",
"q2": "Answer 2"
}
},
"id": "61b79f9eadbb5701424a2d5e",
"relationships": {
"actions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/actions/",
"meta": {}
}
}
},
"initiated_by": {
"links": {
"data": {
"id": "swrv7",
"type": "users"
},
"related": {
"href": "https://api.osf.io/v2/users/swrv7/",
"meta": {}
}
}
},
"registration": {
"links": {
"data": {
"id": "jxtek",
"type": "registration"
},
"related": {
"href": "https://api.osf.io/v2/registrations/jxtek/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"data": {
"id": "5e795fc0d2833800195735d0",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/5e795fc0d2833800195735d0/",
"meta": {}
}
}
}
},
"type": "registration-schemas"
}
],
"links": {
"first": null,
"last": null,
"next": null,
"prev": null,
"self": "https://api.test.osf.io/v2/schema_responses/"
},
"meta": {
"per_page": 10,
"total": 1,
"version": "2.20"
}
}
GET
Retrieve a Schema Response
{{baseUrl}}/schema_responses/:schema_response_id
QUERY PARAMS
schema_response_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/schema_responses/:schema_response_id")
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/schema_responses/:schema_response_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/schema_responses/:schema_response_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/schema_responses/:schema_response_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/schema_responses/:schema_response_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/schema_responses/:schema_response_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/schema_responses/:schema_response_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/schema_responses/:schema_response_id');
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/schema_responses/:schema_response_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/schema_responses/:schema_response_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/schema_responses/:schema_response_id
http GET {{baseUrl}}/schema_responses/:schema_response_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"revision_justification": "I made a mistake.",
"revision_responses": {
"Q1": "updated response"
}
},
"type": "schema-responses"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"date_created": "2021-12-13T19:31:42.058Z",
"date_modified": "2021-12-13T19:53:05.015Z",
"date_submitted": "2021-12-13T19:53:02.837Z",
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "approved",
"revision_justification": "I made a mistake",
"revision_responses": {
"q1": "Answer 1",
"q2": "Answer 2"
}
},
"id": "61b79f9eadbb5701424a2d5e",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/"
},
"relationships": {
"actions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/actions/",
"meta": {}
}
}
},
"initiated_by": {
"links": {
"data": {
"id": "swrv7",
"type": "users"
},
"related": {
"href": "https://api.osf.io/v2/users/swrv7/",
"meta": {}
}
}
},
"registration": {
"links": {
"data": {
"id": "jxtek",
"type": "registration"
},
"related": {
"href": "https://api.osf.io/v2/registrations/jxtek/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"data": {
"id": "5e795fc0d2833800195735d0",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/5e795fc0d2833800195735d0/",
"meta": {}
}
}
}
},
"type": "registration-schemas"
}
}
PATCH
Update a Registration's Schema Response
{{baseUrl}}/schema_responses/:schema_response_id
QUERY PARAMS
schema_response_id
BODY json
{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/schema_responses/:schema_response_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/schema_responses/:schema_response_id" {:content-type :json
:form-params {:attributes {:date_created 0
:date_modified 0
:date_submitted 0
:is_original_response false
:is_pending_current_user_approval false
:reviews_state ""
:revision_justification ""
:revision_responses {}
:updated_response_keys []}
:id ""
:links {:self ""}
:relationships {:actions ""
:initiated_by ""
:registration ""
:registration_schema ""}
:type ""}})
require "http/client"
url = "{{baseUrl}}/schema_responses/:schema_response_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/schema_responses/:schema_response_id"),
Content = new StringContent("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/schema_responses/:schema_response_id");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/schema_responses/:schema_response_id"
payload := strings.NewReader("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/schema_responses/:schema_response_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 482
{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/schema_responses/:schema_response_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/schema_responses/:schema_response_id"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/schema_responses/:schema_response_id")
.header("content-type", "application/json")
.body("{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {
self: ''
},
relationships: {
actions: '',
initiated_by: '',
registration: '',
registration_schema: ''
},
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/schema_responses/:schema_response_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/schema_responses/:schema_response_id',
headers: {'content-type': 'application/json'},
data: {
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/schema_responses/:schema_response_id';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"date_created":0,"date_modified":0,"date_submitted":0,"is_original_response":false,"is_pending_current_user_approval":false,"reviews_state":"","revision_justification":"","revision_responses":{},"updated_response_keys":[]},"id":"","links":{"self":""},"relationships":{"actions":"","initiated_by":"","registration":"","registration_schema":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/schema_responses/:schema_response_id',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "attributes": {\n "date_created": 0,\n "date_modified": 0,\n "date_submitted": 0,\n "is_original_response": false,\n "is_pending_current_user_approval": false,\n "reviews_state": "",\n "revision_justification": "",\n "revision_responses": {},\n "updated_response_keys": []\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "actions": "",\n "initiated_by": "",\n "registration": "",\n "registration_schema": ""\n },\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/schema_responses/:schema_response_id")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/schema_responses/:schema_response_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/schema_responses/:schema_response_id',
headers: {'content-type': 'application/json'},
body: {
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/schema_responses/:schema_response_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {
self: ''
},
relationships: {
actions: '',
initiated_by: '',
registration: '',
registration_schema: ''
},
type: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/schema_responses/:schema_response_id',
headers: {'content-type': 'application/json'},
data: {
attributes: {
date_created: 0,
date_modified: 0,
date_submitted: 0,
is_original_response: false,
is_pending_current_user_approval: false,
reviews_state: '',
revision_justification: '',
revision_responses: {},
updated_response_keys: []
},
id: '',
links: {self: ''},
relationships: {actions: '', initiated_by: '', registration: '', registration_schema: ''},
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/schema_responses/:schema_response_id';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"attributes":{"date_created":0,"date_modified":0,"date_submitted":0,"is_original_response":false,"is_pending_current_user_approval":false,"reviews_state":"","revision_justification":"","revision_responses":{},"updated_response_keys":[]},"id":"","links":{"self":""},"relationships":{"actions":"","initiated_by":"","registration":"","registration_schema":""},"type":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"attributes": @{ @"date_created": @0, @"date_modified": @0, @"date_submitted": @0, @"is_original_response": @NO, @"is_pending_current_user_approval": @NO, @"reviews_state": @"", @"revision_justification": @"", @"revision_responses": @{ }, @"updated_response_keys": @[ ] },
@"id": @"",
@"links": @{ @"self": @"" },
@"relationships": @{ @"actions": @"", @"initiated_by": @"", @"registration": @"", @"registration_schema": @"" },
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/schema_responses/:schema_response_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/schema_responses/:schema_response_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/schema_responses/:schema_response_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'attributes' => [
'date_created' => 0,
'date_modified' => 0,
'date_submitted' => 0,
'is_original_response' => null,
'is_pending_current_user_approval' => null,
'reviews_state' => '',
'revision_justification' => '',
'revision_responses' => [
],
'updated_response_keys' => [
]
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'actions' => '',
'initiated_by' => '',
'registration' => '',
'registration_schema' => ''
],
'type' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/schema_responses/:schema_response_id', [
'body' => '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/schema_responses/:schema_response_id');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'attributes' => [
'date_created' => 0,
'date_modified' => 0,
'date_submitted' => 0,
'is_original_response' => null,
'is_pending_current_user_approval' => null,
'reviews_state' => '',
'revision_justification' => '',
'revision_responses' => [
],
'updated_response_keys' => [
]
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'actions' => '',
'initiated_by' => '',
'registration' => '',
'registration_schema' => ''
],
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'attributes' => [
'date_created' => 0,
'date_modified' => 0,
'date_submitted' => 0,
'is_original_response' => null,
'is_pending_current_user_approval' => null,
'reviews_state' => '',
'revision_justification' => '',
'revision_responses' => [
],
'updated_response_keys' => [
]
],
'id' => '',
'links' => [
'self' => ''
],
'relationships' => [
'actions' => '',
'initiated_by' => '',
'registration' => '',
'registration_schema' => ''
],
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/schema_responses/:schema_response_id');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/schema_responses/:schema_response_id' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/schema_responses/:schema_response_id' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/schema_responses/:schema_response_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/schema_responses/:schema_response_id"
payload = {
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": False,
"is_pending_current_user_approval": False,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": { "self": "" },
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/schema_responses/:schema_response_id"
payload <- "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/schema_responses/:schema_response_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/schema_responses/:schema_response_id') do |req|
req.body = "{\n \"attributes\": {\n \"date_created\": 0,\n \"date_modified\": 0,\n \"date_submitted\": 0,\n \"is_original_response\": false,\n \"is_pending_current_user_approval\": false,\n \"reviews_state\": \"\",\n \"revision_justification\": \"\",\n \"revision_responses\": {},\n \"updated_response_keys\": []\n },\n \"id\": \"\",\n \"links\": {\n \"self\": \"\"\n },\n \"relationships\": {\n \"actions\": \"\",\n \"initiated_by\": \"\",\n \"registration\": \"\",\n \"registration_schema\": \"\"\n },\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/schema_responses/:schema_response_id";
let payload = json!({
"attributes": json!({
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": json!({}),
"updated_response_keys": ()
}),
"id": "",
"links": json!({"self": ""}),
"relationships": json!({
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
}),
"type": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/schema_responses/:schema_response_id \
--header 'content-type: application/json' \
--data '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}'
echo '{
"attributes": {
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": {},
"updated_response_keys": []
},
"id": "",
"links": {
"self": ""
},
"relationships": {
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
},
"type": ""
}' | \
http PATCH {{baseUrl}}/schema_responses/:schema_response_id \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "attributes": {\n "date_created": 0,\n "date_modified": 0,\n "date_submitted": 0,\n "is_original_response": false,\n "is_pending_current_user_approval": false,\n "reviews_state": "",\n "revision_justification": "",\n "revision_responses": {},\n "updated_response_keys": []\n },\n "id": "",\n "links": {\n "self": ""\n },\n "relationships": {\n "actions": "",\n "initiated_by": "",\n "registration": "",\n "registration_schema": ""\n },\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/schema_responses/:schema_response_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"attributes": [
"date_created": 0,
"date_modified": 0,
"date_submitted": 0,
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "",
"revision_justification": "",
"revision_responses": [],
"updated_response_keys": []
],
"id": "",
"links": ["self": ""],
"relationships": [
"actions": "",
"initiated_by": "",
"registration": "",
"registration_schema": ""
],
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/schema_responses/:schema_response_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"revision_justification": "I made a mistake.",
"revision_responses": {
"Q1": "updated response"
}
},
"type": "schema-responses"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"date_created": "2021-12-13T19:31:42.058Z",
"date_modified": "2021-12-13T19:53:05.015Z",
"date_submitted": "2021-12-13T19:53:02.837Z",
"is_original_response": false,
"is_pending_current_user_approval": false,
"reviews_state": "in_progress",
"revision_justification": "I made a mistake",
"revision_responses": {
"q1": "updated respons",
"q2": "Answer 2"
}
},
"id": "61b79f9eadbb5701424a2d5e",
"links": {
"self": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/"
},
"relationships": {
"actions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/schema_responses/61b79f9eadbb5701424a2d5e/actions/",
"meta": {}
}
}
},
"initiated_by": {
"links": {
"data": {
"id": "swrv7",
"type": "users"
},
"related": {
"href": "https://api.osf.io/v2/users/swrv7/",
"meta": {}
}
}
},
"registration": {
"links": {
"data": {
"id": "jxtek",
"type": "registration"
},
"related": {
"href": "https://api.osf.io/v2/registrations/jxtek/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"data": {
"id": "5e795fc0d2833800195735d0",
"type": "registration-schemas"
},
"related": {
"href": "https://api.osf.io/v2/schemas/registrations/5e795fc0d2833800195735d0/",
"meta": {}
}
}
}
},
"type": "registration-schemas"
}
}
GET
List all taxonomies (GET)
{{baseUrl}}/taxonomies/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/taxonomies/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/taxonomies/")
require "http/client"
url = "{{baseUrl}}/taxonomies/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/taxonomies/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/taxonomies/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/taxonomies/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/taxonomies/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/taxonomies/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/taxonomies/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/taxonomies/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/taxonomies/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/taxonomies/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/taxonomies/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/taxonomies/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/taxonomies/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/taxonomies/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/taxonomies/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/taxonomies/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/taxonomies/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/taxonomies/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/taxonomies/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/taxonomies/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/taxonomies/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/taxonomies/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/taxonomies/');
echo $response->getBody();
setUrl('{{baseUrl}}/taxonomies/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/taxonomies/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/taxonomies/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/taxonomies/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/taxonomies/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/taxonomies/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/taxonomies/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/taxonomies/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/taxonomies/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/taxonomies/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/taxonomies/
http GET {{baseUrl}}/taxonomies/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/taxonomies/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/taxonomies/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240d954be81056ceca97a",
"text": "Philosophy"
}
],
"text": "History of Philosophy"
},
"id": "584240d854be81056ceca838",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240d954be81056ceca97a/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d854be81056ceca838/"
},
"type": "taxonomies"
},
{
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240db54be81056cecacd3",
"text": "Law"
}
],
"text": "Animal Law"
},
"id": "584240d854be81056ceca839",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240db54be81056cecacd3/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d854be81056ceca839/"
},
"type": "taxonomies"
},
{
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240db54be81056cecacd3",
"text": "Law"
}
],
"text": "Consumer Protection Law"
},
"id": "584240d854be81056ceca83a",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240db54be81056cecacd3/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d854be81056ceca83a/"
},
"type": "taxonomies"
},
{
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240da54be81056cecaa9c",
"text": "Religion"
}
],
"text": "Missions and World Christianity"
},
"id": "584240d854be81056ceca83b",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240da54be81056cecaa9c/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d854be81056ceca83b/"
},
"type": "taxonomies"
},
{
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240d954be81056ceca8fd",
"text": "Teacher Education and Professional Development"
}
],
"text": "Other Teacher Education and Professional Development"
},
"id": "584240d854be81056ceca83c",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240d954be81056ceca8fd/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d854be81056ceca83c/"
},
"type": "taxonomies"
}
],
"links": {
"first": null,
"last": null,
"meta": null,
"next": null,
"per_page": 10,
"prev": null,
"total": 5
}
}
GET
Retrieve a taxonomy
{{baseUrl}}/taxonomies/:taxonomy_id/
QUERY PARAMS
taxonomy_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/taxonomies/:taxonomy_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/taxonomies/:taxonomy_id/")
require "http/client"
url = "{{baseUrl}}/taxonomies/:taxonomy_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/taxonomies/:taxonomy_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/taxonomies/:taxonomy_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/taxonomies/:taxonomy_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/taxonomies/:taxonomy_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/taxonomies/:taxonomy_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/taxonomies/:taxonomy_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/taxonomies/:taxonomy_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/taxonomies/:taxonomy_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/taxonomies/:taxonomy_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/taxonomies/:taxonomy_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/taxonomies/:taxonomy_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/taxonomies/:taxonomy_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/taxonomies/:taxonomy_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/taxonomies/:taxonomy_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/taxonomies/:taxonomy_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/taxonomies/:taxonomy_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/taxonomies/:taxonomy_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/taxonomies/:taxonomy_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/taxonomies/:taxonomy_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/taxonomies/:taxonomy_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/taxonomies/:taxonomy_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/taxonomies/:taxonomy_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/taxonomies/:taxonomy_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/taxonomies/:taxonomy_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/taxonomies/:taxonomy_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/taxonomies/:taxonomy_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/taxonomies/:taxonomy_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/taxonomies/:taxonomy_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/taxonomies/:taxonomy_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/taxonomies/:taxonomy_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/taxonomies/:taxonomy_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/taxonomies/:taxonomy_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/taxonomies/:taxonomy_id/
http GET {{baseUrl}}/taxonomies/:taxonomy_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/taxonomies/:taxonomy_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/taxonomies/:taxonomy_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"child_count": 0,
"parents": [
{
"id": "584240da54be81056cecab8f",
"text": "Economics"
}
],
"text": "Public Economics"
},
"id": "584240d954be81056ceca841",
"links": {
"parents": [
"https://api.osf.io/v2/taxonomies/584240da54be81056cecab8f/"
],
"self": "https://api.osf.io/v2/taxonomies/584240d954be81056ceca841/"
},
"type": "taxonomies"
}
}
GET
List all addon accounts
{{baseUrl}}/users/:user_id/addons/:provider/accounts/
QUERY PARAMS
user_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/addons/:provider/accounts/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/addons/:provider/accounts/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/addons/:provider/accounts/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/addons/:provider/accounts/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/addons/:provider/accounts/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/addons/:provider/accounts/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/addons/:provider/accounts/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/addons/:provider/accounts/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/addons/:provider/accounts/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/:provider/accounts/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/addons/:provider/accounts/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/addons/:provider/accounts/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/addons/:provider/accounts/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/:provider/accounts/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/addons/:provider/accounts/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/addons/:provider/accounts/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/addons/:provider/accounts/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/addons/:provider/accounts/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/addons/:provider/accounts/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/addons/:provider/accounts/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/addons/:provider/accounts/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/addons/:provider/accounts/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/addons/:provider/accounts/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/addons/:provider/accounts/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/addons/:provider/accounts/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/addons/:provider/accounts/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/addons/:provider/accounts/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/addons/:provider/accounts/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/addons/:provider/accounts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/addons/:provider/accounts/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/addons/:provider/accounts/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/addons/:provider/accounts/
http GET {{baseUrl}}/users/:user_id/addons/:provider/accounts/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/addons/:provider/accounts/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/addons/:provider/accounts/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"display_name": "Fabrice Mizero",
"profile_url": null,
"provider": "dropbox"
},
"id": "58d16ece9ad5a10201027eb4",
"links": {
"self": "https://api.osf.io/v2/users/me/addons/dropbox/accounts/58d16ece9ad5a10201027eb4/"
},
"type": "external_accounts"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 1
},
"next": null,
"prev": null
}
}
GET
List all institutions (2)
{{baseUrl}}/users/:user_id/institutions/
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/institutions/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/institutions/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/institutions/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/institutions/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/institutions/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/institutions/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/institutions/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/institutions/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/institutions/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/institutions/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/institutions/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/institutions/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/institutions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/institutions/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/institutions/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/institutions/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/institutions/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/institutions/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/institutions/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/institutions/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/institutions/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/institutions/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/institutions/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/institutions/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/institutions/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/institutions/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/institutions/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/institutions/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/institutions/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/institutions/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/institutions/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/institutions/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/institutions/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/institutions/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/institutions/
http GET {{baseUrl}}/users/:user_id/institutions/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/institutions/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/institutions/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"auth_url": "https://accounts.osf.io/Shibboleth.sso/Login?entityID=urn%3Amace%3Aincommon%3Avirginia.edu",
"description": "In partnership with the Vice President for Research, Data Science Institute, Health Sciences Library, and University Library. Learn more about UVA resources for computational and data-driven research. Projects must abide by the University Security and Data Protection Policies.",
"logo_path": "/static/img/institutions/shields/uva-shield.png",
"name": "University of Virginia"
},
"id": "uva",
"links": {
"self": "https://api.osf.io/v2/institutions/uva/"
},
"relationships": {
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/nodes/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/registrations/",
"meta": {}
}
}
},
"users": {
"links": {
"related": {
"href": "https://api.osf.io/v2/institutions/uva/users/",
"meta": {}
}
}
}
},
"type": "institutions"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 2
},
"next": null,
"prev": null
}
}
GET
List all nodes (GET)
{{baseUrl}}/users/:user_id/nodes/
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/nodes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/nodes/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/nodes/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/nodes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/nodes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/nodes/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/nodes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/nodes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/nodes/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/nodes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/nodes/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/nodes/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/nodes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/nodes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/nodes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/nodes/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/nodes/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/nodes/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/nodes/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/nodes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/nodes/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/nodes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/nodes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/nodes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/nodes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/nodes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/nodes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/nodes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/nodes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/nodes/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/nodes/
http GET {{baseUrl}}/users/:user_id/nodes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/nodes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2013-10-22T20:07:57.674000",
"date_modified": "2017-02-09T20:37:49.060000",
"description": null,
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "Study 8: Replication of Hatzivassiliou et al., 2010 (Nature)"
},
"id": "0hezb",
"links": {
"html": "https://osf.io/0hezb/",
"self": "https://api.osf.io/v2/nodes/0hezb/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/0hezb/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/comments/?filter%5Btarget%5D=0hezb",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/0hezb/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/node_links/",
"meta": {}
}
}
},
"parent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/p7ayb/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/e81xl/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/0hezb/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/users/alh38/nodes/?page=23",
"meta": {
"per_page": 10,
"total": 224
},
"next": "https://api.osf.io/v2/users/alh38/nodes/?page=2",
"prev": null
}
}
GET
List all preprints (2)
{{baseUrl}}/users/:user_id/preprints/
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/preprints/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/preprints/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/preprints/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/preprints/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/preprints/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/preprints/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/preprints/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/preprints/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/preprints/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/preprints/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/preprints/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/preprints/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/preprints/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/preprints/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/preprints/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/preprints/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/preprints/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/preprints/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/preprints/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/preprints/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/preprints/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/preprints/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/preprints/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/preprints/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/preprints/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/preprints/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/preprints/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/preprints/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/preprints/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/preprints/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/preprints/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/preprints/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/preprints/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/preprints/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/preprints/
http GET {{baseUrl}}/users/:user_id/preprints/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/preprints/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/preprints/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {},
"relationships": {
"node": {
"data": {
"id": "{node_id}",
"type": "nodes"
}
},
"primary_file": {
"data": {
"id": "{primary_file_id}",
"type": "primary_files"
}
},
"provider": {
"data": {
"id": "{preprint_provider_id}",
"type": "providers"
}
}
}
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"date_created": "2016-08-29T14:53:51.185000",
"date_modified": "2016-08-29T14:53:51.185000",
"date_published": "2016-08-29T14:53:51.185000",
"doi": "10.1371/journal.pbio.1002456",
"is_preprint_orphan": false,
"is_published": true,
"license_record": null,
"subjects": [
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecaab8",
"text": "Public Affairs, Public Policy and Public Administration"
},
{
"id": "584240d954be81056cecaa10",
"text": "Science and Technology Policy"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecab33",
"text": "Library and Information Science"
},
{
"id": "584240db54be81056cecacd2",
"text": "Scholarly Publishing"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac68",
"text": "Psychology"
}
],
[
{
"id": "584240da54be81056cecac48",
"text": "Social and Behavioral Sciences"
},
{
"id": "584240da54be81056cecac68",
"text": "Psychology"
}
]
]
},
"id": "khbvy",
"links": {
"doi": "https://dx.doi.org/10.1371/journal.pbio.1002456",
"html": "https://osf.io/khbvy/",
"self": "https://api.osf.io/v2/preprints/khbvy/"
},
"relationships": {
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprints/khbvy/citation/",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bnzx5/",
"meta": {}
}
}
},
"primary_file": {
"links": {
"related": {
"href": "https://api.osf.io/v2/files/57c44b1e594d90004a421ab1/",
"meta": {}
}
}
},
"provider": {
"links": {
"related": {
"href": "https://api.osf.io/v2/preprint_providers/osf/",
"meta": {}
}
}
}
},
"type": "preprints"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 4
},
"next": null,
"prev": null
}
}
GET
List all registrations (1)
{{baseUrl}}/users/:user_id/registrations/
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/registrations/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/registrations/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/registrations/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/registrations/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/registrations/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/registrations/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/registrations/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/registrations/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/registrations/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/registrations/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/registrations/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/registrations/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/registrations/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/registrations/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/registrations/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/registrations/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/registrations/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/registrations/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/registrations/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/registrations/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/registrations/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/registrations/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/registrations/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/registrations/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/registrations/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/registrations/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/registrations/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/registrations/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/registrations/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/registrations/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/registrations/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/registrations/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/registrations/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/registrations/
http GET {{baseUrl}}/users/:user_id/registrations/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/registrations/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/registrations/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "communication",
"collection": false,
"current_user_can_comment": true,
"current_user_permissions": [
"read"
],
"date_created": "2016-09-27T01:12:42.135000",
"date_modified": "2016-11-18T19:14:42.873000",
"date_registered": "2016-11-18T19:16:56.962000",
"description": "",
"embargo_end_date": null,
"fork": false,
"node_license": null,
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/node_links/",
"meta": {}
}
}
},
"pending_embargo_approval": false,
"pending_registration_approval": false,
"pending_withdrawal": false,
"preprint": false,
"public": true,
"registered_meta": {
"comments": {
"comments": [],
"extra": [],
"value": ""
},
"datacompletion": {
"comments": [],
"extra": [],
"value": "No, data collection has not begun"
},
"looked": {
"comments": [],
"extra": [],
"value": "No"
}
},
"registration": true,
"registration_supplement": "OSF-Standard Pre-Data Collection Registration",
"tags": [],
"title": "Replication Reports",
"withdrawal_justification": null,
"withdrawn": false
},
"id": "d5r99",
"links": {
"html": "https://osf.io/d5r99/",
"self": "https://api.osf.io/v2/registrations/d5r99/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/comments/?filter%5Btarget%5D=d5r99",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/contributors/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/registrations/d5r99/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/logs/",
"meta": {}
}
}
},
"parent": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/sdbdx/",
"meta": {}
}
}
},
"registered_by": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/dnhrw/",
"meta": {}
}
}
},
"registered_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/qce75/",
"meta": {}
}
}
},
"registration_schema": {
"links": {
"related": {
"href": "https://api.osf.io/v2/metaschemas/564d31db8c5e4a7c9694b2c0/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/sdbdx/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/registrations/d5r99/wikis/",
"meta": {}
}
}
}
},
"type": "registrations"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/users/cdi38/registrations/?page=17",
"meta": {
"per_page": 10,
"total": 170
},
"next": "https://api.osf.io/v2/users/cdi38/registrations/?page=2",
"prev": null
}
}
GET
List all user addons
{{baseUrl}}/users/:user_id/addons/
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/addons/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/addons/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/addons/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/addons/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/addons/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/addons/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/addons/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/addons/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/addons/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/addons/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/addons/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/addons/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/addons/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/addons/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/addons/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/addons/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/addons/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/addons/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/addons/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/addons/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/addons/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/addons/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/addons/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/addons/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/addons/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/addons/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/addons/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/addons/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/addons/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/addons/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/addons/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/addons/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/addons/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/addons/
http GET {{baseUrl}}/users/:user_id/addons/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/addons/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/addons/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"user_has_auth": true
},
"id": "box",
"links": {
"accounts": {
"562d9acf8c5e4a14112e489e": {
"account": "https://api.osf.io/v2/users/q7fts/addons/box/accounts/562d9acf8c5e4a14112e489e/",
"nodes_connected": [
"https://api.osf.io/v2/nodes/t3y58/"
]
}
},
"self": "https://api.osf.io/v2/users/me/addons/box/"
},
"type": "user_addons"
},
{
"attributes": {
"user_has_auth": true
},
"id": "dropbox",
"links": {
"accounts": {
"56742db88c5e4a396d689e3e": {
"account": "https://api.osf.io/v2/users/q7fts/addons/dropbox/accounts/56742db88c5e4a396d689e3e/",
"nodes_connected": []
}
},
"self": "https://api.osf.io/v2/users/me/addons/dropbox/"
},
"type": "user_addons"
},
{
"attributes": {
"user_has_auth": true
},
"id": "github",
"links": {
"accounts": {
"570edf7f9ad5a101f90030f6": {
"account": "https://api.osf.io/v2/users/q7fts/addons/github/accounts/570edf7f9ad5a101f90030f6/",
"nodes_connected": [
"https://api.osf.io/v2/nodes/t3y58/"
]
}
},
"self": "https://api.osf.io/v2/users/me/addons/github/"
},
"type": "user_addons"
},
{
"attributes": {
"user_has_auth": true
},
"id": "googledrive",
"links": {
"accounts": {
"563c1c518c5e4a36e7dc5450": {
"account": "https://api.osf.io/v2/users/q7fts/addons/googledrive/accounts/563c1c518c5e4a36e7dc5450/",
"nodes_connected": [
"https://api.osf.io/v2/nodes/6y5jf/",
"https://api.osf.io/v2/nodes/t3y58/"
]
},
"58fe1cb59ad5a1025c8ae281": {
"account": "https://api.osf.io/v2/users/q7fts/addons/googledrive/accounts/58fe1cb59ad5a1025c8ae281/",
"nodes_connected": []
}
},
"self": "https://api.osf.io/v2/users/me/addons/googledrive/"
},
"type": "user_addons"
}
],
"links": {
"first": null,
"last": null,
"meta": {
"per_page": 10,
"total": 4
},
"next": null,
"prev": null
}
}
GET
List all users
{{baseUrl}}/users/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/")
require "http/client"
url = "{{baseUrl}}/users/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/users/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/users/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/
http GET {{baseUrl}}/users/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"active": true,
"date_registered": "2014-06-15T17:39:06.701000",
"family_name": "Rollins",
"full_name": "Casey Rollins",
"given_name": "Casey",
"locale": "en_US",
"middle_names": "",
"suffix": "",
"timezone": "America/New_York"
},
"id": "q7fts",
"links": {
"html": "https://osf.io/q7fts/",
"profile_image": "https://secure.gravatar.com/avatar/e9d9311ab2f5ab7492a86ac9adb5c8e9?d=identicon",
"self": "https://api.osf.io/v2/users/q7fts/"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/q7fts/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/q7fts/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/q7fts/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
],
"links": {
"first": null,
"last": "https://api.osf.io/v2/users/?page=4337",
"meta": {
"per_page": 10,
"total": 43370
},
"next": "https://api.osf.io/v2/users/?page=2",
"prev": null
}
}
GET
Retrieve a user addon
{{baseUrl}}/users/:user_id/addons/:provider/
QUERY PARAMS
user_id
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/addons/:provider/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/addons/:provider/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/addons/:provider/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/addons/:provider/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/addons/:provider/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/addons/:provider/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/addons/:provider/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/addons/:provider/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/addons/:provider/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/:provider/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/addons/:provider/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/addons/:provider/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/addons/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/addons/:provider/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/:provider/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/addons/:provider/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/addons/:provider/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/addons/:provider/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/addons/:provider/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/addons/:provider/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/addons/:provider/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/addons/:provider/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/addons/:provider/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/addons/:provider/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/addons/:provider/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/addons/:provider/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/addons/:provider/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/addons/:provider/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/addons/:provider/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/addons/:provider/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/addons/:provider/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/addons/:provider/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/addons/:provider/
http GET {{baseUrl}}/users/:user_id/addons/:provider/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/addons/:provider/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/addons/:provider/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"user_has_auth": true
},
"id": "dropbox",
"links": {
"accounts": {
"58d16ece9ad5a10201025eb4": {
"account": "https://api.osf.io/v2/users/f542f/addons/dropbox/accounts/58d16ece9ad5a10201025eb4/",
"nodes_connected": []
}
},
"self": "https://api.osf.io/v2/users/me/addons/dropbox/"
},
"type": "user_addons"
}
}
GET
Retrieve a user
{{baseUrl}}/users/:user_id/
QUERY PARAMS
user_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/users/:user_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/
http GET {{baseUrl}}/users/:user_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"active": true,
"date_registered": "2014-06-15T17:39:06.701000",
"family_name": "Rollins",
"full_name": "Casey Rollins",
"given_name": "Casey",
"locale": "en_US",
"middle_names": "",
"suffix": "",
"timezone": "America/New_York"
},
"id": "q7fts",
"links": {
"html": "https://osf.io/q7fts/",
"profile_image": "https://secure.gravatar.com/avatar/e9d9311ab2f5ab7492a86ac9adb5c8e9?d=identicon",
"self": "https://api.osf.io/v2/users/q7fts/"
},
"relationships": {
"institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/q7fts/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/users/q7fts/relationships/institutions/",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/q7fts/nodes/",
"meta": {}
}
}
}
},
"type": "users"
}
}
GET
Retrieve an addon account
{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/
QUERY PARAMS
user_id
provider
account_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")
require "http/client"
url = "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/users/:user_id/addons/:provider/accounts/:account_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/addons/:provider/accounts/:account_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/users/:user_id/addons/:provider/accounts/:account_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/users/:user_id/addons/:provider/accounts/:account_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/
http GET {{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/addons/:provider/accounts/:account_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"data": {
"attributes": {
"display_name": "Fabrice Mizero",
"profile_url": null,
"provider": "dropbox"
},
"id": "58d16ece9ad5a10201027eb4",
"links": {
"self": "https://api.osf.io/v2/users/me/addons/dropbox/accounts/58d16ece9ad5a10201027eb4/"
},
"type": "external_accounts"
}
}
}
PATCH
Update a user
{{baseUrl}}/users/:user_id/
QUERY PARAMS
user_id
BODY json
{
"attributes": {
"active": false,
"date_registered": "",
"family_name": "",
"full_name": "",
"given_name": "",
"locale": "",
"middle_names": "",
"suffix": "",
"timezone": ""
},
"id": "",
"links": {
"html": "",
"profile_image": ""
},
"relationships": {
"institutions": "",
"nodes": ""
},
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/users/:user_id/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/users/:user_id/" {:content-type :json
:form-params {:data {:attributes {:full_name "Casey M. Rollins"
:middle_names "Marie"}
:id "{user_id}"
:type "users"}}})
require "http/client"
url = "{{baseUrl}}/users/:user_id/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/users/:user_id/"),
Content = new StringContent("{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/users/:user_id/");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/users/:user_id/"
payload := strings.NewReader("{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/users/:user_id/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 158
{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/users/:user_id/")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/users/:user_id/"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/users/:user_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/users/:user_id/")
.header("content-type", "application/json")
.body("{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}")
.asString();
const data = JSON.stringify({
data: {
attributes: {
full_name: 'Casey M. Rollins',
middle_names: 'Marie'
},
id: '{user_id}',
type: 'users'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/users/:user_id/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/users/:user_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {full_name: 'Casey M. Rollins', middle_names: 'Marie'},
id: '{user_id}',
type: 'users'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/users/:user_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"full_name":"Casey M. Rollins","middle_names":"Marie"},"id":"{user_id}","type":"users"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/users/:user_id/',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {\n "attributes": {\n "full_name": "Casey M. Rollins",\n "middle_names": "Marie"\n },\n "id": "{user_id}",\n "type": "users"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/users/:user_id/")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/users/:user_id/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {
attributes: {full_name: 'Casey M. Rollins', middle_names: 'Marie'},
id: '{user_id}',
type: 'users'
}
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/users/:user_id/',
headers: {'content-type': 'application/json'},
body: {
data: {
attributes: {full_name: 'Casey M. Rollins', middle_names: 'Marie'},
id: '{user_id}',
type: 'users'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/users/:user_id/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {
attributes: {
full_name: 'Casey M. Rollins',
middle_names: 'Marie'
},
id: '{user_id}',
type: 'users'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/users/:user_id/',
headers: {'content-type': 'application/json'},
data: {
data: {
attributes: {full_name: 'Casey M. Rollins', middle_names: 'Marie'},
id: '{user_id}',
type: 'users'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/users/:user_id/';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"data":{"attributes":{"full_name":"Casey M. Rollins","middle_names":"Marie"},"id":"{user_id}","type":"users"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ @"attributes": @{ @"full_name": @"Casey M. Rollins", @"middle_names": @"Marie" }, @"id": @"{user_id}", @"type": @"users" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/users/:user_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/users/:user_id/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/users/:user_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'attributes' => [
'full_name' => 'Casey M. Rollins',
'middle_names' => 'Marie'
],
'id' => '{user_id}',
'type' => 'users'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/users/:user_id/', [
'body' => '{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/users/:user_id/');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
'attributes' => [
'full_name' => 'Casey M. Rollins',
'middle_names' => 'Marie'
],
'id' => '{user_id}',
'type' => 'users'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
'attributes' => [
'full_name' => 'Casey M. Rollins',
'middle_names' => 'Marie'
],
'id' => '{user_id}',
'type' => 'users'
]
]));
$request->setRequestUrl('{{baseUrl}}/users/:user_id/');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/users/:user_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/users/:user_id/' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/users/:user_id/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/users/:user_id/"
payload = { "data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
} }
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/users/:user_id/"
payload <- "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/users/:user_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/users/:user_id/') do |req|
req.body = "{\n \"data\": {\n \"attributes\": {\n \"full_name\": \"Casey M. Rollins\",\n \"middle_names\": \"Marie\"\n },\n \"id\": \"{user_id}\",\n \"type\": \"users\"\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/users/:user_id/";
let payload = json!({"data": json!({
"attributes": json!({
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
}),
"id": "{user_id}",
"type": "users"
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/users/:user_id/ \
--header 'content-type: application/json' \
--data '{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}'
echo '{
"data": {
"attributes": {
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
},
"id": "{user_id}",
"type": "users"
}
}' | \
http PATCH {{baseUrl}}/users/:user_id/ \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "data": {\n "attributes": {\n "full_name": "Casey M. Rollins",\n "middle_names": "Marie"\n },\n "id": "{user_id}",\n "type": "users"\n }\n}' \
--output-document \
- {{baseUrl}}/users/:user_id/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["data": [
"attributes": [
"full_name": "Casey M. Rollins",
"middle_names": "Marie"
],
"id": "{user_id}",
"type": "users"
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/users/:user_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List all nodes (1)
{{baseUrl}}/view_only_links/:link_id/nodes/
QUERY PARAMS
link_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/view_only_links/:link_id/nodes/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/view_only_links/:link_id/nodes/")
require "http/client"
url = "{{baseUrl}}/view_only_links/:link_id/nodes/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/view_only_links/:link_id/nodes/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/view_only_links/:link_id/nodes/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/view_only_links/:link_id/nodes/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/view_only_links/:link_id/nodes/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/view_only_links/:link_id/nodes/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/view_only_links/:link_id/nodes/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/view_only_links/:link_id/nodes/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/view_only_links/:link_id/nodes/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/view_only_links/:link_id/nodes/');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/view_only_links/:link_id/nodes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/view_only_links/:link_id/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/view_only_links/:link_id/nodes/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/view_only_links/:link_id/nodes/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/view_only_links/:link_id/nodes/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/view_only_links/:link_id/nodes/'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/view_only_links/:link_id/nodes/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/view_only_links/:link_id/nodes/'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/view_only_links/:link_id/nodes/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/view_only_links/:link_id/nodes/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/view_only_links/:link_id/nodes/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/view_only_links/:link_id/nodes/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/view_only_links/:link_id/nodes/');
echo $response->getBody();
setUrl('{{baseUrl}}/view_only_links/:link_id/nodes/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/view_only_links/:link_id/nodes/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/view_only_links/:link_id/nodes/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/view_only_links/:link_id/nodes/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/view_only_links/:link_id/nodes/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/view_only_links/:link_id/nodes/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/view_only_links/:link_id/nodes/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/view_only_links/:link_id/nodes/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/view_only_links/:link_id/nodes/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/view_only_links/:link_id/nodes/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/view_only_links/:link_id/nodes/
http GET {{baseUrl}}/view_only_links/:link_id/nodes/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/view_only_links/:link_id/nodes/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/view_only_links/:link_id/nodes/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
[
{
"data": {
"attributes": {
"category": "software",
"title": "An Excellent Project Title"
},
"type": "nodes"
}
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": [
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2014-07-28T13:53:04.508000",
"date_modified": "2017-03-03T05:00:31.512000",
"description": "This is an independent replication as part of the Reproducibility Project: Psychology.",
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "Replication of WA Cunningham, JJ Van Bavel, IR Johnsen (2008, PS 19(2))"
},
"id": "bifc7",
"links": {
"html": "https://osf.io/bifc7/",
"self": "https://api.osf.io/v2/nodes/bifc7/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/bifc7/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/comments/?filter%5Btarget%5D=bifc7",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/bifc7/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/bifc7/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
},
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2012-10-31T18:50:46.111000",
"date_modified": "2016-10-02T19:50:23.605000",
"description": null,
"fork": true,
"node_license": {
"copyright_holders": [
""
],
"year": "2016"
},
"preprint": false,
"public": true,
"registration": false,
"tags": [
"anxiety",
"EMG",
"EEG",
"motivation",
"ERN"
],
"title": "Replication of Hajcak & Foti (2008, PS, Study 1)"
},
"id": "73pnd",
"links": {
"html": "https://osf.io/73pnd/",
"self": "https://api.osf.io/v2/nodes/73pnd/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/73pnd/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/comments/?filter%5Btarget%5D=73pnd",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/files/",
"meta": {}
}
}
},
"forked_from": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/kxhz5/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/identifiers/",
"meta": {}
}
}
},
"license": {
"links": {
"related": {
"href": "https://api.osf.io/v2/licenses/563c1cf88c5e4a3877f9e96a/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/73pnd/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/73pnd/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
},
{
"attributes": {
"category": "project",
"collection": false,
"current_user_can_comment": false,
"current_user_permissions": [
"read"
],
"date_created": "2014-09-23T18:58:54.915000",
"date_modified": "2016-08-31T18:16:25.056000",
"description": null,
"fork": false,
"node_license": null,
"preprint": false,
"public": true,
"registration": false,
"tags": [],
"title": "Replication of Winawer, Huk, & Boroditsky (Psychological Science, 2008)"
},
"id": "mjasz",
"links": {
"html": "https://osf.io/mjasz/",
"self": "https://api.osf.io/v2/nodes/mjasz/"
},
"relationships": {
"affiliated_institutions": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/institutions/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/mjasz/relationships/institutions/",
"meta": {}
}
}
},
"children": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/children/",
"meta": {}
}
}
},
"citation": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/citation/",
"meta": {}
}
}
},
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/comments/?filter%5Btarget%5D=mjasz",
"meta": {}
}
}
},
"contributors": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/contributors/",
"meta": {}
}
}
},
"draft_registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/draft_registrations/",
"meta": {}
}
}
},
"files": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/files/",
"meta": {}
}
}
},
"forks": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/forks/",
"meta": {}
}
}
},
"identifiers": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/identifiers/",
"meta": {}
}
}
},
"linked_nodes": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/linked_nodes/",
"meta": {}
},
"self": {
"href": "https://api.osf.io/v2/nodes/mjasz/relationships/linked_nodes/",
"meta": {}
}
}
},
"logs": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/logs/",
"meta": {}
}
}
},
"node_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/node_links/",
"meta": {}
}
}
},
"preprints": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/preprints/",
"meta": {}
}
}
},
"registrations": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/registrations/",
"meta": {}
}
}
},
"root": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/",
"meta": {}
}
}
},
"template_node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/3mqkb/",
"meta": {}
}
}
},
"view_only_links": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/view_only_links/",
"meta": {}
}
}
},
"wikis": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/mjasz/wikis/",
"meta": {}
}
}
}
},
"type": "nodes"
}
],
"links": {
"first": null,
"last": null,
"meta": null,
"next": null,
"per_page": 10,
"prev": null,
"total": 3
}
}
GET
Retrieve a view only link (1)
{{baseUrl}}/view_only_links/:link_id/
QUERY PARAMS
link_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/view_only_links/:link_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/view_only_links/:link_id/")
require "http/client"
url = "{{baseUrl}}/view_only_links/:link_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/view_only_links/:link_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/view_only_links/:link_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/view_only_links/:link_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/view_only_links/:link_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/view_only_links/:link_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/view_only_links/:link_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/view_only_links/:link_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/view_only_links/:link_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/view_only_links/:link_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/view_only_links/:link_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/view_only_links/:link_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/view_only_links/:link_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/view_only_links/:link_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/view_only_links/:link_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/view_only_links/:link_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/view_only_links/:link_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/view_only_links/:link_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/view_only_links/:link_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/view_only_links/:link_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/view_only_links/:link_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/view_only_links/:link_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/view_only_links/:link_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/view_only_links/:link_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/view_only_links/:link_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/view_only_links/:link_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/view_only_links/:link_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/view_only_links/:link_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/view_only_links/:link_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/view_only_links/:link_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/view_only_links/:link_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/view_only_links/:link_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/view_only_links/:link_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/view_only_links/:link_id/
http GET {{baseUrl}}/view_only_links/:link_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/view_only_links/:link_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/view_only_links/:link_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"anonymous": false,
"date_created": "2017-03-20T20:11:01.603851",
"key": "",
"name": "Test View Only Link"
},
"id": "",
"relationships": {
"creator": {
"links": {
"related": {
"href": "http://api.osf.io/v2/users//",
"meta": {}
}
}
},
"nodes": {
"links": {
"related": {
"href": "http://api.osf.io/v2/view_only_links//nodes/",
"meta": {}
},
"self": {
"href": "http://api.osf.io/v2/view_only_links//relationships/nodes/",
"meta": {}
}
}
}
},
"type": "view-only-links"
}
}
GET
Retrieve a Wiki
{{baseUrl}}/wikis/:wiki_id/
QUERY PARAMS
wiki_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/wikis/:wiki_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/wikis/:wiki_id/")
require "http/client"
url = "{{baseUrl}}/wikis/:wiki_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/wikis/:wiki_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/wikis/:wiki_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/wikis/:wiki_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/wikis/:wiki_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/wikis/:wiki_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/wikis/:wiki_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/wikis/:wiki_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/wikis/:wiki_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/wikis/:wiki_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/wikis/:wiki_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/wikis/:wiki_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/wikis/:wiki_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/wikis/:wiki_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/wikis/:wiki_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/wikis/:wiki_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/wikis/:wiki_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/wikis/:wiki_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/wikis/:wiki_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/wikis/:wiki_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/wikis/:wiki_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/wikis/:wiki_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/wikis/:wiki_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/wikis/:wiki_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/wikis/:wiki_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/wikis/:wiki_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/wikis/:wiki_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/wikis/:wiki_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/wikis/:wiki_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/wikis/:wiki_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/wikis/:wiki_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/wikis/:wiki_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/wikis/:wiki_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/wikis/:wiki_id/
http GET {{baseUrl}}/wikis/:wiki_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/wikis/:wiki_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/wikis/:wiki_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"data": {
"attributes": {
"content_type": "text/markdown",
"current_user_can_comment": true,
"date_modified": "2017-02-16T15:45:57.671957",
"extra": {
"version": 47
},
"kind": "file",
"materialized_path": "/zveyb",
"name": "home",
"path": "/zveyb",
"size": 552
},
"id": "xu77p",
"links": {
"download": "https://api.osf.io/v2/wikis/zveyb/content/",
"info": "https://api.osf.io/v2/wikis/zveyb/",
"self": "https://api.osf.io/v2/wikis/zveyb/"
},
"relationships": {
"comments": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/tvyxz/comments/?filter%5Btarget%5D=zveyb",
"meta": {}
}
}
},
"node": {
"links": {
"related": {
"href": "https://api.osf.io/v2/nodes/tvyxz/",
"meta": {}
}
}
},
"user": {
"links": {
"related": {
"href": "https://api.osf.io/v2/users/5k3hq/",
"meta": {}
}
}
}
},
"type": "wikis"
}
}
GET
Retrieve the Content of a Wiki
{{baseUrl}}/wikis/:wiki_id/content/
QUERY PARAMS
wiki_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/wikis/:wiki_id/content/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/wikis/:wiki_id/content/")
require "http/client"
url = "{{baseUrl}}/wikis/:wiki_id/content/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/wikis/:wiki_id/content/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/wikis/:wiki_id/content/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/wikis/:wiki_id/content/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/wikis/:wiki_id/content/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/wikis/:wiki_id/content/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/wikis/:wiki_id/content/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/wikis/:wiki_id/content/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/wikis/:wiki_id/content/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/wikis/:wiki_id/content/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/wikis/:wiki_id/content/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/wikis/:wiki_id/content/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/wikis/:wiki_id/content/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/wikis/:wiki_id/content/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/wikis/:wiki_id/content/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/wikis/:wiki_id/content/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/wikis/:wiki_id/content/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/wikis/:wiki_id/content/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/wikis/:wiki_id/content/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/wikis/:wiki_id/content/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/wikis/:wiki_id/content/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/wikis/:wiki_id/content/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/wikis/:wiki_id/content/');
echo $response->getBody();
setUrl('{{baseUrl}}/wikis/:wiki_id/content/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/wikis/:wiki_id/content/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/wikis/:wiki_id/content/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/wikis/:wiki_id/content/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/wikis/:wiki_id/content/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/wikis/:wiki_id/content/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/wikis/:wiki_id/content/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/wikis/:wiki_id/content/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/wikis/:wiki_id/content/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/wikis/:wiki_id/content/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/wikis/:wiki_id/content/
http GET {{baseUrl}}/wikis/:wiki_id/content/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/wikis/:wiki_id/content/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/wikis/:wiki_id/content/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()