API

Metadata requests

Metadata requests provide metadata information about the API resources themselves. Information about the current user's permission to use the API resource is also provided, together with information about whether business rules allow changes to be made (even for single fields for PUT requests).

The syntax of the request URI is:

https://api.rambase.net/metadata?uri={resourceURL}&verb={resourceVerb}

The response includes the following metadata of the resource:

  • API resource description
    Description of the API resource as found in the documentation.
  • URI w/parameters
    The URI of the API resource, including URL parameters. Each of the URL parameters is presented with the name of the parameter, datatype, description, minimum value, maximum value, etc.
  • Input fields
    All input fields in the API resource. Each field is presented with the name of the field, datatype, xpath, description, minimum value, maximum value etc.
  • Response fields
    All response fields in the API resource. Each field is presented with the name of the field, datatype, path, description and more.
  • Filter fields
    All fields that can be filtered by in the API resource. Each field is presented with the name of the field, datatype, applicable domain values and which macro set to be used.
  • Sortable fields
    All fields that can be sorted by in the API resource. Each field is presented with the name of the field, datatype and description.
  • Named filters
    All named filters that can be used in the filter. Each named filter is presented with the name of the filter and what filter string to use. As with the filter fields, this metadata can be useful when presenting filter opportunities for the users.
  • Admittance
    If the current user for some reason cannot use this API resource, an Admittance tag will be presented, including a message explaining why, an error message identifier and a permission identifier (if permission is missing). If admittance to the API resource is fine, then the same admittance information can be presented for each of the input fields.

Some of the metadata mentioned above is only included if the right $expand query parameter is added:

  • Description: Include description of the API resource and description of the fields. Ex. $expand=Description
  • Translated description: Include description of the API resource and translated description of the fields. Remember to add the $lang query parameter to be provided as well. Ex. $expand=TranslatedDescription
  • Translated name: Include translated name of the fields. Remember to add the $lang query parameter to be provided as well. Ex. $expand=TranslatedName&$lang=nob
  • Macro definitions: Include information about what the different macro definitions allowed in the filter fields. Ex. $expand=MacroDefinitions
  • URI parameters: Include URI and metadata for URI parameters. Ex. $expand=URIParameters
  • Expandable response fields: Include response fields that requires $expand parameter, and what expand parameter to use. Ex. $expand=ExpandableFields

Examples:

In this example we request metadata for the PUT resource of a specified sales order:

https://api.rambase.net/metadata?uri=sales/orders/114532&verb=PUT&$expand=Description,UriParameters&$format=json

Here are parts of the response. Note that the response is divided into separate elements for each part of the metadata:

1
{
2
          'metadata': {
3
            'description': 'Saves information about the sales order',
4
            'uri': 'sales/orders/{salesOrderId}',
5
            'uriParameters': [
6
              {
7
                'name': '{salesOrderId}',
8
                'datatype': 'Integer',
9
                'description': 'Sales order identifier',
10
                'isRequired': true,
11
                'minimumValue': 100000
12
              }
13
            ],
14
            'inputFields': [
15
              {
16
                'name': 'CustomersReference',
17
                'datatype': 'String',
18
                'path': 'salesOrder.customersReference',
19
                'description': 'Customers reference. Typically a person.'
20
              },
21
              {
22
                'name': 'CustomersReferenceNumber',
23
                'datatype': 'String',
24
                'path': 'salesOrder.customersReferenceNumber',
25
                'description': 'Customers reference number. E.g. the internal sales order id the customer use in their own system.'
26
              },
27
              {
28
                'name': 'VolumePriceAgreement',
29
                'datatype': 'String',
30
                'path': 'salesOrder.volumePriceAgreement',
31
                'description': 'Special price agreement related to the quantity beeing ordered. ',
32
                'applicableDomainValues': 'https://api.rambase.net/system/domain-values/applicable-values?object=CUSDOC&field=PRICEAGR',
33
                'accessDenied': 'Cannot update when items exist',
34
                'accessRuleId': 100208,
35
                'errorMessageId': 101561
36
              },
37
              {
38
                'name': 'Currency',
39
                'datatype': 'String',
40
                'path': 'salesOrder.currency',
41
                'description': 'Three character code following the ISO 4217 standard.',
42
                'regularExpression': '^[A-Z]{3}$',
43
                'applicableDomainValues': 'https://api.rambase.net/system/domain-values/applicable-values?object=CUS&field=CUR'
44
              },
45
              {
46
                'name': 'Note',
47
                'datatype': 'String',
48
                'path': 'salesOrder.note',
49
                'description': 'Additional information regarding the object (free text). This note might be visible to customers/suppliers.'
50
              }
51
            ],
52
            'responseFields': [],
53
            'filterFields': [],
54
            'sortableFields': [],
55
            'namedFilters': []
56
          }
57
}

