Post

2 followers Follow
0
Avatar

Submit Data to Data Object through Custom Page API

I'd like to submit data to a Data Object related to a Work Item through a form on a custom Page.

What would be the API function I need and the format of the data query string? Is it possible to Create, Update and Delete a Data object through the API?

How best would I do it on bulk?

Thanks

Darren Answered

Please sign in to leave a comment.

1 comment

1
Avatar

Hi,

You can make full use of the REST API through the Javascript wrapper exposed to the custom panels and custom pages. As far as I know it is not documented and it's a bit complicated to learn how to use it. I learnt how to use it just by getting the "customPanelApi.js" file and going through it. With this wrapper you can basically do all these operations for updating, creating, deleting, querying and so on. You can access all these methods from the API.objects namespace.

As for bulk calls, as far as I know this API operation is not wrapped in the Javascript API, so you would need to directly execute POST calls to the Bulk endpoint. The Bulk service is documented here:

https://success.clarizen.com/hc/en-us/articles/205711828-16-13-REST-API-Guide-Version-2#Bulk

A simple method to call this could be:

function executeBulkOperation(url, body, method, callback) {
var bulkPayload = {
requests: [
{
url: url,
method: method,
body: body
}
]
};
API.server.post("/bulk/execute", bulkPayload, callback);
}

This is just for a single operation, but it's fairly possible to extend it to get an array of operations containing URL, method and body and build the "requests" object from it.

Regards.

Fernando Borrego Polo 1 vote
Comment actions Permalink