LogoLogo
  • The Moment Knowledge Base
  • Moment
  • My Pages
    • My Settings
    • Time
      • Timesheet
      • Hours Report
      • Time balance
      • Absence Overview
      • Absence Report
      • Planned absence
    • My overview
    • My Tasks
      • My Task Board
    • Project Management
      • To be invoiced
      • Project Report
      • Hours report
      • Invoices
    • My Travel & Expense
      • New Expense
      • Claims
    • Project Expenses
    • Education
    • Organization
    • My Stats
    • Menu items
  • Tasks
    • Planning
    • Recurring tasks
    • Tasks report
  • Customers
    • Overview
    • Customer profile page
    • Contacts and mailing lists
    • Invoicing settings for individual customers
  • Offers
    • How to activate the offer module in Moment
    • Sending offers from Moment
    • How do hours in activities from an offer show in Moment's capacity overview?
  • Quality
    • Checklists
      • Working with checklists
      • Importing checklist templates
      • Control column
      • Checklist Report
    • Nonconformities
      • Action types
      • Categorize with tags
      • Impact
    • Routines
    • Project reviews
    • Evaluations
    • Risk management
    • Risk report
    • Settings
    • How can Moment support ISO certification for your company?
  • Projects
    • Overview
      • On map
      • Status
    • Dashboard
    • Report
    • Price Lists
    • Forecast
    • How to setup hours approval in Moment
    • Project Roles
    • Projects Main Page
    • Template projects
    • Activities
      • How to copy activities, move hours from one activity and deleting activities.
    • Project plan
      • Project Plan features
      • Budgeted costs and revenue in Moment's Project Plan
      • Accrual report
    • Expenses
    • Price Model
      • Price model: Hourly rates
      • Price model: Fixed price
      • Price model: Subscription
    • Invoice settings
    • Profit Factor
      • Calculated profit factor
      • Fixed profit factor
    • Products
    • How to keep track of costs in non billable-projects
  • Resources
    • HR (Pro)
      • Configuration
      • Reports
    • Co-workers
      • Schedule
      • New user (co-worker)
        • First time login in Moment for new users
      • Access Rights
      • Education
      • Hourly rates
      • Licenses
      • 📆Absence Approval based on tags
      • How to register furloughing (permitteringer) in Moment?
      • Why do my co-workers and I have too many/few banked hours?
      • How to add co-workers to projects between two partner companies
    • Resource Planner
    • Reservations
    • Capacity
  • Finances
    • Invoices
      • Payment ID
        • Payment ID Examples
      • Credit invoices in Moment
      • Updating the invoice summary.
      • Can't export invoices to an external accounting system
      • Splitting invoices between two customers
    • Project expenses
    • Product sales
    • Subscriptions
    • To be invoiced
      • Invoice draft approval
      • Common problems that prevent invoicing
    • Payments and write off
      • Customer has paid an invoice twice/OCR file has been read twice
    • Customer ledger
    • Payment reminders
    • Invoicing in advance (A-konto)
    • OCR files (KID in Norway)
    • E-invoicing
      • Countries
        • Norway
        • Sweden
        • Iceland
        • Denmark
          • Background info and technical details
      • PEPPOL BIS Billing 3.0 (EHF 3.0)
      • Addresses / PEPPOL ID
  • Company
    • Hours overview
    • Absence
    • Timesheet status
    • Hours and vacation balance
    • Billable time report
    • Performance
    • Files
    • Logs
    • Forecast
    • Holidays
    • Export invoices
  • Setup
    • Access control
      • Settings for Role Based Access Control
    • Tags
    • Travel & Expense
      • T&E configuration
        • Expense types
          • Norway
            • 2022
            • 2023
            • 2024
    • Notifications
      • Export invoices
  • Moment - By topic
    • How to setup and test Moment
    • Education
      • Setup
      • Registration
      • Reporting
    • Partner Companies
    • Moment FAQ
      • Security
    • Integrations
      • Real-time integrations
        • 24SevenOffice
        • Azets
        • Business Central
          • Configuration
            • Business Central App
            • Business Central
            • Moment
          • Data flow
        • Business Central Payments
        • CatalystOne
        • DK+
        • DnB Regnskap
        • Fiken
          • Authorization
        • Fortnox
          • OAuth 2 authorization
        • Fortnox Payments
        • PowerOffice Go
        • SharePoint
          • Configuration
            • Azure Active Directory
              • Postman
            • SharePoint
              • Content Type
                • Activity
                • Year
                • Period
                • Tags
        • Sparebank1 Regnskap
        • Tripletex
          • VAT Settings
          • Cost category names
        • Uni Economy
        • Uniconta
        • Uniconta Payments
        • Visma e-conomic
          • Incoming expenses
          • Demo
        • Visma e-conomic Payments
        • Xledger
      • File exports
        • Accounting system
          • DK
          • Duett
          • Dynamics C5
          • eFina
          • InfoEasy
          • Mamut
          • SIE 4
          • Uni Economy
            • Import central
          • Uni Micro
          • Visma Business
          • Visma DI Systems
          • Visma Global
          • Visma Scenario
          • Visma.net
          • Xero
            • Xero templates
          • Xledger
            • Format AR10
            • Format GL02b
          • Factoring
            • SG Finans
              • File content
            • Sparebank1 factoring
        • Wage system
          • Hogia Lön
          • Huldt & Lillevik Lønn
          • Visma Lønn
        • Export templates
          • Template editor
            • Create template
            • Edit template
              • Content
            • Test template
          • Customers
          • Expenses (Claims)
          • Hours (Time records)
          • Projects
          • Custom template
      • File import
        • Integration/file import
          • SoMe Ad Expenses
            • Configuration
            • Import
            • Ad providers
            • Technical description
          • Visma Document Center
            • SFTP configuration
            • Visma Document Center CSV file
        • Moment Importer
        • Object import/update
          • Import
        • Tools
          • Checklist
          • Expenses from file
          • Import expenses
      • Other systems
        • Ambita
        • Holte
        • JIRA
        • MAKS
        • RecMan
      • SSO
        • Google
        • Microsoft
      • Webhooks
        • Claims
        • Customers
        • Invoices
        • Offers
        • Projects
      • Known issues
        • Tripletex
        • 24SevenOffice
        • General
          • Invoice not transferred due to VAT code
  • Change Log
  • For developers
    • API
      • Authorization
        • Postman
      • Rate limit
      • How to use the API
      • How to get the your data
        • projects/projectRegisteredHoursReport
        • timeRecords/getReport
      • Moment API Swagger
  • ProjectHelp
    • ProjectHelp Support
