<commit_before># Request and Metadata Reference Guide
This reference guide lists the possibilities regarding API requests and metadata options.

### General information
API requests in Python can be done using the Python [requests](http://docs.python-requests.org/en/master/) package. The package is not part of the standard Python download and therefore needs to be [installed](A_Setup_and_install.md#Packages).

Before it can be used in your scripts and commands, it needs to be loaded:
```python
>>> import requests
```

The base URL for all API calls is `https://trng-b2share.eudat.eu/api/` with an additional URI appended (see below).

All text-based request payloads and returned responses are encoded in JSON. Therefore a JSON package that can handle these data for you are necessary. Most commonly used are the `simplejson` or `json` packages.

#### Important note

The service expects the API request to have a trailing slash ('/') at the end of the URI, but before any parameters. Your browser and the requests Python package will automatically add this character, though when using curl (see [below](#api-interaction-using-curl)) you must make sure to add it otherwise the request will fail.

### Request reference table

A request can be made using a HTTP request method, such as `GET` or `POST`.

For all requests there are optional parameters which need to be added in order to take effect. The parameter `access_token` is required for creating or modifying records and to retrieve private or community-only records. See the table in the 'Parameter variables' section for a complete overview.

For post method requests, additional non-parameter data can be sent along with the request.

Request | HTTP method | Full URI | Return value
------- | ----------- | -------- | ------------
[List all records (search)](02_List_existing_records.md#retrieve-a-list-of-records) | GET | `/api/records` | List of records
[List your draft records (search)](02_List_existing_records.md#retrieve-a-list-of-your-draft-records) * | GET | `/api/records?drafts` | List of records
[List specific record]() | GET | `/api/records/<record_id>` | A JSON-formatted string containing the record's metadata and files
[List specific draft record]() | GET | `/api/records/<record_id>/draft` | A JSON-formatted string containing the draft record's metadata and files
[List communities](03_Communities.md#list-communities) | GET | `/api/communities` | List all communities and their metadata
[List records per community](03_Communities.md#retrieve-community-specific-records) | GET | `/api/records/<community_id>` | List of records of a specific community<commit_msg>Expand table<commit_after># Request and Metadata Reference Guide
This reference guide lists the possibilities regarding API requests and metadata options.

### General information
API requests in Python can be done using the Python [requests](http://docs.python-requests.org/en/master/) package. The package is not part of the standard Python download and therefore needs to be [installed](A_Setup_and_install.md#Packages).

Before it can be used in your scripts and commands, it needs to be loaded:
```python
>>> import requests
```

The base URL for all API calls is `https://trng-b2share.eudat.eu/api/` with an additional URI appended (see below).

All text-based request payloads and returned responses are encoded in JSON. Therefore a JSON package that can handle these data for you are necessary. Most commonly used are the `simplejson` or `json` packages.

#### Important note

The service expects the API request to have a trailing slash ('/') at the end of the URI, but before any parameters. Your browser and the requests Python package will automatically add this character, though when using curl (see [below](#api-interaction-using-curl)) you must make sure to add it otherwise the request will fail.

### Request reference table

A request can be made using a HTTP request method, such as `GET` or `POST`.

For all requests there are optional parameters which need to be added in order to take effect. The parameter `access_token` is required for creating or modifying records and to retrieve private or community-only records. See the table in the 'Parameter variables' section for a complete overview.

For post method requests, additional non-parameter data can be sent along with the request.

Request | HTTP method | Full URI | Return value
------- | ----------- | -------- | ------------
[List all records (search)](02_List_existing_records.md#retrieve-a-list-of-records) | GET | `/api/records` | List of records
[List your draft records (search)](02_List_existing_records.md#retrieve-a-list-of-your-draft-records) * | GET | `/api/records?drafts` | List of records
[List specific record](01_Retrieve_existing_record.md#get-details-of-a-specific-record) | GET | `/api/records/<record_id>` | A JSON-formatted string containing the record's metadata and files
[List specific draft record](01_Retrieve_existing_record.md#get-details-of-a-specific-record) | GET | `/api/records/<record_id>/draft` | A JSON-formatted string containing the draft record's metadata and files
[Download file from record](01_Retrieve_existing_record.md#downloading-files-from-a-record) | GET | `/api/records/<record_id>/draft` | A JSON-formatted string containing the draft record's metadata and files
[List communities](03_Communities.md#list-communities) | GET | `/api/communities` | List all communities and their metadata
[List records per community](03_Communities.md#retrieve-community-specific-records) | GET | `/api/records/<community_id>` | List of records of a specific community
{'fraction_non_alphanumeric': 0.0974960042621204, 'fraction_numerical': 0.004262120404901438, 'mean_word_length': 4.603980099502488, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 16, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1681449', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1419, 'n_words': 666}