Main content
Examples
Menu
Examples
File upload
Once you have an upload URL from a folder endpoint, you can upload a text file like this using curl:
curl -X "PUT" "https://test-files.osf.io/v1/resources/<guid>/providers/osfstorage/?name=sample.txt" \
-H "Authorization: Basic Thisisnotarealauthtoken" \
-H "Content-Type: text/plain" \
-d "This is a text file"
Change your authorization to the appropriate method for your application, replace the URL with a real URL and the auth token with a real auth token.
Token auth
To us a Personal Access Token, make an Authorization
header with the contents Bearer thisisnotarealtoken
. In the curl example above, that would be:
curl -X "PUT" "https://test-files.osf.io/v1/resources/<guid>/providers/osfstorage/?name=sample.txt" \
-H "Authorization: Bearer Thisisnotarealauthtoken" \
-H "Content-Type: text/plain" \
-d "This is a text file"
To make a Personal Access Token, go to the relevant OSF settings page and create one. You can limit the scope of the token, but remember that it has access to all of the information that you do within the limits of the scope, so be careful with your tokens.
Complex node and file counts
I had to make a script to count how many nodes were tagged with certain tags, and then count how many of those nodes had more than one file stored in their OSF Storage provider. It takes some shortcuts on the counting (it doesn't check for folders vs files and it certainly doesn't go into hierarchy), but it's a good example of pulling things out of pagination and doing requests based on related views.
It also has some code in it to handle throttled responses properly.
Page permissions have changed
Your browser should refresh shortly…
Renaming wiki...
Wiki page deleted
Press Confirm to return to the project wiki home page.
Connected to the collaborative wiki
This page is currently connected to the collaborative wiki. All edits made will be visible to contributors with write permission in real time. Changes will be stored but not published until you click the "Save" button.
Connecting to the collaborative wiki
This page is currently attempting to connect to the collaborative wiki. You may continue to make edits. Changes will not be saved until you press the "Save" button.
Collaborative wiki is unavailable
The collaborative wiki is currently unavailable. You may continue to make edits. Changes will not be saved until you press the "Save" button.
Browser unsupported
Your browser does not support collaborative editing. You may continue to make edits. Changes will not be saved until you press the "Save" button.

Start managing your projects on the OSF today.
Free and easy to use, the Open Science Framework supports the entire research lifecycle: planning, execution, reporting, archiving, and discovery.
Copyright © 2011-2025
Center for Open Science
|
Terms of Use
|
Privacy Policy
|
Status
|
API
TOP Guidelines
|
Reproducibility Project: Psychology
|
Reproducibility Project: Cancer Biology