Padmin:Padmin api

Fra prprWiki
Revisjon per 3. mar. 2026 kl. 09:40 av Pradmin632 (diskusjon | bidrag) (Ny side: ==padmin api - oversikt== {| class="wikiTable" border="1" style="border-collapse: collapse;" |- !Hva !Betydning !Eksempel |- | adresse | ${server-url}/api/ | https://padmin.cloud/padmin/…)
(diff) ← Eldre revisjon | Nåværende revisjon (diff) | Nyere revisjon → (diff)
Hopp til navigeringHopp til søk

padmin api - oversikt

Hva Betydning Eksempel
adresse ${server-url}/api/ https://padmin.cloud/padmin/api/
PS! Padmin does not like encoded url params

testing api with curl

# curl url -u "username:password" -H "Accept: application/json"
curl http://localhost:8080/api/kvTen/findKvTenByName/?name=Aktivitetskoder+/+Activity+codes -u "abc2001:bj123456" -H "Accept: application/json"

# post
curl -X POST http://localhost:8080/api/kvTen/save -u "abc2001:bj123456" -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{ "groupName": "Avdeling / Department", "name": "Avdeling / Department series-7", "keyType": "Int", "valueInt": 0 }'

padmin api - error and other responses not returning data

These data-less responses is on the format:

{
  "message":"Not found",
  "status":"NOT_FOUND",
  "code":404
}

padmin api - admin

Endpoint Funksjon Adgangskontroll Eksempel Respons
tenants/refresh Oppdatere alle datasources basert på permitAll https://padmin.cloud/padmin/tenants/refresh OK / 200 eller NO_CONTENT / 204
tenants/add/${shortName} legg til datasource for angitt shortName permitAll https://padmin.cloud/padmin/tenants/add/abc OK / 200 eller NO_CONTENT / 204
username hent pålogget brukernavn, standard respons = Fullt Navn (brukernavn). Legg til parameteren usernameOnly for responsen brukernavn permitAll https://padmin.cloud/padmin/username OK / 200 eller NO_CONTENT / 204
user hent bruker info for pålogget bruker permitAll https://padmin.cloud/padmin/user OK / 200. Either

{ "name": "Some Name", "email": "some.email@prpr.no", "phone_number": "number", "company_name": "company name" }

or { message: "some message" }

support api

Api Support

i18n messages

Endpoint Funksjon Adgangskontroll Eksempel Respons
i18n/getI18nMessage Retrieve padmin message string for given key, locale og messageParams.

Locale examples: en, nb MessageParams er en array, og kan sendes på formatet &messageParams=en&messageParams=to for parameterne en og to. Grails tåler ikke at parameterstrengen er encoded.

IsFullyLoggedIn https://padmin.cloud/i18n/getI18nMessage?key=default.no.access.message { message: 'You do not have access to this page' }

padmin api - keywords

Endpoint Funksjon Adgangskontroll Eksempel Respons
kvTen/index get all keywords HasAnyPadmin /api/kvTen/index OK / 200 eller NO_CONTENT / 204
kvTen/findKvTenByName Find keyword by name HasAnyPadmin /api/kvTen/FindKvTenByName/?name=Access-padmin OK / 200 eller NO_CONTENT / 204
kvTen/update update keyword Admin /api/kvTen/update OK / 200 eller NO_CONTENT / 204

KvTen domain class:

class KvTen implements MultiTenant<KvTen> {

    static belongsTo = [owner: KvTenOwner, group: KvTenGroup]
    static constraints = {
        name nullable: false, blank: false, size: 1..128
        keyType inList: KeyConst.TYPES.toList()// ['Tx', 'List', 'Dbl', 'Int', 'Bool', 'Radio'/*, 'RichText'*/, 'Attachment']
        dspValue nullable: true, sqlType: 'text'
        valueTx nullable: true, sqlType: 'text'
        valueDbl nullable: true
        valueInt nullable: true
        valueBool nullable: true
        valueList nullable: true, sqlType: 'text', widget: 'textarea'
        valueRadio nullable: true, size: 0..128, validator: { val, KvTen obj -> (val == null) || (val in ListString.getList(obj?.valueList)) }
        guiReadOnly nullable: false
        guiCanDelete nullable: false
        help nullable: true, sqlType: 'text'
        helpUrl nullable: true, size: 0..255
    }
    static mapping = {
        sort 'name'
        owner lazy: false
        group lazy: false
    }

    String name

    String keyType
    //
    // value
    //
    String dspValue
    String valueTx
//    String valueStrings
    BigDecimal valueDbl
    Long valueInt
    Boolean valueBool
    String valueRadio
    // TODO: valueCheckbox not implemented
    //
    // the values used by valueRadio
    //
    String valueList
    //
    // Behaviour
    //
    Boolean guiReadOnly = false
    Boolean guiCanDelete = true
    String help
    String helpUrl

    String toString() {
        "${name}: ${dspValue}"
    }
}

padmin api - users

Endpoint Funksjon Adgangskontroll Eksempel Respons
user/index get all users HasAnyPadmin /api/user/index OK / 200 eller NO_CONTENT / 204
user/findByUsername Find user by username HasAnyPadmin /api/user/findByUsername/?username=abc00 OK / 200 eller NO_CONTENT / 204
user/update update user HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/user/update OK / 200 eller NO_CONTENT / 204
user/save add user HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/user/save Found / 302
user/delete delete user HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/user/delete/1234 OK / 200 eller NO_CONTENT / 204
user/authorityadd add user to group HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/user/authorityadd/1234?authorities-add=Users

Put user as json and param authorities-add.

OK / 200 eller NO_CONTENT / 204
user/authorityremove remove user from group HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/user/authorityremove/1234?authorities-add=Users

Put user as json and param authorities-add.

OK / 200 eller NO_CONTENT / 204

User domain class:

class User implements Serializable, MultiTenant<User> {

    static constraints = {
        username nullable: false, blank: false, maxSize: 64, unique: true
        password nullable: false, blank: false, password: true, minSize: 8
        name nullable: false, blank: false, maxSize: 64
        secret nullable: true, maxSize: 64
        email nullable: true, maxSize: 128, email: true
        enabled nullable: false
        locale nullable: true, maxSize: 2
        accountExpired nullable: false
        accountLocked nullable: false
        passwordExpired nullable: false
    }

    static mapping = {
        table 'uuser'
        password column: '`password`'
        sort 'username'
    }

    private static final long serialVersionUID = 1

    String username
    String password
    Boolean enabled = true
    Boolean accountExpired = false
    Boolean accountLocked = false
    Boolean passwordExpired = false

    Boolean isUsing2FA = false
    String secret
    String email
    String name
    String locale = 'no'

    String toString() {
        "${name} (${username})"
    }
    String getGroupMembership() {
        L2SecurityService l2SecurityService = (L2SecurityService) Holders.grailsApplication.mainContext.getBean('l2SecurityService')
        l2SecurityService.getGroupMembership(username)
    }
}

padmin api - employee

Endpoint Funksjon Adgangskontroll Eksempel Respons
employee/index get all employees. Return as json array. HAS_PADMIN_READ_BASE_HR /api/employee/index OK / 200 eller NO_CONTENT / 204
employee/findByEmployeeNumber/?employeeNumber=employeeNumber Find employee by employeeNumber. HAS_PADMIN_READ_BASE_HR /api/user/findByEmployeeNumber/?employeeNumber=123 OK / 200 eller NO_CONTENT / 204
employee/setStatus/employeeId?status=newStatus Find employee by id, set new status. Return the updated employee. HAS_PADMIN_WRITE_BASE_HR /api/user/setStatus/123?status=10 OK / 200 eller NO_CONTENT / 204
employee/update/employee_as_json update employee, return the updated employee. HAS_PADMIN_WRITE_BASE_HR /api/employee/update OK / 200 eller NO_CONTENT / 204
employee/save/employee_as_json add employee, return the new employee. HAS_PADMIN_WRITE_BASE_HR /api/employee/save Found / 302
employee/delete Set status to 90 for employee. Delete not possible. Return the deleted employee. HAS_PADMIN_WRITE_BASE_HR /api/employee/delete/123 OK / 200 eller NO_CONTENT / 204
employee/deletePermanent Set status to 90 for employee, then delete. Return ok message, ROLE_ADMIN /api/employee/deletePermanent/123 OK / 200
employee/createUser/employee_as_json Create user for employee. Return the new user. HAS_PADMIN_WRITE_BASE_HR /api/employee/createUser/ OK / 200 eller NO_CONTENT / 204

User domain class:

class Employee implements MultiTenant<Employee> {

    static constraints = {
        employeeNumber nullable: true, unique: true
        firstName nullable: false, size: 1..64
        middleName nullable: true, size: 0..64
        lastName nullable: false, size: 1..64
        title nullable: true, size: 0..64
        socialSecurityNumber nullable: true, maxSize: 15
        bankAccount nullable: true, maxSize: 15
        startDate nullable: true, sqlType: 'date'
        endDate nullable: true, sqlType: 'date'
        competence nullable: true, sqlType: 'varchar'
        certificates nullable: true, sqlType: 'varchar'
        contactDetails nullable: true
        department nullable: true, maxSize: 32
        departmentNumber nullable: true, maxSize: 10
        status nullable: true, maxSize: 2
        relatives nullable: true, maxSize: 64
        relativesContactDetails nullable: true
        hourRate nullable: true
        useHourRate nullable: true
        payrollMethod nullable: true, maxSize: 32
        hrCareAlone nullable: true
        hrNumKids nullable: true
        hrBirthYearOldestKid nullable: true
        hrKidsDays nullable: true
        hrSelfDays nullable: true
        hrSelfPeriods nullable: true
    }

    static mapping = {
        sort 'lastName'
    }

    static embedded = ['contactDetails', 'relativesContactDetails']

    String firstName
    String middleName
    String lastName
    String socialSecurityNumber
    String bankAccount
    String competence
    String certificates
    ContactDetails contactDetails
    String department
    String departmentNumber
    String status
    String relatives
    ContactDetails relativesContactDetails
    // employment
    Long employeeNumber
    String title
    Date startDate
    Date endDate
    BigDecimal hourRate
    Boolean useHourRate
    String payrollMethod
    // hr
    Boolean hrCareAlone
    Integer hrNumKids
    Integer hrBirthYearOldestKid
    Integer hrKidsDays
    Integer hrSelfDays
    Integer hrSelfPeriods

    @Override
    String toString() {
        "${firstName}${middleName ? ' ' + middleName : ''} ${lastName}"
    }

}

padmin api - country

Endpoint Funksjon Adgangskontroll Eksempel Respons
country/index get all countries. Return as json array. HAS_PADMIN_READ_BASE_CONFIGURATION /api/country/index OK / 200 eller NO_CONTENT / 204
country/show/id Get country with id. HAS_PADMIN_READ_BASE_CONFIGURATION /api/country/show/123 OK / 200 eller NO_CONTENT / 204
country/findByCountryCode/?countryCode=code Get country with id. HAS_PADMIN_READ_BASE_CONFIGURATION /api/country/findByCountryCode/?countryCode=NO OK / 200 eller NO_CONTENT / 204
country/save/country as json POST save country, return status ok. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/country/save/ OK / 200 eller NO_CONTENT / 204
country/update/country as json PUT update country, return status ok. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/country/update/ OK / 200 eller NO_CONTENT / 204
country/delete Delete country. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/country/delete/123 OK / 200 eller NO_CONTENT / 204

User domain class:

class Country implements MultiTenant<Country> {

    static constraints = {
        countryCode nullable: false, size: 1..5, unique: true
        name nullable: false, size: 1..64
    }

    static mapping = {
        sort 'countryCode'
    }

    String countryCode
    String name

    @Override
    String toString() {
        name
    }

}

padmin api - address

Endpoint Funksjon Adgangskontroll Eksempel Respons
address/index/id get all addresses for given parent id. Return as json array. ROLE_PADMIN_READ /api/address/index/123 OK / 200 eller NO_CONTENT / 204
address/show/id Get address with id. ROLE_PADMIN_READ /api/address/show/123 OK / 200 eller NO_CONTENT / 204
address/save/address as json POST save address, return status ok. ROLE_PADMIN_WRITE /api/address/save/ OK / 200 eller NO_CONTENT / 204
address/update/address as json PUT update address, return status ok. ROLE_PADMIN_WRITE /api/address/update/ OK / 200 eller NO_CONTENT / 204
address/delete Delete address. ROLE_PADMIN_WRITE /api/address/delete/123 OK / 200 eller NO_CONTENT / 204

User domain class:

class Address implements MultiTenant<Address> {

    static constraints = {
        parentId nullable: false
        addressType nullable: false, maxSize: 64
        name nullable: true, maxSize: 64
        address1 nullable: true, size: 0..64
        address2 nullable: true, size: 0..64
        zipCode nullable: true, size: 0..10
        city nullable: true, size: 0..64
        state nullable: true, size: 0..64
        country nullable: true
    }
    static mapping = {
        country lazy: false
    }

    Long parentId
    String addressType
    String name
    String address1
    String address2
    String zipCode
    String city
    String state
    Country country

}
// address-types
class AddressType {

    static final String DEFAULT =       'Standard adresse'
    static final String POSTAL =        'Postadresse / Postal address'
    static final String VISITING =      'Besøksadresse / Visiting address'
    static final String INVOICING =     'Fakturaadresse / Invoicing address'
    static final String PROJECT =       'Prosjektadresse / Project address'

}

padmin api - contactCompany

Endpoint Funksjon Adgangskontroll Eksempel Respons
contactCompany/index get all contactcompanies. Return as json array. HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/index OK / 200 eller NO_CONTENT / 204
contactCompany/index/?<somefilter> get contactcompanies that conforms with filter. Return as json array.

The filter takes one or two params, which are what and status. Possible values for what is:

  • customers
  • suppliers
  • members
  • potentials

Possible values for status is defined in the keyword "ContactCompanyStatus". Use the key.

HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/index/?what=customers&status=10 OK / 200 eller NO_CONTENT / 204
contactCompany/show/id Get contactCompany with id. HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/show/123 OK / 200 eller NO_CONTENT / 204
contactCompany/findByCustomerNumber/?customerNumber=someNumber Find contactCompany with customerNumber HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/findByCustomerNumber/?customerNumber=123 OK / 200 eller NO_CONTENT / 204
contactCompany/findBySupplierNumber/?supplierNumber=someNumber Find contactCompany with supplierNumber HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/findBySupplierNumber/?supplierNumber=123 OK / 200 eller NO_CONTENT / 204
contactCompany/findByName/?name=someName Find all contactCompany with name HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/findByName/?name=Company AS OK / 200 eller NO_CONTENT / 204
contactCompany/findByMemberNumber/?memberNumber=someNumber Find contactCompany with memberNumber HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/findByMembNumber/?memberNumber=123 OK / 200 eller NO_CONTENT / 204
contactCompany/findByCompanyNumber/?companyNumber=someNumber Find all contactCompany with companyNumber, no formatting HAS_PADMIN_READ_BASE_CONTACT /api/contactCompany/findByCompanyNumber/?companyNumber=123 OK / 200 eller NO_CONTENT / 204
contactCompany/save/contactCompany as json POST save contactCompany, return status ok. Save will only set the field name. All other fields must be updated with update/put HAS_PADMIN_WRITE_BASE_CONTACT /api/contactCompany/save/ OK / 200 eller NO_CONTENT / 204
contactCompany/update/address as json PUT update contactCompany, return status ok. HAS_PADMIN_WRITE_BASE_CONTACT /api/contactCompany/update/ OK / 200 eller NO_CONTENT / 204
contactCompany/delete Delete contact company. HAS_PADMIN_WRITE_BASE_CONTACT /api/contactCompany/delete/123 OK / 200 eller NO_CONTENT / 204

User domain class:

class ContactCompany implements MultiTenant<ContactCompany> {

    static hasMany = [contactPersons: ContactPerson]

    static constraints = {
        name nullable: false, blank: false, size: 1..64, unique: true
        status nullable: true, maxSize: 2
        customerNumber nullable: true, unique: true
        supplierNumber nullable: true, unique: true
        companyNumber nullable: true, maxSize: 20
        category nullable: true, maxSize: 64
        district nullable: true, maxSize: 64
        notes nullable: true, sqlType: 'varchar'
        customerInternalProjects nullable: true, sqlType: 'varchar'
        phoneNumber nullable: true, maxSize: 20
        cellNumber nullable: true, maxSize: 20
        emailAddress nullable: true, maxSize: 64, email: true
        fixedAgreementGroups nullable: true, sqlType: 'varchar'
        paymentTerms nullable: true, maxSize: 64
        creditworthiness nullable: true, maxSize: 64
        invoiceEmailAddress nullable: true, maxSize: 64, email: true
        invoiceEmailAddressCopy nullable: true, maxSize: 64, email: true
        invoicingMethod nullable: true, maxSize: 64
        bankAccountNumber nullable: true, maxSize: 32
        isInvoicingFee nullable: true, maxSize: 16
        transportInvoiceWithWorkOrder nullable: true
        transportInvoiceWithLoadListPdf nullable: true
        transportInvoiceWithLoadListSpreadSheet nullable: true
        transportInvoiceDetailType nullable: true, maxSize: 64
        transportInvoiceSplitType nullable: true, maxSize: 64
        transportProvision nullable: true
        memberFeeItemNumber nullable: true, maxSize: 16
        memberFeeQuantity nullable: true
        discount nullable: true
        customerDiscountGroup nullable: true, maxSize: 16
        memberNumber nullable: true, unique: true
        memberIsCentral nullable: true
        memberProvisionRate1 nullable: true
        memberProvisionRate2 nullable: true
        memberProvisionRate1Limit nullable: true
        memberCannotOverride nullable: true
        memberSettlementEmailCopy nullable: true, email: true, maxSize: 64
        memberAdminUser nullable: true, maxSize: 64
    }

    static mapping = {
        sort 'name'
    }

    String name
    String status
    Long customerNumber
    Long supplierNumber
    String companyNumber        // foretaksnummer
    // other info
    String category
    String district
    String notes
    String customerInternalProjects     // customer's project numbers
    //
    String phoneNumber
    String cellNumber
    String emailAddress
    String fixedAgreementGroups
    String paymentTerms
    // invoicing / economy
    String creditworthiness
    String invoiceEmailAddress
    String invoiceEmailAddressCopy
    String invoicingMethod
    String bankAccountNumber
    String isInvoicingFee
    // Transport
    Boolean transportInvoiceWithWorkOrder
    Boolean transportInvoiceWithLoadListPdf
    Boolean transportInvoiceWithLoadListSpreadSheet
    String transportInvoiceDetailType
    String transportInvoiceSplitType
    BigDecimal transportProvision
    // varer
    BigDecimal discount
    String customerDiscountGroup
    // member / bileier
    Long memberNumber           // bileier
    Boolean memberIsCentral
    BigDecimal memberProvisionRate1
    BigDecimal memberProvisionRate2
    BigDecimal memberProvisionRate1Limit
    Boolean memberCannotOverride
    String memberFeeItemNumber
    BigDecimal memberFeeQuantity
    String memberSettlementEmailCopy
    String memberAdminUser

    String toString() {
        "${name}${customerNumber ? ' (Knr ' + customerNumber + ')' : ''}${supplierNumber ? ' (Levnr ' + supplierNumber + ')' : ''}" +
                "${memberNumber ? ' (Medlemnr ' + memberNumber + ')' : ''}"
    }

}

// Invoicing methods
class PrprInvoicingMethod {
    static final String PAPER =             '1. Papir / Paper'
    static final String EMAIL =             '2. Epost / email'
    static final String EHF =               '3. Ehf'
    static final String SETTLEMENT =        '4. Avregning / Settlement'

    static final String[] METHODS = [PAPER, EMAIL, EHF, SETTLEMENT]
}
//
class TransportKeys {

    static final String DEFAULT =       '0. Standard / Default'
    static final String SUM_ONLY =      '1. Kun sum / Sum only'
    static final String DETAIL =        '2. Detaljert / Detailed'
    static final String GROUPED =       '3. Gruppert / Grouped'

    static final String NONE =          '1. Ingen / None'
    static final String PER_MACHINE =   '2. Pr maskin bil / Per machine truck'
    static final String PER_DRIVER =    '3. Pr fører / Per driver'

    static final String[] INVOICE_DETAILS = [DEFAULT, SUM_ONLY, DETAIL, GROUPED]
    static final String[] INVOICE_SPLIT = [DEFAULT, NONE, PER_MACHINE, PER_DRIVER]

}

padmin api - contactPerson

Endpoint Funksjon Adgangskontroll Eksempel Respons
contactPerson/indexForParent/id get all contactPersons for given parent id. Return as json array. HAS_PADMIN_READ_BASE_CONFIGURATION /api/contactPerson/indexForParent/123 OK / 200 eller NO_CONTENT / 204
contactPerson/show/id Get contact person with id. HAS_PADMIN_READ_BASE_CONFIGURATION /api/contactPerson/show/123 OK / 200 eller NO_CONTENT / 204
contactPerson/save/contactPerson as json Store contact company id in contactCompany. POST save contact person, return status ok and newly saved contact person. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/address/save/ OK / 200 eller NO_CONTENT / 204
contactPerson/update/address as json PUT update contact person, return status ok and updated contact person. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/contactPerson/update/ OK / 200 eller NO_CONTENT / 204
contactPerson/delete/id Delete contact person with id. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/contactPerson/delete/123 OK / 200 eller NOT_FOUND / 403

Contact person domain class:

class ContactPerson implements MultiTenant<ContactPerson> {
    static constraints = {
        name nullable: false, blank: false, maxSize: 64
        title nullable: true, maxSize: 64
        contactDetails nullable: true
        status nullable: true, maxSize: 2
    }

    static embedded = ['contactDetails']

    static belongsTo = [contactCompany: ContactCompany]

    static mapping = {
        sort 'name'
    }

    String name
    String title
    ContactDetails contactDetails
    String status
}

padmin api - project

Endpoint Funksjon Adgangskontroll Eksempel Respons
project/index get all projects. Return as json array. HAS_PADMIN_READ_BASE_PROJECT /project/index OK / 200 eller NO_CONTENT / 204
project/show/id Get project with id. HAS_PADMIN_READ_BASE_PROJECT /project/show/123 OK / 200 eller NO_CONTENT / 204
project/findByProjectNumber/?projectNumber=123 Get project with given projectNumber. HAS_PADMIN_READ_BASE_PROJECT /project/findByProjectNumber/?projectNumber=123 OK / 200 eller NO_CONTENT / 204
project/save/project as json POST save project, return status ok and newly saved contact person. HAS_PADMIN_WRITE_BASE_PROJECT /api/project/save/ OK / 200 eller NO_CONTENT / 204
contactPerson/update/address as json PUT update contact person, return status ok and updated contact person. HAS_PADMIN_WRITE_BASE_PROJECT /api/project/update/ OK / 200 eller NO_CONTENT / 204
contactPerson/delete/id Delete contact person with id. HAS_PADMIN_WRITE_BASE_PROJECT /api/project/delete/123 OK / 200 eller NOT_FOUND / 403

Contact person domain class:

class Project implements MultiTenant<Project> {

    static constraints = {
        projectNumber unique: true, nullable: true
        name nullable: false, blank: false
        status nullable: true, maxSize: 2
        customerNumber nullable: true
        subProjects nullable: true, widget: 'textarea', sqlType: 'varchar'
        projectManager nullable: true, maxSize: 64
        department nullable: true
        contactPerson nullable: true
        deviationContactPerson nullable: true
        fireProtectionContactPerson nullable: true
        checkListContactPerson nullable: true
        projectType nullable: true, maxSize: 64
        customerRef nullable: true, maxSize: 64
        customerAccountingString nullable: true, maxSize: 64
        invoicingRef nullable: true, maxSize: 64
        projectRef nullable: true, maxSize: 32
        discount nullable: true
        fireProtectionBuildingParts nullable: true, sqlType: 'varchar', widget: 'textarea'
        deliveryMethod nullable: true, maxSize: 64
        deliveryTerms nullable: true, maxSize: 64
        supplierOfferNumber nullable: true, maxSize: 32
        supplierOrderNumber nullable: true, maxSize: 32
        dateCreated nullable: true, sqlType: 'date'
        projectStartDate nullable: true, sqlType: 'date'
        projectEndDate nullable: true, sqlType: 'date'
        paymentTerms nullable: true, maxSize: 64
        progress nullable: true
        finalLineupApproved nullable: true
        transportProvision nullable: true
        includeAdditionalCalculation nullable: true
        hasNotInvoicedHours nullable: true
        isInvoicingSetup nullable: true
    }
    static mapping = {
        sort 'projectNumber'
        contactPerson lazy: false
        deviationContactPerson lazy: false
        fireProtectionContactPerson lazy: false
        checkListContactPerson lazy: false
    }

    Long projectNumber
    String name
    String status
    Long customerNumber
    String subProjects
    String projectManager
    String department
    String projectType
    String customerRef
    String customerAccountingString
    String invoicingRef
    String projectRef       // bestillingsreferanse
    BigDecimal discount
    String fireProtectionBuildingParts
    String deliveryMethod
    String deliveryTerms
    String supplierOfferNumber
    String supplierOrderNumber
    Date dateCreated
    Date projectStartDate
    Date projectEndDate
    String paymentTerms
    BigDecimal progress                             // skal på kalkylefane
    Boolean finalLineupApproved                     // skal på sluttoppstilling
    BigDecimal transportProvision
    Boolean includeAdditionalCalculation            // skal på kalkyle
    ContactPerson contactPerson
    ContactPerson deviationContactPerson
    ContactPerson fireProtectionContactPerson
    ContactPerson checkListContactPerson
    Boolean hasNotInvoicedHours
    Boolean isInvoicingSetup

    String toString() {
        "${projectNumber ? projectNumber + ' - ' : ''}${name}"
    }

}

padmin api - projectLookup

Endpoint Funksjon Adgangskontroll Eksempel Respons
projectLookup/getSubProjects get all sub-projects for given project. Return as json array. Takes projectNumber as param. return empty list when projectNumber is not set, or no sub-projects found. HAS_ANY_PADMIN_OR_QR_ACCESS /projectLookup/getSubProjects/?projectNumber=123 OK / 200 eller NO_CONTENT / 204

[

 {
   "subProject": "Sykemelding"
 },
 {
   "subProject": "Egenmelding"
 }

]

projectLookup/getProjectsAsList get all or customer projects. Takes customerNumber as param. If customerNumber is not set, then all projects will be returned, or else all projects for given customerNumber. Return as json array. HAS_ANY_PADMIN_OR_QR_ACCESS
/projectLookup/getProjectsAsList/?customerNumber=123
 /projectLookup/getProjectsAsList/?customerNumber=
/projectLookup/getProjectsAsList/?customerNumber=-
/projectLookup/getProjectsAsList
OK / 200 eller NO_CONTENT / 204

[

 "100 - Sykefravær|100",
 "1000 - Fast Innredning|1000"

]

padmin api - salaryItemType

Endpoint Funksjon Adgangskontroll Eksempel Respons
salaryItemType/index get all salary item types. Return as json array. HAS_PADMIN_READ_BASE_CONFIGURATION /api/salaryItemType/index OK / 200 eller NO_CONTENT / 204
salaryItemType/show/id Get salaryItemType with id. HAS_PADMIN_READ_BASE_CONFIGURATION /api/salaryItemType/show/123 OK / 200 eller NO_CONTENT / 204
salaryItemType/findByItemType/?itemType=123 Get Salary item type with given item type. HAS_PADMIN_READ_BASE_CONFIGURATION /project/findByItemType/?itemType=123 OK / 200 eller NO_CONTENT / 204
salaryItemType/save/salaryItemType as json POST save salaryItemType, return status ok and newly saved salaryItemType. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/salaryItemType/save/ OK / 200 eller NO_CONTENT / 204
salaryItemType/update/salaryItemType as json PUT update salaryItemType, return status ok and updated salaryItemType. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/salaryItemType/update/ OK / 200 eller NO_CONTENT / 204
contactPerson/delete/id Delete contact person with id. HAS_PADMIN_WRITE_BASE_CONFIGURATION /api/salaryItemType/delete/123 OK / 200 eller NOT_FOUND / 403

Salary item type domain class:

class SalaryItemType implements MultiTenant<SalaryItemType> {

    static constraints = {
        itemType nullable: false, unique: true, maxSize: 10
        description nullable: false, maxSize: 128
        itemSubType nullable: true, maxSize: 64
        rate nullable: true
        cost nullable: true
        costGroup nullable: true, maxSize: 32
        isHour nullable: false
        convertToItemType1 nullable: true, maxSize: 10
        convertToItemType2 nullable: true, maxSize: 10
        convertToItemType3 nullable: true, maxSize: 10
        convertPct1 nullable: true
        convertPct2 nullable: true
        convertPct3 nullable: true
        isPeaceWork nullable: true
        unit nullable: true, maxSize: 10
        account nullable: true, maxSize: 4
        transferType nullable: false, maxSize: 64
    }

    static mapping = {
        sort itemType: 'inc'
    }

    String itemType // number
    String description
    String itemSubType  // salary, cost, travel
    BigDecimal rate // sats
    BigDecimal cost // cost pr unit
    String costGroup // from calculus
    Boolean isHour
    String convertToItemType1  // convert to this itemType for transferral to salary system
    String convertToItemType2  // convert to this itemType for transferral to salary system
    String convertToItemType3  // convert to this itemType for transferral to salary system
    BigDecimal convertPct1      // percentage for item 1 - must divide by 100
    BigDecimal convertPct2      // percentage for item 1 - must divide by 100
    BigDecimal convertPct3      // percentage for item 1 - must divide by 100
    Boolean isPeaceWork // akkord
    String unit
    String account
    String transferType
}

padmin api - payrollRecord

Endpoint Funksjon Adgangskontroll Eksempel Respons
payrollRecord/index get all payroll records. Return as json array. ROLE_HOURS_PAYROLL /payrollRecord/index OK / 200
payrollRecord/updatedSince get all payroll records that have been updated since .... Return as json array. Where param lastUpdated is in rest date-time format ROLE_HOURS_PAYROLL /payrollRecord/updatedSince/?lastUpdated=2023-01-01T00:00:00Z OK / 200 or BAD_REQUEST / 400 (bad date format in lastUpdated), or NOT_FOUND / 403 (no lastUpdated set)
payrollRecord/show/id Get payrollRecord with id. HAS_PADMIN_READ_BASE_CONFIGURATION /payrollRecord/show/123 OK / 200
payrollRecord/save/payrollRecord as json POST save payrollRecord, return status ok and newly saved payrollRecord. ROLE_HOURS_PAYROLL /payrollRecord/save/ OK / 200
payrollRecord/update/payrollRecord as json PUT update payrollRecord, return status ok and updated payrollRecord. ROLE_HOURS_PAYROLL /payrollRecord/update/ OK / 200

Salary item type domain class:

class PayrollRecord implements MultiTenant<PayrollRecord> {
    static belongsTo = [employee: Employee]

    static constraints = {
        lastUpdated nullable: true, sqlType: 'timestamptz'
        employeeNumber nullable: true
        payrollNumber nullable: true
        salaryItemType nullable: false, maxSize: 10
        salaryItemTypeDescription nullable: true, maxSize: 64
        projectNumber nullable: true
        subProject nullable: true
        payrollRecordDate nullable: false
        quantity nullable: false
        rate nullable: false
        amount nullable: false
        status maxSize: 2
    }
    static mapping = {
        sort payrollRecordDate: 'desc', employee: 'asc'
    }
    Date lastUpdated
    Long payrollNumber
    String salaryItemType               // lønnsart
    String salaryItemTypeDescription    // lønnsart beskrivelse / tekst
    Long projectNumber
    String subProject
    Long employeeNumber

    Date payrollRecordDate
    BigDecimal quantity
    BigDecimal rate
    BigDecimal amount
    String status
}
PS! amount will be calculated = rate * quantity

Example payrollRecord

{
    "id": 502743538825024,
    "projectNumber": 1000,
    "subProject": "a",
    "payrollRecordDate": "2023-11-20T23:00:00Z",
    "lastUpdated": "2023-11-21T13:31:22Z",
    "salaryItemType": "10",
    "quantity": 1,
    "rate": 100,
    "status": "01",
    "payrollNumber": null,
    "amount": 100,
    "salaryItemTypeDescription": "Bastillegg",
    "employee": {
      "id": 488568277239616
    }
  }

Common record definitions

ContactDetails

class ContactDetails implements Validateable {

    static constraints = {
        phone nullable: true, size: 0..15
        cellPhone nullable: true, size: 0..15
        email nullable: true, email: true, size: 0..64
    }
    String phone
    String cellPhone
    String email

}