Manage an Open Journal Systems journal from .NET. The library covers:
- submissions, reviews, issues and users;
- DOIs, statistics and the rest of the OJS 3.5 REST API.
You get typed models and async calls, without wrestling with PHP's JSON. It is written in VB.NET and works the same from C#, F# and PowerShell.
dotnet add package Ojs.Api.Client --prerelease
You need an API token from User Profile > API Key in OJS. The server must have api_key_secret set in the
[security] section of its config.inc.php.
VB.NET
Imports OJS3_5.Library
Using ojs As New OjsClient(New OjsClientOptions With {
.BaseUrl = "https://journals.example.com",
.JournalPath = "jpk",
.ApiToken = Environment.GetEnvironmentVariable("OJS_TOKEN")})
Dim current = Await ojs.Issues.GetCurrentAsync()
Console.WriteLine(current.Identification)
For Each article In current.Articles
Console.WriteLine(" " & article.CurrentPublication?.Title.GetValue("en"))
Next
End UsingC#
using OJS3_5.Library;
using var ojs = new OjsClient(new OjsClientOptions
{
BaseUrl = "https://journals.example.com",
JournalPath = "jpk",
ApiToken = Environment.GetEnvironmentVariable("OJS_TOKEN")
});
var current = await ojs.Issues.GetCurrentAsync();
Console.WriteLine(current.Identification);
foreach (var article in current.Articles)
Console.WriteLine(" " + article.CurrentPublication?.Title.GetValue("en"));F#
open OJS3_5.Library
task {
use ojs =
new OjsClient(OjsClientOptions(
BaseUrl = "https://journals.example.com",
JournalPath = "jpk",
ApiToken = Environment.GetEnvironmentVariable "OJS_TOKEN"))
let! current = ojs.Issues.GetCurrentAsync()
printfn "%s" current.Identification
}Two settings depend on the installation:
index.phpin URLs. If the journal's URLs contain it (https://example.com/index.php/jpk), setUseIndexPhp = True.- Types. All types live in the
OJS3_5.Librarynamespace and its sub-namespaces, such asModelsandQueries.
The OJS backend is PHP, and its JSON shows it:
- numbers and booleans arrive as strings, dates as
"Y-m-d H:i:s"; []stands in for an empty object;- several responses differ from the OpenAPI document.
The library reads every value against the model it is bound to, so you work with Integer?, DateTime?,
WorkflowStage and LocalizedString instead. Each deviation we found on live journals is handled and listed on
OJS 3.5 Quirks.
' One page
Dim page = Await ojs.Submissions.ListAsync(
New SubmissionQuery With {.Status = {SubmissionStatus.Published}, .Count = 50})
Console.WriteLine($"{page.Items.Count} of {page.ItemsMax}")
' Every page
Dim all = Await ojs.Submissions.ListAllAsync(New SubmissionQuery With {.StageIds = {WorkflowStage.ExternalReview}})// Stream page by page; later pages are fetched only when needed
await foreach (var issue in ojs.Issues.Enumerate(new IssueQuery { IsPublished = true }))
Console.WriteLine(issue.Identification);Dim pub = Await ojs.Publications.GetAsync(12, 15)
Console.WriteLine(pub.Title.GetValue("id", fallbackLocale:="en"))
Console.WriteLine(String.Join(", ", pub.Keywords.GetNames("en")))
' Only the properties you set are sent; everything else stays as it is.
Await ojs.Publications.UpdateAsync(12, 15, New PublicationEdit With {
.Title = New LocalizedString From {{"en", "A better title"}, {"id", "Judul yang lebih baik"}},
.Keywords = LocalizedVocab.Create("en", "open access", "scholarly publishing")})' Images and other settings files: upload, then reference
Dim tmp = Await ojs.TemporaryFiles.UploadAsync("cover.jpg")
Await ojs.Publications.UpdateAsync(12, 15, New PublicationEdit With {
.CoverImage = New Dictionary(Of String, CoverImage) From {{"en", New CoverImage With {.TemporaryFileId = tmp.Id}}}})
' Submission files
Using pdf = File.OpenRead("manuscript.pdf")
Await ojs.SubmissionFiles.UploadAsync(12, pdf, "manuscript.pdf",
New SubmissionFileEdit With {.FileStage = SubmissionFileStage.Submission, .GenreId = 1})
End Usingtry
{
await ojs.Submissions.SubmitAsync(12, confirmCopyright: true);
}
catch (OjsValidationException ex)
{
foreach (var (field, messages) in ex.Errors)
Console.WriteLine($"{field}: {string.Join(" ", messages)}");
}
catch (OjsApiException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
{
Console.WriteLine("No such submission.");
}Await ojs.Dois.Submissions.AssignAsync({12, 13})
Using xml = Await ojs.Dois.Submissions.ExportAndDownloadAsync({12, 13})
Await xml.SaveAsAsync(xml.FileName)
End Using
Dim top = Await ojs.Stats.Publications.ListAsync(
New PublicationStatsQuery With {.DateStart = New DateOnly(2026, 1, 1), .Count = 10})
Dim csv = Await ojs.Stats.Publications.ListCountriesCsvAsync()For Each journal In Await ojs.Contexts.ListAllAsync()
Dim client = ojs.ForJournal(journal.UrlPath) ' shares the connection
Console.WriteLine($"{journal.Name.GetValue("en")}: {(Await client.Submissions.ListAsync()).ItemsMax} submissions")
NextOjsClient property |
Endpoints |
|---|---|
Submissions, Publications, Contributors, SubmissionFiles, Decisions, ReviewerSuggestions |
the editorial workflow |
Issues, Sections |
journal structure |
Users, Invitations |
accounts, roles and reviewers |
Contexts, Site |
journals, site settings and themes |
Announcements, Institutions |
news, and institutions for statistics |
EmailTemplates, Mailables, Emails |
emails |
Dois, Reviews, Orcid |
DOIs, review exports and ORCID |
Stats |
editorial, user and usage statistics, as JSON or CSV |
Vocabs, Rors |
keyword suggestions and the Research Organization Registry |
TemporaryFiles |
uploads referenced by other requests |
SendAsync |
raw access to any endpoint, including plugin APIs |
- Wiki: one page per area, with examples in VB.NET, C# and F#.
- IntelliSense: every public member has a summary and an example.
- Sample app: a small command-line tool with
issues,submission <id>,stats,export-doisand more.
dotnet build OJS3_5.slnx
dotnet test OJS3_5.slnx
- Unit tests need no server.
- Live tests run against a real journal when you set the
OJS_*environment variables. - Tests that change data also need
OJS_ALLOW_WRITES=1. Run those against a test journal only. See Testing and Contributing. - Documentation examples:
pwsh tools/doc-check/check.ps1compiles every one of them, in VB.NET, C# and F#.
- OJS 3.5.x, tested against OJS 3.5.0.
- .NET 10 or later.