---
# System prepended metadata

title: aries-cloudagent-python admin API consistification

---

# aries-cloudagent-python admin API consistification

> This is a collaborative document

In the admin API, the response format is inconsistent.


Here are some examples of the current response format:

## Connections

### /connections/create-invitation

`curl -X POST "http://localhost:5000/connections/create-invitation" -H  "accept: application/json"`

```json
{
  "connection_id": "a103460b-0f68-4969-92a0-47330ee885ce",
  "invitation": {
    "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation",
    "@id": "61f0c4f9-90a5-46dd-a704-bb9974e9a5d6",
    "serviceEndpoint": "http://localhost:8000",
    "label": "Aries Cloud Agent",
    "recipientKeys": [
      "BBammzzceLHtaySmPTYmvRTPiknKgJWE8bXSjFdP7UE6"
    ]
  },
  "invitation_url": "http://localhost:8000?c_i=eyJAdHlwZSI6ICJkaWQ6c292OkJ6Q2JzTlloTXJqSGlxWkRUVUFTSGc7c3BlYy9jb25uZWN0aW9ucy8xLjAvaW52aXRhdGlvbiIsICJAaWQiOiAiNjFmMGM0ZjktOTBhNS00NmRkLWE3MDQtYmI5OTc0ZTlhNWQ2IiwgInNlcnZpY2VFbmRwb2ludCI6ICJodHRwOi8vbG9jYWxob3N0OjgwMDAiLCAibGFiZWwiOiAiQXJpZXMgQ2xvdWQgQWdlbnQiLCAicmVjaXBpZW50S2V5cyI6IFsiQkJhbW16emNlTEh0YXlTbVBUWW12UlRQaWtuS2dKV0U4YlhTakZkUDdVRTYiXX0="
}
```


### /connections/receive-invitation

`curl -X POST "http://localhost:5000/connections/receive-invitation" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{    \"@type\": \"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation\",    \"@id\": \"61f0c4f9-90a5-46dd-a704-bb9974e9a5d6\",    \"serviceEndpoint\": \"http://localhost:8000\",    \"label\": \"Aries Cloud Agent\",    \"recipientKeys\": [      \"BBammzzceLHtaySmPTYmvRTPiknKgJWE8bXSjFdP7UE6\"    ]  }"`


```json
{
  "updated_at": "2020-05-21 18:23:15.689367Z",
  "state": "invitation",
  "created_at": "2020-05-21 18:23:15.689367Z",
  "connection_id": "e6bc91f4-64d3-4bf4-9f3e-88d3dc3100d7",
  "routing_state": "none",
  "accept": "manual",
  "initiator": "external",
  "invitation_mode": "once",
  "invitation_key": "BBammzzceLHtaySmPTYmvRTPiknKgJWE8bXSjFdP7UE6",
  "their_label": "Aries Cloud Agent"
}
```

## Schemas

### /schemas

`curl -X POST "http://localhost:5000/schemas" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"attributes\": [    \"score\"  ],  \"schema_version\": \"1.0\",  \"schema_name\": \"prefs\"}"`

```json
{
  "schema_id": "7cfCiDw3nUy8S8nC4M76En:2:prefs:1.0",
  "schema": {
    "ver": "1.0",
    "id": "7cfCiDw3nUy8S8nC4M76En:2:prefs:1.0",
    "name": "prefs",
    "version": "1.0",
    "attrNames": [
      "score"
    ],
    "seqNo": 20775
  }
}
```

## Credential Definition

### /credential-definitions

`curl -X POST "http://localhost:5000/credential-definitions" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"schema_id\": \"7cfCiDw3nUy8S8nC4M76En:2:prefs:1.0\",  \"support_revocation\": false,  \"tag\": \"default\"}"`

```json
{
  "credential_definition_id": "7cfCiDw3nUy8S8nC4M76En:3:CL:20775:default"
}
```

---


As you can see, response formats vary across all of our admin endpoints. We should create a consistent response format for all endpoints.

Some ideas:


```json
{
    "type": "connection", // the type of the model. Matches webhook topic?
    "id": 123 // Pull out relevant id from model?
    "created_at": "iso8601datestring",
    "updated_at": "iso8601datestring",
    "record": {} // serialized internal model
}
```

Any other metadata we can include?

What about list results?

```json
{
    "index": 0,
    "count": 10,
    "next": "/path/to/next",
    "records": [] // Same data structure as single item above?
}
```

We could add pagination too all endpoints in a consistent manner.