Powered by GitBook
On this page
  • CRUD - Create, Read, Update, Delete
  • Includes
  • How do includes work?
  • Get a collection of objects
  • POST/PUT entity
  • Batch processing
  • Limits

Was this helpful?

  1. For developers
  2. API

How to use the API

PreviousRate limitNextHow to get the your data

Last updated 2 years ago

Was this helpful?

The actual API is (will be) documented mainly using . However, we have a standardized way of communicating with the back-end. This page is about some of our core principles.

All entities have their own base path. Time records, for example, have a base path /api/1.0/companies/cloudware/timeRecords. The base path is implied in the rest of this document.

Cloudware in the path shown above is the company code for the database you want to access, replace this with what is correct for your database. You will always find this in the URL when you are logged in to Moment.

CRUD - Create, Read, Update, Delete

  • Create: POST to /

  • Read a single entity: GET from /{id}

  • Read a list of entities: GET from /

  • Update: PUT or PATCH to /{id}. They both work the same way, but PATCH is a more logical method to use if you only want to update parts of an object, and thus only submit the changed parts.

  • Delete: DELETE from /{id}.

Includes

Moment uses an "includes" concept. This is done primarily to increase the speed of the requests. The main idea was taken from GraphQL: return only the data that is really needed. It:

  • works faster than the usual GET method

  • provides a standard way of getting additional metadata for requested data

  • helps us create pure inline-editing of single fields in our objects

How do includes work?

In some API requests you can specify which fields, parts of entities or what metadata you want get in the response.

Part - it is a group of fields that commonly uses together

Metadata - it is a data that contains additional information about entities that was return

NB!

  • Parts and metadata must be defined and implemented on back-end manually.

  • Fields within objects can be requested without any changes in the code.

  • The id field of all objects is always returned.

  • Fields of inner objects can be requested with .. Example: field customer.name will be returned as customerName.

  • Includes support Create (POST), Read (GET) and Update (PUT) methods.

Get a collection of objects

Here is an example request, asking for the base information in addition to currencyCode and metadata for the overviewPage, for offers:

GET <entities>/include/{parts:.+}

// Example 
GET /offers/include/base+currencyCode+metadata.overviewPage

// Response
{
    "content": [
        { "id": 1, "name": "Offer 1", "issueDate":"2018-01-01", "currencyCode": "USD", }, ...
    ],
    "metadata": {
        "totalSumInCompanyCurrency": 1726.50
    }
}

POST/PUT entity

Here is an example request where we update the customer for an offer by POSTing a customer id. Using includes, we will get only a small portion of the customer info in return.

POST <entities>/include/{parts:.+}
PUT <entities>/{id}/include/{parts:.+}

// Example
PUT /offers/666999/include/customer.id+customer.name
BODY { "customerId": 3333777 }

// Response
{
    "id": 666999,
    "customerId": 3333777,
    "customerName": "Richest AS"
}

Batch processing

Sometimes it's useful to do multiple things at once. For performance reasons, or because we want to keep all the actions within the same transaction, and make sure everything is rolled back if anything goes wrong.

Batch: POST to /batch, passing along an object containing all the instructions. The input JSON structure is as follows:

{
  "create": [object1, object2, ...],
  "update": {
    "id1": { object1 },
    "id2": { object2 },
    ...
  },
  "delete": [id1, id2, ...]
}

Here are a few examples (posted to /batch):

  • Create multiple entities: {"create":[{"projectId":4598,"name":"First entry"},{"projectId":4598,"name":"Second entry"}]}

  • Update multiple entities: {"update":{"11362":{"name":"New name 1"},"11361":{"name":"New name 2"}}}

  • Delete multiple entities: {"delete":[11357,11356]}

Here is an example of the returned JSON after a successful POST:

{
   "created": [{
      "projectId": 4598,
      "name": "First entry",
      "projectMembershipId": null,
      "id": 11321
   }],
   "updated": [],
   "createOrderIntact": true
}

Limits

There are limits to amount of data that is returned. The result will then contain an attribute "limitWasExceeded". We do offer an option to get more data - to get this added the parameter "noLimit" and set this to true.

There is still a limit that can not be overruled. The maximum number of records to be returned is 30 000.

If the request returns more than this, the filter needs to be adjusted so that amount of records will be below this limit.

Swagger
Company code is found after team\ in the URL