Integration

Code Examples

Purpose

The Code Examples repostory contains sample code for various languages that show how to invoke the API endpoints using either Basic or OAuth credentials.

Currently Available Language Examples

LanguageExamplesNotes
C#https://github.com/intelligent-api/examples/tree/main/csharpImplementation without addition of any nuget packages
cURLhttps://github.com/intelligent-api/examples/tree/main/cURL
Gohttps://github.com/intelligent-api/examples/tree/main/golang
Javahttps://github.com/intelligent-api/examples/tree/main/javaImplementation without addition of any dependencies
Node.jshttps://github.com/intelligent-api/examples/tree/main/nodejs
Pythonhttps://github.com/intelligent-api/examples/tree/main/pythonImplementation using standard http.client
Rubyhttps://github.com/intelligent-api/examples/tree/main/ruby
Rusthttps://github.com/intelligent-api/examples/tree/main/rustImplementation using base64, reqwest, serde, tokio packages

How to use

Download Files / Clone Repo

To start you first either need to clone the Code Examples repository from Github or download the files locally.

For more information see either:

  • Cloning a repository
  • Downloading files from GitHub

Before executing the code

  1. To begin ensure you have signed up at https://dash.intelligent-api.com and have generated at least one set of credentials (either OAuth Authentication or Basic Authentication).
  2. Select your chosen programming language and open the relevant folder with the code examples.
  3. For each endpoint there is a folder with specific code to show how to invoke the endpoint using either Basic or OAuth (token) authentication.
  4. Before attempting to execute the code, follow the instructions in the README.md in the respective root folder of the chosen programming language, ensuring you have the pre-requisites installed and have replaced the relevant [[variable]] placeholders.

Variables to be replaced

Within the code files the following placeholder variables need to be replaced before testing the various endpoints:

Variable NameVariable PlaceholderDescription
Client Id[[client_id]]The client id for the set of credentials being used. This is sourced from the OAuth Credentials dashboard or Basic Credentials dashboard
Client Secret[[client_secret]]The client secret for the set of credentials being used. This is sourced from the OAuth Credentials dashboard or Basic Credentials dashboard
Scopes[[scopes]]When using OAuth (token) authentication, the initial call to the token endpoint will require the caller to specify what scopes to grant the token being generated access to. You can specify all the scopes available and re-use the same token for all the endpoints, or you can create a token specifically for the endpoint being called. For more information on Scopes please see Scopes
Body of Text[[text_body]]When working with endpoints the work with text, a body of text will need to be supplied in certain instances.
Source Language[[source_language]]For endpoints that work with text the source language of the text will need to be supplied in certain instances, if the source language is unkown it is advisable to invoke the detect language endpoint and retrieving the source language before calling the respective endpoint.
Target Language[[target_language]]For endpoints that work with text the target language for the output of the endpoint will need to be supplied in certain instances.
Minimum Score[[minimum_score]]For the redact pii endpoint this minimum score is optional as it indicates the threshold for which possibly detected PII should be replaced. For example if the minimum score specified is 0.75 and a word scores 0.70 as the possibility for being PII, it will not be replaced but anything with a score higher than 0.75 will
File Name Full Path[[filepath]]When working with endpoints that require file binary data the full path to the respective file path will need to be supplied.
Content Type[[content_type]]Specifically for the cURL endpoints where the content type can not be calculated this variable will need to be replaced manually when working with endpoints that require file binary data.
URL[[url]]When calling either of the scraper endpoints, this will be the URL of the webpage that is to be scraped or summarized.