Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The API Explorer is a convenient and powerful tool for browsing read-only CommCare APIs. The tool seamlessly integrates with the user's CommCare account using OAuth 2.0 authentication, alleviating any concerns regarding authentication management.

This is especially useful for users who are interested in learning what data points are included in CommCare API requests without setting up a testing environment and associated overheads.

This tool allows users to see outputs for the following APIs:

For using the tool, navigate to https://commcare-api-explorer.dimagi.com/ and click to authorise CommCare. https://www.loom.com/share/1a61fd132dc946518bc6ee698aadaf2c - a quick video showcasing the feature.

Click on Authorize.

Once signed in, select a domain from the dropdown or type it in. Then select the API and click on Request API.

Here’s an example of what an API Request for List Cases would look like.

a1.png
 List Cases: Sample Output

API Output Sample

{
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 7
  },
  "objects": [
    {
      "case_id": "6bf7acb1-b052-4dec-8815-c5d070c0cd51",
      "closed": false,
      "closed_by": null,
      "date_closed": null,
      "date_modified": "2024-04-11T15:56:41.665000Z",
      "domain": "rr-api-testing-space",
      "id": "6bf7acb1-b052-4dec-8815-c5d070c0cd51",
      "indexed_on": "2024-04-11T15:56:48.315020Z",
      "indices": {},
      "opened_by": "debf49b5bb904ca7b2d3bebe9d84f420",
      "properties": {
        "case_name": "Test Case 1",
        "case_type": "case",
        "date_opened": "2024-04-11T15:56:41.665000Z",
        "external_id": null,
        "owner_id": "debf49b5bb904ca7b2d3bebe9d84f420"
      },
      "resource_uri": "",
      "server_date_modified": "2024-04-11T15:56:41.799459Z",
      "server_date_opened": "2024-04-11T15:56:41.799459Z",
      "user_id": "debf49b5bb904ca7b2d3bebe9d84f420",
      "xform_ids": [
        "3f3c3782-f72e-4ba5-a21d-c351aa9c9719"
      ]
    },

Summary

Meta Data

  • Limit: Indicates the maximum number of objects that can be returned in a single response. In this case, it's set to 20.

  • Next: Provides a link to the next page of results. Since it's set to null, there are no more pages of results.

  • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

  • Previous: Provides a link to the previous page of results. Since it's set to null, there are no previous pages.

  • Total Count: Represents the total number of objects in the collection. In this case, it's 7.

Case Information:

  • ID: 6bf7acb1-b052-4dec-8815-c5d070c0cd51

  • Name: Test Case 1

  • Type: case

  • Domain: rr-api-testing-space

  • Opened By User ID: debf49b5bb904ca7b2d3bebe9d84f420

  • Date Opened: April 11, 2024, at 15:56:41 UTC

  • Date Modified: April 11, 2024, at 15:56:41 UTC

  • Closed Status: Not closed

  • Server Date Modified: April 11, 2024, at 15:56:41 UTC

  • Server Date Opened: April 11, 2024, at 15:56:41 UTC

  • User ID: debf49b5bb904ca7b2d3bebe9d84f420

  • Additional Information:

    • Indexed On: April 11, 2024, at 15:56:48 UTC

    • XForm IDs: ["3f3c3782-f72e-4ba5-a21d-c351aa9c9719"]

 List Forms: Sample Output

API Output Sample

{
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 10
  },
  "objects": [
    {
      "app_id": "452a9a647ee8f364b1aed887c5a56a4c",
      "archived": false,
      "attachments": {
        "form.xml": {
          "content_type": "text/xml",
          "length": 1173,
          "url": "https://www.commcarehq.org/a/rr-api-testing-space/api/form/attachment/4e81d6bc-2abc-4a52-8a8a-003881f6f64a/form.xml"
        }
      },
      "build_id": null,
      "domain": "rr-api-testing-space",
      "edited_by_user_id": null,
      "edited_on": "2024-05-22T13:05:12.210675Z",
      "form": {
        "#type": "data",
        "@name": "Registration Form",
        "@uiVersion": "1",
        "@version": "26",
        "@xmlns": "http://openrosa.org/formdesigner/29856D0E-305D-418A-8F6E-41663E4BD30D",
        "age": "99",
        "case": {
          "@case_id": "b159e964-30ef-4cf4-aa68-a906554dca2a",
          "@date_modified": "2024-05-22T09:41:43.317000Z",
          "@user_id": "debf49b5bb904ca7b2d3bebe9d84f420",
          "@xmlns": "http://commcarehq.org/case/transaction/v2",
          "create": {
            "case_name": "Data Forwarding Test with Power Automate",
            "case_type": "case",
            "owner_id": "452a9a647ee8f364b1aed887c5aab210"
          },

Summary

  • Meta Data:

    • Limit: The maximum number of objects that can be returned in a single response is set to 20.

    • Next: Points to the next page of results. Since it's set to null, there are no more pages.

    • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

    • Previous: Points to the previous page of results. Since it's set to null, there are no previous pages.

    • Total Count: Indicates that there are a total of 10 objects in the collection.

  • Objects:

    • App ID: Identifies the application associated with the form, here it's "452a9a647ee8f364b1aed887c5a56a4c".

    • Archived: Indicates whether the form is archived or not, set to false.

    • Attachments: Contains attachments associated with the form, here it's a form.xml file with a URL to access it.

    • Build ID: Represents the build ID of the form.

    • Domain: Indicates the domain to which the form belongs, here it's "rr-api-testing-space".

    • Edited By User ID: Represents the user who last edited the form.

    • Edited On: Specifies the timestamp when the form was last edited, set to "2024-05-22T13:05:12.210675Z".

    • Form: Contains details about the form itself:

      • Type: Specifies the type of form data, set to "data".

      • Name: Indicates the name of the form, here it's "Registration Form".

      • UI Version: Specifies the UI version of the form, set to "1".

      • Version: Indicates the version of the form, set to "26".

      • XML Namespace: Specifies the XML namespace of the form.

      • Age: An example field within the form.

    • Case: Contains information about the associated case:

      • Case ID: Identifies the case associated with the form.

      • Date Modified: Specifies the timestamp when the associated case was last modified.

      • User ID: Indicates the user ID associated with the modification of the case.

      • XML Namespace: Specifies the XML namespace of the case transaction.

      • Create: Contains details about the creation of the associated case, including the case name, case type, and owner ID.

 List Mobile Workers: Sample Output

API Output Sample

{
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 2
  },
  "objects": [
    {
      "default_phone_number": null,
      "email": "",
      "eulas": "[]",
      "first_name": "",
      "groups": [
        "452a9a647ee8f364b1aed887c5aab210"
      ],
      "id": "debf49b5bb904ca7b2d3bebe9d84f420",
      "last_name": "",
      "phone_numbers": [],
      "resource_uri": "/a/rr-api-testing-space/api/v0.5/user/debf49b5bb904ca7b2d3bebe9d84f420/",
      "user_data": {
        "commcare_profile": "",
        "commcare_project": "rr-api-testing-space",
        "role": "dc"
      },
      "username": "user1@rr-api-testing-space.commcarehq.org"
    },

Summary

  • Meta Data:

    • Limit: The maximum number of objects that can be returned in a single response is set to 20.

    • Next: Points to the next page of results. Since it's set to null, there are no more pages.

    • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

    • Previous: Points to the previous page of results. Since it's set to null, there are no previous pages.

    • Total Count: Indicates that there are a total of 2 objects in the collection.

  • Objects:

    • Default Phone Number: The default phone number associated with the user, currently set to null.

    • Email: The email address of the user, currently an empty string.

    • Eulas: A list of end-user license agreements, currently an empty list.

    • First Name: The first name of the user, currently an empty string.

    • Groups: A list of group IDs to which the user belongs. Here, it contains one group ID: "452a9a647ee8f364b1aed887c5aab210".

    • ID: The unique identifier of the user, set to "debf49b5bb904ca7b2d3bebe9d84f420".

    • Last Name: The last name of the user, currently an empty string.

    • Phone Numbers: A list of phone numbers associated with the user, currently an empty list.

    • Resource URI: A URI pointing to the user's resource.

    • User Data: Additional data associated with the user:

      • CommCare Profile: Currently empty.

      • CommCare Project: Specifies the CommCare project the user belongs to, set to "rr-api-testing-space".

      • Role: Specifies the role of the user, set to "dc".

    • Username: The username of the user, set to "user1@rr-api-testing-space.commcarehq.org".

 List Web Users: Sample Output

API Output Sample

{
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 2
  },
  "objects": [
    {
      "default_phone_number": null,
      "email": "rrath@dimagi.com",
      "eulas": "[LicenseAgreement(date=datetime.datetime(2015, 4, 23, 5, 40, 4), doc_type='LicenseAgreement', signed=True, type='End User License Agreement', user_id=None, user_ip='180.151.226.170', version='2.0'), LicenseAgreement(date=datetime.datetime(2020, 1, 23, 5, 43, 33, 268291), doc_type='LicenseAgreement', signed=True, type='End User License Agreement', user_id=None, user_ip='180.151.231.114', version='3.0')]",
      "first_name": "Rishabh",
      "id": "94162daf38b4793ecad08c4f204512cd",
      "is_admin": true,
      "last_name": "Rath",
      "permissions": {
        "access_all_locations": true,
        "access_api": true,
        "access_default_login_as_user": true,
        "access_mobile_endpoints": true,
        "access_release_management": true,
        "access_web_apps": true,
        "commcare_analytics_roles": true,
        "commcare_analytics_roles_list": [],
        "doc_type": "HqPermissions",
        "download_reports": true,
        "edit_apps": true,
        "edit_billing": true,
        "edit_commcare_analytics": true,
        "edit_commcare_users": true,
        "edit_data": true,
        "edit_data_dict": true,
        "edit_file_dropzone": true,
        "edit_groups": true,
        "edit_linked_configurations": true,
        "edit_locations": true,
        "edit_messaging": true,
        "edit_motech": true,
        "edit_reports": true,
        "edit_shared_exports": true,
        "edit_ucrs": true,
        "edit_user_tableau_config": true,
        "edit_users_in_groups": true,
        "edit_users_in_locations": true,
        "edit_web_users": true,
        "limited_login_as": true,
        "login_as_all_users": true,
        "manage_attendance_tracking": true,
        "manage_data_registry": true,
        "manage_data_registry_list": [],
        "manage_domain_alerts": true,
        "report_an_issue": true,
        "view_apps": true,
        "view_commcare_analytics": true,
        "view_commcare_users": true,
        "view_data_dict": true,
        "view_data_registry_contents": true,
        "view_data_registry_contents_list": [],
        "view_file_dropzone": true,
        "view_groups": true,
        "view_locations": true,
        "view_report_list": [],
        "view_reports": true,
        "view_roles": true,
        "view_tableau": true,
        "view_tableau_list": [],
        "view_user_tableau_config": true,
        "view_web_users": true,
        "web_apps_list": []
      },
      "phone_numbers": [],
      "resource_uri": "/a/rr-api-testing-space/api/v0.5/web-user/94162daf38b4793ecad08c4f204512cd/",
      "role": "Admin",
      "username": "rrath@dimagi.com"
    },

Summary

  • Meta Data:

    • Limit: The maximum number of objects that can be returned in a single response is set to 20.

    • Next: Points to the next page of results. Since it's set to null, there are no more pages.

    • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

    • Previous: Points to the previous page of results. Since it's set to null, there are no previous pages.

    • Total Count: Indicates that there are a total of 2 objects in the collection.

  • Objects:

    • Default Phone Number: The default phone number associated with the user, currently set to null.

    • Email: The email address of the user, set to "rrath@dimagi.com".

    • Eulas: A list of end-user license agreements. Each agreement contains information such as the date, type, whether it's signed, user ID, user IP, and version.

    • First Name: The first name of the user, set to "Rishabh".

    • ID: The unique identifier of the user, set to "94162daf38b4793ecad08c4f204512cd".

    • Is Admin: Indicates whether the user is an admin, set to true.

    • Last Name: The last name of the user, set to "Rath".

    • Permissions: Contains a variety of permissions granted to the user, such as access to locations, API, mobile endpoints, release management, web apps, analytics, reports, and more.

    • Phone Numbers: A list of phone numbers associated with the user, currently an empty list.

    • Resource URI: A URI pointing to the user's resource.

    • Role: Specifies the role of the user, set to "Admin".

    • Username: The username of the user, set to "rrath@dimagi.com".

 List Applications: Sample Output

API Output Sample

{
  "meta": {
    "limit": null,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 1
  },
  "objects": [
    {
      "build_comment": null,
      "built_from_app_id": null,
      "built_on": null,
      "id": "452a9a647ee8f364b1aed887c5a56a4c",
      "is_released": false,
      "modules": [
        {
          "case_properties": [
            "age",
            "followup",
            "name",
            "sex"
          ],
          "case_type": "case",
          "forms": [
            {
              "name": {
                "en": "Registration Form"
              },
              "questions": [
                {
                  "comment": null,
                  "constraint": null,
                  "group": null,
                  "hashtagValue": "#form/name",
                  "is_group": false,
                  "label": "Name",
                  "label_ref": "name-label",
                  "relevant": null,
                  "repeat": null,
                  "required": false,
                  "setvalue": null,
                  "tag": "input",
                  "translations": {
                    "en": "Name"
                  },
                  "type": "Text",
                  "value": "/data/name"
                },
                {
                  "comment": null,
                  "constraint": null,
                  "group": null,
                  "hashtagValue": "#form/sex",
                  "is_group": false,
                  "label": "Sex",
                  "label_ref": "sex-label",
                  "options": [
                    {
                      "label": "Male",
                      "label_ref": "sex-male-label",
                      "translations": {
                        "en": "Male"
                      },
                      "value": "male"
                    },
                    {
                      "label": "Female",
                      "label_ref": "sex-female-label",
                      "translations": {
                        "en": "Female"
                      },
                      "value": "female"
                    }
                  ],
                  "relevant": null,
                  "repeat": null,
                  "required": false,
                  "setvalue": null,
                  "tag": "select1",
                  "translations": {
                    "en": "Sex"
                  },
                  "type": "Select",
                  "value": "/data/sex"
                },
                {
                  "comment": null,
                  "constraint": null,
                  "group": null,
                  "hashtagValue": "#form/age",
                  "is_group": false,
                  "label": "Age",
                  "label_ref": "age-label",
                  "relevant": null,
                  "repeat": null,
                  "required": false,
                  "setvalue": null,
                  "tag": "input",
                  "translations": {
                    "en": "Age"
                  },
                  "type": "Int",
                  "value": "/data/age"
                }
              ],
              "unique_id": "80125ca8ed9f4e3ba442a9f4dd40dc6f",
              "xmlns": "http://openrosa.org/formdesigner/29856D0E-305D-418A-8F6E-41663E4BD30D"
            }
          ],
          "name": {
            "en": "Case List for DC"
          },
          "unique_id": "ea828a88402a45fea649b4a811d37f5d"
        },
        {
          "case_properties": [
            "age",
            "followup",
            "name",
            "sex"
          ],
          "case_type": "case",
          "forms": [
            {
              "name": {
                "en": "Followup Form"
              },
              "questions": [
                {
                  "comment": null,
                  "constraint": null,
                  "group": null,
                  "hashtagValue": "#form/followup",
                  "is_group": false,
                  "label": "Followup",
                  "label_ref": "followup-label",
                  "relevant": null,
                  "repeat": null,
                  "required": false,
                  "setvalue": null,
                  "tag": "input",
                  "translations": {
                    "en": "Followup"
                  },
                  "type": "Text",
                  "value": "/data/followup"
                }
              ],
              "unique_id": "6c3a3ce49f0642b4be47849608156b75",
              "xmlns": "http://openrosa.org/formdesigner/DAA687F8-403F-4880-8C8F-DB7C154D96D2"
            }
          ],
          "name": {
            "en": "Case List for SV"
          },
          "unique_id": "46f7b95ec7c2415b9c766edf078fa98b"
        }
      ],
      "name": "App for API Testing",
      "resource_uri": "",
      "version": 26,
      "versions": [
        {
          "build_comment": null,
          "built_on": "2024-05-22T08:51:24.419980Z",
          "id": "49e6e90a84994b6c858e2dc26f988eaa",
          "is_released": true,
          "version": 26
        }
      ]
    }
  ]
}

Summary

  • Meta Data:

    • Limit: The maximum number of objects that can be returned in a single response is not set (null).

    • Next: Points to the next page of results. Since it's set to null, there are no more pages.

    • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

    • Previous: Points to the previous page of results. Since it's set to null, there are no previous pages.

    • Total Count: Indicates that there is a total of 1 object in the collection.

  • Objects:

    • Modules: A list of modules included in the application. Each module contains details such as case properties, case type, forms, and unique ID.

    • Name: The name of the application, set to "App for API Testing".

    • Versions: A list of versions of the application. Each version contains details such as build comment, build timestamp, unique identifier, and whether it's released.

      • Build Comment: A comment regarding the build, currently null.

      • Built On: The timestamp when this version was built, currently null.

      • ID: The unique identifier of the application, set to "452a9a647ee8f364b1aed887c5a56a4c".

      • Is Released: Indicates whether the application version is released, set to false.

      • Version: The version number of the application, set to 26.

 List Location Types: Sample Output

API Output Sample

{
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 3
  },
  "objects": [
    {
      "administrative": true,
      "code": "state",
      "domain": "rr-api-testing-space",
      "id": 15469,
      "name": "State",
      "parent": null,
      "resource_uri": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15469/",
      "shares_cases": false,
      "view_descendants": false
    },
    {
      "administrative": true,
      "code": "district",
      "domain": "rr-api-testing-space",
      "id": 15470,
      "name": "District",
      "parent": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15469/",
      "resource_uri": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15470/",
      "shares_cases": false,
      "view_descendants": false
    },
    {
      "administrative": true,
      "code": "ward",
      "domain": "rr-api-testing-space",
      "id": 15471,
      "name": "Ward",
      "parent": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15470/",
      "resource_uri": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15471/",
      "shares_cases": true,
      "view_descendants": false
    }
  ]
}

Summary

  • Meta Data:

    • Limit: The maximum number of objects that can be returned in a single response is set to 20.

    • Next: Points to the next page of results. Since it's set to null, there are no more pages.

    • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

    • Previous: Points to the previous page of results. Since it's set to null, there are no previous pages.

    • Total Count: Indicates that there are a total of 3 location type objects in the collection.

  • Objects:

    • Administrative: Indicates whether the location type is administrative, set to true for all objects.

    • Code: A code representing the location type.

    • Domain: The domain to which the location type belongs, set to "rr-api-testing-space".

    • ID: The unique identifier of the location type.

    • Name: The name of the location type.

    • Parent: The parent location type. It's null for the "State" location type, and for "District" and "Ward" types, it points to the parent location type using its resource URI.

    • Resource URI: A URI pointing to the location type's resource.

    • Shares Cases: Indicates whether the location type shares cases, set to false for all objects.

    • View Descendants: Indicates whether the location type can view its descendants, set to false for all objects.

 List Locations: Sample Output

API Output Sample

{
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 3
  },
  "objects": [
    {
      "created_at": "2024-05-23T16:32:37.235933",
      "domain": "rr-api-testing-space",
      "external_id": null,
      "id": 2458887,
      "last_modified": "2024-05-23T16:32:37.235942",
      "latitude": null,
      "location_data": {},
      "location_id": "71089d59777a4449ab1563ef3500a4f2",
      "location_type": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15471/",
      "longitude": null,
      "name": "Ward XYZ",
      "parent": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location/b455e55ffb0e453c93a908f5b948423a/",
      "resource_uri": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location/71089d59777a4449ab1563ef3500a4f2/",
      "site_code": "ward_xyz"
    },
    {
      "created_at": "2024-05-23T16:32:18.294653",
      "domain": "rr-api-testing-space",
      "external_id": null,
      "id": 2458886,
      "last_modified": "2024-05-23T16:32:18.294663",
      "latitude": null,
      "location_data": {},
      "location_id": "b455e55ffb0e453c93a908f5b948423a",
      "location_type": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15470/",
      "longitude": null,
      "name": "District A",
      "parent": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location/4fdc93a15e7a4e719f282b11c57d1214/",
      "resource_uri": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location/b455e55ffb0e453c93a908f5b948423a/",
      "site_code": "district_a"
    },
    {
      "created_at": "2024-05-23T16:32:09.402663",
      "domain": "rr-api-testing-space",
      "external_id": null,
      "id": 2458885,
      "last_modified": "2024-05-23T16:32:09.402671",
      "latitude": null,
      "location_data": {},
      "location_id": "4fdc93a15e7a4e719f282b11c57d1214",
      "location_type": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location_type/15469/",
      "longitude": null,
      "name": "State 1",
      "parent": null,
      "resource_uri": "https://www.commcarehq.org/a/rr-api-testing-space/api/v0.5/location/4fdc93a15e7a4e719f282b11c57d1214/",
      "site_code": "state1"
    }
  ]
}

Summary

  • Meta Data:

    • Limit: The maximum number of objects that can be returned in a single response is set to 20.

    • Next: Points to the next page of results. Since it's set to null, there are no more pages.

    • Offset: Indicates the offset of the objects returned in the current response. It's set to 0, meaning these are the first objects in the collection.

    • Previous: Points to the previous page of results. Since it's set to null, there are no previous pages.

    • Total Count: Indicates that there are a total of 3 location objects in the collection.

  • Objects:

    • Created At: The timestamp when the location was created.

    • Domain: The domain to which the location belongs, set to "rr-api-testing-space".

    • External ID: An external identifier for the location, currently null.

    • ID: The unique identifier of the location.

    • Last Modified: The timestamp when the location was last modified.

    • Latitude: The latitude coordinate of the location, currently null.

    • Location Data: Additional data associated with the location, currently an empty object.

    • Location ID: The ID of the location.

    • Location Type: The type of location, specified by its resource URI.

    • Longitude: The longitude coordinate of the location, currently null.

    • Name: The name of the location.

    • Parent: The parent location of the current location. It points to the parent location using its resource URI. It's null for the top-level location.

    • Resource URI: A URI pointing to the location's resource.

    • Site Code: A code representing the site of the location.

Report Explorer

The same link also allows users to look at existing reports and data sources for the domain selected. Users can select any report builder reports from the dropdown and see the output.

Data Source Editor

This is an advanced feature and will require Dimagi support. Please reach out to info@dimagi.com for queries.

  • No labels