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

Compare with Current View Page History

Version 1 Next »

Method Parameter Matrix

 

GET

PUT/POST/PATCH

GET

GET

GET

GET

GET

U

U or U/{id}

U/{id}

U/count

U/access

U/new

U/describe

sessionId

limit

 

 

 

 

 

 

offset

 

 

 

 

 

 

sort

 

 

 

 

 

 

expandLevel

 

fields

 

 

withCount

 

 

 

 

 

q

 

 

 

 

Notes

U = http://restpath/api/v1.0/<className>

● = Optional parameter

● = Required parameter

● = Optional parameter, valid for returned Json body


Parameters

sessionId

Required for all methods. It is a Guid value returned by the /login.

After a successful login operation, an internal session is created in the web service, with its own securedObjectSpace and SQL transaction pool.

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513

 

limit

Sets the number of records returned by GET operations.

Can be used to support pagination. The maximum number can be 100, default number is 25 if this parameter is omitted.

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&limit=50

http://yourserver/api/v1.0/products?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&offset=0&limit=100

 

offset

Sets the starting point of the records that will be returned by GET operations.

Can be used to support pagination. The default number is 0.

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&limit=50

http://yourserver/api/v1.0/products?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&offset=0&limit=100

 

sort

Sets the order of the records that will be returned by GET operations.

Multiple fields can be used to set the sort order.This parameter must be used with consideration on large databases since setting the sort order will not examine if the field(s) specified are indexed or not, on SQL level. Default sort order is Ascending. When DESC is used with the field name, sort order will be descending.

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&sort=FirmCode,FirmTitle

http://yourserver/api/v1.0/products?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&sort=FirmTitle+DESC, SalesRep.SalesRepPersonInfo.LastName

 

expandLevel

Sets the hierarchy to full or none level, for the returned Json body.

This option is used for nested business objects. Only full and none values are supported by this parameter. Suppose that the business object being queried or returned as a result is like:

{

    FirmCode : string,

    FirmTitle: string,

    SalesRep: CT_SalesRep

}

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&expandLevel=none

Returns:

{

    FirmCode : "000000",

    FirmTitle: "XYZ Company",

}

 

http://yourserver/api/v1.0/products?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&expandLevel=full

Returns:

{

    FirmCode : "000000",

    FirmTitle: "XYZ Company",

    SalesRep: {

        FirstName: "John",

        LastName: "Adams"

    }

}

 

fields

Sets the field(s)/properties of the business object that will be returned in the Json body.

This parameter can be used for returning a partial Json body from the GET methods. Recommended when a certain number of records needed, in order to construct a grid or report in the UI.  

Also, you can include the properties/names of the nested business objects in the list.

For example, if we have two classes like this:

Firm:

{

    FirmCode : string,

    FirmTitle: string,

    SalesRep: CT_SalesRep,

    TaxOffice: string,

    TaxNo: string

}

CT_SalesRep:

{

    FirstName: string,

    LastName:string

}

Usage:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&fields=FirmCode,FirmTitle

Returns:

{

    FirmCode : "000000",

    FirmTitle: "XYZ Company"

}

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&fields=FirmCode,FirmTitle,FirstName

Returns:

{

    FirmCode : "000000",

    FirmTitle: "XYZ Company",

    SalesRep : {

        FirstName: "John"

    }

}

 

 

withCount

Sets if the total number of records will be returned by GET operations, depending on other parameters.

Value of this parameter can be true or false. Please note that the result count value will not be affected by limit parameter, but it will be affected by q parameter.

If set to true, a sample returned Json will look like:

{

  "Result": 1,

  "Message": "",

  "Count": 28,

  "Items": [

    {

      "Oid": "b293a022-3a92-47c1-bb57-76dc57b42369",

      "FirmCode": "0000000000000000",

      .

                  .

                  .

    }

  ]

}

 

If not set, "Count" pair will not be in the Json body.

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513&offset=0&limit=100&withCount=true

q

Sets the query parameters for GET operations, in order to filter the result set.

Since LogoCRM is based on the XAF (eXpressApp Framework) by Developer Express, q parameter will expect a valid Criteria, based on the special Criteria Language Syntax.

For details please visit:

https://documentation.devexpress.com/#CoreLibraries/CustomDocument4928

 

Example:

http://yourserver/api/v1.0/firms?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513 &withCount=true&offset=0&limit=25&q=FirmTitle+Like+'A%'&expandLevel=full&sort=FirmCode

http://yourserver/api/v1.0/products?sessionId=02635e09-03c9-4fb0-af8f-e60cbd749513& q=FirmTitle+Like+'A%'+AND+SalesRep.SalesRepPersonInfo.FirstName='John'

 

Data Updating Methods

PUT

Used to update data. If the object constructed from the input body of the request (Json body) can not be located in the database, an error will be returned.All validation rules will be applied.

Example:

{

  "Result": 0,

  "Message": "(-306) Operation failed. Object can not be located: 2f950d99-0e14-4ed0-a21c-099d51e28b6f"

}

POST

Used to insert data. A successful POST method will return a Json body of the specified business object. Also, expandLevel and fields parameter can be used to decorate the result Json as needed.

PATCH

Used to update partial data. A successful PATCH method will return a Json body of the specified business object. Also, expandLevel and fields parameter can be used to decorate the result Json as needed.

Please note that PATCH method will not set any fields to NULL. Only values will be updated. If you need to set a field/property to NULL, please use PUT  method.

(Notes)

* Oid property exists in all business objects of LogoCRM. It is short for ObjectIdentifier and is uniqueidentifer, auto-generated in SQL databssases. Supplying an existing Oid in the request body of a POST operation will result in error:

{

  "Result": 0,

  "Message": "(-304) Object with the following unique identifier already exists: 2f950d99-0e14-4ed0-a21c-079d51e28b6f"

}

Return Structures