Post

3 followers Follow
0
Avatar

Working sample request for metadata/object PUT

Data service type methods and authentication are working just fine. But in the metadata/objects

I got a:

"errorCode": "InvalidType"
"message": "Invalid type name ''.",[\r][\n]"
"referenceId": "3cZjTYqebsqlWQr2MyoZJH"[\r][\n]"

Can you give me of a sample request body to make this work? Currently, this is my junit test to the connector

ClarizenConnector.clarizenObjectsMetadataPut( alias, new ObjectsMetadataRequest([
forType : 'WorkItem',
name : 'Worka',
description : 'this rule is awesome',
triggerType : 'CreateOrEdit',
criteria : '',
action : new Action([
url : '/data/objects/Issue/6rogf9gdi2imf35es99lznp2s0',
method : HttpMethod.POST,
headers : '',
body : '{title: "5"}'
])
]))

Lnabong Answered

Please sign in to leave a comment.

7 comments

0
Avatar

I just want to make some basic and valid request ( like if metadata/objects PUT sample request will be documented in your page) so that i will get a response from a successful request in my JUNit. BTW, I am just making connectors and adapters :)

Lnabong 0 votes
Comment actions Permalink
0
Avatar

Not sure metadata/objects is a good example to use for unit tests. This is a rather complex API which creates workflow with an outbound call when there is a change on an object.

Eyal Post 0 votes
Comment actions Permalink
0
Avatar

Ok, so in my case, why does it gives me an "errorCode": "InvalidType"?

Lnabong 0 votes
Comment actions Permalink
1
Avatar

Hi Lnabong,
Our log shows the request details (e.g.: forType, name etc. ) did not make it to the server (the request body was empty). I couldn't figure out what platform you were using, but there may be an issue with the way you construct or send the message. I suggest you verify that with a tool like Fiddler.
If the request is sent as expected, please post another, and specify some more details about the platform you're using.
Hope this helps,
Ophir

Ophir Kenig 1 vote
Comment actions Permalink
0
Avatar

Hi,

even a simple
{
"forType" : "WorkItem"
}

throws the same error, ("referenceId": "1owk8mIrd7JVm7bpm3iArr"). Means, my request is still empty? this should throw an error like "missing this kind of field" (name or description or triggertype etc. is required) right? I am just referring to https://api.clarizen.com/V2.0/services/metadata/objects. With this request, I just used postman

Lnabong 0 votes
Comment actions Permalink
2
Avatar

This is the simplest request that will create this workflow rule:
Some notes:
1. the Url should be ../metadata/object/Workflow
2. You get a return value from this call. I suggest to make sure to delete the created Workflow using the DELETE method since it will leave hanging workflows in your account and there's a limit to how many of these you can create.

{
"forType": "WorkItem",
"name": "My Rule",
"triggerType": "CreateOrEdit",
"criteria": "False",
"action": {
"Url": "http://www.example.org/WebHook",
"method": "POST"
}
}

Eyal Post 2 votes
Comment actions Permalink