Page 1 of 3

Updating Rest Service

Posted: Wed Jan 02, 2013 11:12 am
by Joe Bohen

Hi,
Do you have an article on updating tiggzi restservice table values. The service will need to include a where clause, I have attempted to construct a restservice to do this but I have not been successful I get an undefined error. My service is set up as:

Image

Test
Image


Updating Rest Service

Posted: Wed Jan 02, 2013 11:43 am
by Maryna Brodina

Updating Rest Service

Posted: Wed Jan 02, 2013 12:41 pm
by Joe Bohen

Hi Marina,

Do you mean that the service should be queried using code rather than mapping via the interface.

Regards,
Joe


Updating Rest Service

Posted: Wed Jan 02, 2013 12:59 pm
by Maryna Brodina

If you are trying to update several values in your DB while one request - it's not possible because Tiggzi DB doesn't support operations like that. You can only change one value while one request.


Updating Rest Service

Posted: Wed Jan 02, 2013 1:17 pm
by Joe Bohen

No I am only want to update one record at a time! Can this be achieved by mapping or does custom JavaScript need to be written?


Updating Rest Service

Posted: Wed Jan 02, 2013 1:28 pm
by Maryna Brodina

Then you would need to add DataBase service to make an update in DB. Using mapping to this RestService you can update record in DB


Updating Rest Service

Posted: Wed Jan 02, 2013 1:55 pm
by Joe Bohen

Sorry about the confusion but that was the point of my question I have attempted to define the service as in the screen shots but I get and error can you please advice me on where I should define the fields to be updated and how to pass the values.


Updating Rest Service

Posted: Wed Jan 02, 2013 2:37 pm
by Joe Bohen

Hi Marina,

In my original example I have defined the service using the method as 'put' and added two parameters to the service 'status' and 'where' this creates an error can you show me the correct way to map this service.

I want to update the status field to a new value where the jobnum field is a given value.

Regards,
Joe


Updating Rest Service

Posted: Wed Jan 02, 2013 2:52 pm
by Maryna Brodina

1) You have incorrect service URL. It should be https://api.tiggzi.com/rest/1/db/coll... (object_id is a request parameter).
2) Also you don't have "X-Tiggzi-Session-Token" parameter.
3) As a parameter of the Rest Service should be the object property (in your service it should be status, jobnum).

To search some records in DB using where parameter you would need to use another request.

You can try to create correct update service just using "Create new" -"Database Services" (check update)


Updating Rest Service

Posted: Wed Jan 02, 2013 4:55 pm
by Joe Bohen

Sorry Marina I am having problems following your advice, if I build the service and provide the url as the example:
]https://api.tiggzi.com/rest/1/db/coll...

and append my object ID to replace the [object id] and make:
https://api.tiggzi.com/rest/1/db/coll...

and if I test I get a successful response! But If I want to make the request dynamic and update the status field how would I map this, I have the object ID saved as a local storage variable called ‘objectid’ Where do I map the parameters including the {"inputParameters":""} which I suspect are point 3 in your last comment.