REST How To
How to add a vine object
Use POST to create an object in the database:
Request type: POST
Request: https://vine.eu/api/rest/2.0/vy_resource
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
Content-Type: application/x-www-form-urlencoded
Body:
NAME:Test Resource
DESCRIPTION:created with Vine Rest
RESOURCETYPE:-2
Returned: ID of the new object
1300350119
How to update a vine object
Use PUT to update an object in the database:
Request type:PUT
Request: https://vine.eu/api/rest/2.0/vy_resource(1300350033)
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
Content-Type: application/x-www-form-urlencoded
Body:
DESCRIPTION:xmldata field added with rest
XMLDATA:<ROOT><SOME>xmldata</SOME></ROOT>
How to delete a vine object
Use DELETE to remove an object from the database:
Request type:DELETE
Request: https://vine.eu/api/rest/2.0/vy_resource(1300350033)
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
How to create a connection between objects
Use POST to create a connection in the database.
For example to connect a person(vy_person object type) to an event(vy_event object type) as attendee(connection type=3):
Request type: POST
Request: https://vine.eu/api/rest/2.0/vy_connection
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
Content-Type: application/x-www-form-urlencoded
Body:
CONNECTIONTYPE:3
FROMOBJECTID:1300350130
FROMOBJECTTYPE:VY_EVENT
STATUS:B
TARGETOBJECTID:300001061
TARGETOBJECTTYPE:VY_PERSON
Returned: ID of new connection
1100845919
How to delete a connection
Use DELETE to remove a connection between vine objects in the database:
Request type:DELETE
Request: https://vine.eu/api/rest/2.0/vy_connection(1100845919)
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
How to get a list of objects
Get all events I am responsible for that start in the future:
/user/4(startdate>[$now])
Get all events I am responsible for that start in the future and which are in a collection set by a system setting:
/user/4(startdate>[$now] and FilterConnection(319,GetSetting('vx_telephone_call'),0) )
How to search objects by name and filter results by object type
There is a possibility to run SQL commands from the vy_clientsql table using the EXECUTE request (
clientSQL parameters should be prefixed with '$'
).
Normally, you would only need to call the SEARCHEX command this way to search objects by name:
/EXECUTE/SEARCHEX?$objectType=VY_PERSON&$name=jan
How to get only events (for invitation) which are in the future
You need the vx_regEvents_collection system setting which points to collection with events for invitation and then use [$now] as SYSDATE
/vy_collection(id=GetSetting('vx_regEvents_collection'))/319(startdate>=[$now])
How to get field length/type in database
REST assumes that there is ID field in a database query result. If not, you should manually set it using the idField parameter:
/vy_table_field?idField=OOFID&order=id
How to add a document
1. You need to create a document object
Use POST to create a document object in the database:
Request type: POST
Request: https://vine.eu/api/rest/2.0/vy_document
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
Content-Type: application/x-www-form-urlencoded
Body:
name:Test doc
documenttype:-10
keepoldversions:1
documentphase:1
savetoserver:1
description:created with Vine Rest
resourcetype:-2
Returned: ID of the new document object
1300350978
2. You need to add a data file for the document.
Request type: POST
Request: https://vine.eu/api/rest/2.0/vy_document_version
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
Content-Type: application/x-www-form-urlencoded
Body:
DOCUMENTID:1300350978
FILEDATA: base64 encoded file data
VERSIONID will be set automatically.
How to modify a document
You need to add a data file for the document.
Request type: POST
Request: https://vine.eu/api/rest/2.0/vy_document_version
Request header:
Accept: application/json
Authorization: Basic bGlzYTpkZW1v
Content-Type: application/x-www-form-urlencoded
Body:
DOCUMENTID:1300350978
FILEDATA: base64 encoded file data
Please note that in this case it is important to use all capital letters for the DOCUMENTID parameter name. (Otherwise, you might receive "ORA-00001: unique constraint (VINEYARDDB.PK_VY_DOCUMENT_VERSION) violated" error.)
How to get document data
/vy_document_version(1300350978)?top=1&order=versionid desc&showspecial
How to access lead data
Accessing a specific lead using lead ID
https://vine.eu/api/rest/2.0/vs_lead(324088468)
Getting all leads
https://vine.eu/api/rest/2.0/vs_lead
Getting leads in the "Contract" (id=-90) phase
https://vine.eu/api/rest/2.0/vs_lead(phase=-90)
Comments
0 comments
Please sign in to leave a comment.