In this example we request metadata for the GET resource of listing sales order:

https://api.rambase.net/metadata?uri=sales/orders&verb=GET&$expand=Description,MacroDefinitions&$format=json

Here are parts of the response:

1
{
2
  'metadata': {
3
    'description': 'List of sales orders',
4
    'inputFields': [],
5
    'responseFields': [
6
      {
7
        'name': 'SalesOrderId',
8
        'datatype': 'Integer',
9
        'path': 'salesOrders.salesOrder.salesOrderId',
10
        'description': 'Sales order identifier',
11
        'hasDomainDescription': false
12
      },
13
      {
14
        'name': 'Status',
15
        'datatype': 'Integer',
16
        'path': 'salesOrders.salesOrder.status',
17
        'description': 'Status of sales order',
18
        'hasDomainDescription': true
19
      },
20
      {
21
        'name': 'Type',
22
        'datatype': 'String',
23
        'path': 'salesOrders.salesOrder.type',
24
        'description': 'Type of sales order. ',
25
        'hasDomainDescription': true
26
      },
27
      {
28
        'name': 'CreatedAt',
29
        'datatype': 'Datetime',
30
        'path': 'salesOrders.salesOrder.createdAt',
31
        'description': 'Date and time of creation',
32
        'hasDomainDescription': false
33
      }
34
    ],
35
    'filterFields': [
36
      {
37
        'name': 'AccountManager',
38
        'datatype': 'Integer',
39
        'description': 'Reference to the employee who is responsible for the management of sales, and relationship with the customer.',
40
        'macroSet': 'pid'
41
      },
42
      {
43
        'name': 'CreatedAt',
44
        'datatype': 'Datetime',
45
        'description': 'Date and time of creation',
46
        'macroSet': 'datetime'
47
      },
48
      {
49
        'name': 'Currency',
50
        'datatype': 'String',
51
        'description': 'Three character code following the ISO 4217 standard.',
52
        'applicableDomainValues': 'https://api.rambase.net/system/domain-values/applicable-values?object=CUS&field=CUR'
53
      },
54
      
55
    ],
56
    'macroDefinitions': [
57
      {
58
        'name': 'now',
59
        'macroSets': 'datetime',
60
        'allowedUnits': 'y,M,w,d,h,m,s',
61
        'defaultUnit': 'd'
62
      },
63
      {
64
        'name': 'startOfDay',
65
        'macroSets': 'datetime',
66
        'allowedUnits': 'y,M,w,d,h,m,s',
67
        'defaultUnit': 'd'
68
      },
69
      {
70
        'name': 'today',
71
        'macroSets': 'date',
72
        'allowedUnits': 'y,M,w,d,h,m,s',
73
        'defaultUnit': 'd'
74
      },
75
      {
76
        'name': 'currentUser',
77
        'macroSets': 'pid'
78
      },
79
      {
80
        'name': 'currentDB',
81
        'macroSets': 'db'
82
      }
83
    ],
84
    'sortableFields': [
85
      {
86
        'name': 'AccountManager',
87
        'datatype': 'Integer',
88
        'description': 'Reference to the employee who is responsible for the management of sales, and relationship with the customer.'
89
      },
90
      {
91
        'name': 'Assignee',
92
        'datatype': 'Integer',
93
        'description': 'The user who has been assigned to work with this object.'
94
      },
95
      {
96
        'name': 'AssigneeName',
97
        'datatype': 'String',
98
        'description': 'The name of the user who has been assigned to work with this object.'
99
      }
100
    ],
101
    'namedFilters': [
102
      {
103
        'name': 'Active orders',
104
        'key': 'Active',
105
        'description': 'Active sales orders. Sales orders registered, but not delivered yet.',
106
        'uncombinableWith': []
107
      },
108
      {
109
        'name': 'Active or shipped orders',
110
        'key': 'ActiveOrShipped',
111
        'description': 'List of active sales orders and processed orders with one or more items forwarded to shipping advice.',
112
        'uncombinableWith': []
113
      },
114
      {
115
        'name': 'Delayed orders',
116
        'key': 'Delayed',
117
        'description': 'Sales orders that contains item(s) which should have been delivered according to confirmed delivery date.',
118
        'uncombinableWith': []
119
      }
120
    ]
121
  }
122
}