コード例 #1
0
ファイル: urls.py プロジェクト: hashimoto-hb/commcare-hq
def api_url_patterns():
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name="v%d.%d" % version)
        for R in resources:
            api.register(R())
        for R in COMMTRACK_RESOURCES:
            api.register(R())
        yield (r"^", include(api.urls))
    yield url(r"^v0.1/xform_es/$", XFormES.as_domain_specific_view())
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass  # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(
            r"^custom/%s/v%s/$" % (view_class.api_name(), view_class.api_version()),
            view_class.as_view(),
            name="%s_%s" % (view_class.api_name(), view_class.api_version()),
        )
    yield url(
        r"^case/attachment/(?P<case_id>[\w\-]+)/(?P<attachment_id>.*)$",
        CaseAttachmentAPI.as_view(),
        name="api_case_attachment",
    )
    yield url(r"^redis_assets/$", RedisAssetsAPI.as_view())
コード例 #2
0
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(r'v0.5/odata/Cases/$',
              ODataServiceView.as_view(),
              name='odata_service')
    yield url(r'v0.5/odata/Cases/\$metadata$',
              ODataMetadataView.as_view(),
              name='odata_meta')
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass  # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' %
                  (view_class.api_name(), view_class.api_version()),
                  view_class.as_view(),
                  name="%s_%s" %
                  (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")
コード例 #3
0
ファイル: urls.py プロジェクト: soitun/commcare-hq
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataCaseServiceView.as_view(),
        name=ODataCaseServiceView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/$',
              ODataCaseServiceView.as_view(),
              name=ODataCaseServiceView.urlname)
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataCaseMetadataView.as_view(),
        name=ODataCaseMetadataView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataCaseMetadataView.as_view(),
              name=ODataCaseMetadataView.urlname)

    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataFormServiceView.as_view(),
        name=ODataFormServiceView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/$',
              ODataFormServiceView.as_view(),
              name=ODataFormServiceView.urlname)
    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataFormMetadataView.as_view(),
        name=ODataFormMetadataView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataFormMetadataView.as_view(),
              name=ODataFormMetadataView.urlname)
    yield url(r'v0.5/messaging-event/$',
              messaging_events,
              name="api_messaging_event_list")
    yield url(r'v0.5/messaging-event/(?P<event_id>\d+)/$',
              messaging_events,
              name="api_messaging_event_detail")
    # match v0.6/case/ AND v0.6/case/e0ad6c2e-514c-4c2b-85a7-da35bbeb1ff1/ trailing slash optional
    yield url(r'v0\.6/case(?:/(?P<case_id>[\w-]+))?/?$',
              case_api,
              name='case_api')
    yield from versioned_apis(API_LIST)
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(
        r'^form/attachment/(?P<instance_id>[\w\-:]+)/(?P<attachment_id>.*)$',
        view_form_attachment,
        name="api_form_attachment")
コード例 #4
0
def api_url_patterns():
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' % (view_class.api_name(), view_class.api_version()), view_class.as_view(), name="%s_%s" % (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-]+)/(?P<attachment_id>.*)$', CaseAttachmentAPI.as_view(), name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-]+)/(?P<attachment_id>.*)$', FormAttachmentAPI.as_view(), name="api_form_attachment")
コード例 #5
0
ファイル: urls.py プロジェクト: kkrampa/commcare-hq
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(r'v0.5/odata/Cases/$', ODataServiceView.as_view(), name='odata_service')
    yield url(r'v0.5/odata/Cases/\$metadata$', ODataMetadataView.as_view(), name='odata_meta')
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' % (view_class.api_name(), view_class.api_version()), view_class.as_view(), name="%s_%s" % (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$', CaseAttachmentAPI.as_view(), name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$', FormAttachmentAPI.as_view(), name="api_form_attachment")
コード例 #6
0
def api_url_patterns():
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        for R in COMMTRACK_RESOURCES:
            api.register(R())
        yield (r'^', include(api.urls))
    yield url(r'^v0.1/xform_es/$', XFormES.as_domain_specific_view())
    # HACK: fix circular import here, to fix later
    try:
        from pact.api import PactAPI
    except ImportError:
        pass # maybe pact isn't installed
    for view_class in DomainAPI.__subclasses__():
        yield url(r'^custom/%s/v%s/$' % (view_class.api_name(), view_class.api_version()), view_class.as_view(), name="%s_%s" % (view_class.api_name(), view_class.api_version()))
    yield url(r'^case/attachment/(?P<case_id>[\w\-]+)/(?P<attachment_id>.*)$', CaseAttachmentAPI.as_view(), name="api_case_attachment")
    yield url(r'^redis_assets/$', RedisAssetsAPI.as_view())
コード例 #7
0
ファイル: urls.py プロジェクト: tobiasmcnulty/commcare-hq
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataCaseServiceView.as_view(),
        name=ODataCaseServiceView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/$',
              ODataCaseServiceView.as_view(),
              name=ODataCaseServiceView.urlname)
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataCaseMetadataView.as_view(),
        name=ODataCaseMetadataView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataCaseMetadataView.as_view(),
              name=ODataCaseMetadataView.urlname)

    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataFormServiceView.as_view(),
        name=ODataFormServiceView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/$',
              ODataFormServiceView.as_view(),
              name=ODataFormServiceView.urlname)
    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataFormMetadataView.as_view(),
        name=ODataFormMetadataView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataFormMetadataView.as_view(),
              name=ODataFormMetadataView.urlname)
    for version, resources in API_LIST:
        api = CommCareHqApi(api_name='v%d.%d' % version)
        for R in resources:
            api.register(R())
        yield url(r'^', include(api.urls))
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")
コード例 #8
0
ファイル: urls.py プロジェクト: solleks/commcare-hq
def api_url_patterns():
    # todo: these have to come first to short-circuit tastypie's matching
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataCaseServiceView.as_view(),
        name=ODataCaseServiceView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/$',
              ODataCaseServiceView.as_view(),
              name=ODataCaseServiceView.urlname)
    yield url(
        r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataCaseMetadataView.as_view(),
        name=ODataCaseMetadataView.table_urlname)
    yield url(r'v0.5/odata/cases/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataCaseMetadataView.as_view(),
              name=ODataCaseMetadataView.urlname)

    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/$',
        ODataFormServiceView.as_view(),
        name=ODataFormServiceView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/$',
              ODataFormServiceView.as_view(),
              name=ODataFormServiceView.urlname)
    yield url(
        r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/(?P<table_id>[\d]+)/\$metadata$',
        ODataFormMetadataView.as_view(),
        name=ODataFormMetadataView.table_urlname)
    yield url(r'v0.5/odata/forms/(?P<config_id>[\w\-:]+)/\$metadata$',
              ODataFormMetadataView.as_view(),
              name=ODataFormMetadataView.urlname)
    yield url(r'v0.6/case/', include(case_api_urlpatterns))
    yield from versioned_apis(API_LIST)
    yield url(r'^case/attachment/(?P<case_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              CaseAttachmentAPI.as_view(),
              name="api_case_attachment")
    yield url(r'^form/attachment/(?P<form_id>[\w\-:]+)/(?P<attachment_id>.*)$',
              FormAttachmentAPI.as_view(),
              name="api_form_attachment")