GET STARTED
SDKs
The official SDKs wrap the public /v1 API with the same methods, errors and retry rules in every language. Each one reads the key from OUSHODH_API_KEY when you pass none.
INSTALL TODAYEvery SDK installs from its registry: Packagist, npm, PyPI, Go modules, crates.io, Maven Central, NuGet, RubyGems and pub.dev.
Install and first call
InstallTerminal
composer require oushodh/oushodh-php
First callPHP
use Oushodh\Client;
$oushodh = new Client(); // reads OUSHODH_API_KEY
$result = $oushodh->search('paracetamol', limit: 5);
$medicine = $oushodh->getMedicine('MED-012933');InstallTerminal
npm install @oushodh/sdk
First callJavaScript / TypeScript
import { Oushodh } from "@oushodh/sdk";
const oushodh = new Oushodh(); // reads OUSHODH_API_KEY
const result = await oushodh.search("paracetamol", { limit: 5 });
const medicine = await oushodh.getMedicine("MED-012933");InstallTerminal
pip install oushodh
First callPython
from oushodh import Oushodh
client = Oushodh() # reads OUSHODH_API_KEY
result = client.search("paracetamol", limit=5)
medicine = client.get_medicine("MED-012933")InstallTerminal
go get github.com/oushodh/oushodh-go
First callGo
ctx := context.Background() client, err := oushodh.NewClient() // reads OUSHODH_API_KEY result, err := client.Search(ctx, "paracetamol", 5) medicine, err := client.GetMedicine(ctx, "MED-012933")
InstallCargo.toml
oushodh = "0.1"
First callRust
use oushodh::Client;
let client = Client::from_env()?; // reads OUSHODH_API_KEY
let result = client.search("paracetamol", Some(5)).await?;
let medicine = client.get_medicine("MED-012933").await?;Installbuild.gradle.kts
implementation("dev.oushodh:oushodh:0.1.0")First callJava / Kotlin
Oushodh client = Oushodh.builder().apiKey("oush_...").build(); // or set OUSHODH_API_KEY and leave out apiKey
Meta meta = client.meta();
SearchResult result = client.search("napa 500", 5);
MedicineDetail detail = client.getMedicine("MED-012933");InstallTerminal
dotnet add package Oushodh
First callC# / .NET
using var client = new OushodhClient("oush_..."); // or set OUSHODH_API_KEY and call new OushodhClient()
var meta = await client.GetMetaAsync(); // check that the key works
var result = await client.SearchAsync("napa 500", limit: 5);
var detail = await client.GetMedicineAsync("MED-012933");InstallGemfile
gem "oushodh", "~> 0.1"
First callRuby
require "oushodh"
client = Oushodh::Client.new # reads OUSHODH_API_KEY
result = client.search("napa 500", limit: 5)
detail = client.get_medicine("MED-012933")InstallTerminal
dart pub add oushodh
First callDart / Flutter
import 'package:oushodh/oushodh.dart';
final oushodh = Oushodh(apiKey: 'oush_...');
final napa = await oushodh.getMedicine('MED-012933');
print('${napa.productName} ${napa.prices.unit?.amount}');Languages
Nine languages, one repository each.
- PHPgithub.com/oushodh/oushodh-phpPackagist: oushodh/oushodh-php
- JavaScript / TypeScriptgithub.com/oushodh/oushodh-jsnpm: @oushodh/sdk
- Pythongithub.com/oushodh/oushodh-pythonPyPI: oushodh
- Gogithub.com/oushodh/oushodh-goGo modules: github.com/oushodh/oushodh-go
- Rustgithub.com/oushodh/oushodh-rustcrates.io: oushodh
- Java / Kotlingithub.com/oushodh/oushodh-javaMaven Central: dev.oushodh:oushodh
- C# / .NETgithub.com/oushodh/oushodh-dotnetNuGet: Oushodh
- Rubygithub.com/oushodh/oushodh-rubyRubyGems: oushodh
- Dart / Fluttergithub.com/oushodh/oushodh-dartpub.dev: oushodh
Methods in every SDK
Each SDK has the same methods. Their names follow each language's style, such as listMedicines in PHP and JavaScript and list_medicines in Python, Rust and Ruby.
- Meta
GET /v1/metaYour account and the number of medicines your plan reads. Call it to check that a key works. - List medicines
GET /v1/medicinesOne page, with cursor paging: passnextback ascursorfor the next page. - List all
GET /v1/medicines, every pagePages for you and gives the medicines one by one. - Search
GET /v1/medicines/searchThe best matches for a person typing a name. - Get a medicine
GET /v1/medicines/{ref}One medicine by any ID, an old ID or its UUID. - Image URL, get image
GET /v1/images/{file}The picture's address, or its bytes.
Errors and retries
Each SDK raises one exception for each HTTP family. Match on the exception or on its error code, not on the message: the message is for people and may change.
An SDK retries only these:
429 rate_limitedIt waits the seconds in theRetry-Afterheader, then tries again.5xxA fault on our side.- Network errorsNo answer came back.
A 429 quota_exceeded is raised at once, with no retry.