For priority, the value of that gets stored in the call_req table is the enum field.So instead of '@id', you probably have to use '@enum'
Original Message:
Sent: 12-10-2019 07:39 AM
From: Rafael Oliveira
Subject: Which is the pattern of the JSON/XML on CA SDM?
Thank you @Jussi Valkonen and @Brian Mathato for the answers!!!
It helped me a lot to clarify somethings..
I think i'm close to make it works.. i have just a little another question for you..
My json is it:
{
"in": {
"description": "Descrição TEST",
"pcat": { "@ID":"401634" },
"summary": "Sumário de Testes",
"status": { "@REL_ATTR":"OP" },
"customer": {"@id":"U'ID_HERE'"},
"type": {"@REL_ATTR": "I"},
"priority": {
"@id": "505",
"@REL_ATTR": "0",
"@COMMON_NAME": "Nenhuma"
},
"string6": "Cliente web externo",
"z_local": "TJBA COSIS",
"z_alt_phone_number": "(71) 3653-65659",
"zs_email_preferencial": "teste@teste.com",
"zs_oab": "123",
"z_comarca": {"@id":"400002"},
"z_cidade": {"@id":"400002"},
"z_lotacao": {"@id":"402651"}
}
}
So I'm getting a bad request with the message: "Required Priority attribute is missing" but it is in my json.
I tried so many different ways to solve this Priority attribute is missing and nothing until now.
If i took out the "customer" attribute the message is:
com.ca.sdm.dal.PersistenceException: INVALID: z_cr_sla.spl: 69:cr: :z_cr_sla
Thank you for all!
Original Message:
Sent: 12-10-2019 02:17 AM
From: Jussi Valkonen
Subject: Which is the pattern of the JSON/XML on CA SDM?
There's a couple of issues with your JSON payload:
- Remove the ID, COMMON_NAME and REL_ATTR fields, you don't get to choose them when you create a ticket
- Enter all REL fields as embedded objects in the JSON structure. I'm not 100% sure if they strictly MUST to be like that but I know it works so give it a go. See the example below.
- Remove the customer fields like Brian suggested, you can't set them when creating a ticket
{ "in": { "description": "Descrição TESTE REST", "pcat": { "@ID":"401634" }, "summary": "Sumário via REST", "status": { "@REL_ATTR": "OP" }, "customer": { "@ID": "{ID HERE}" }, ... }}
Postman shouldn't need any specific configuration, all you need to do is to do the login with basic auth, extract the access key and id (for logout time) from it and then send the access key with the X-AccessKey header. Once you're done, call the DELETE /rest_access/<access_id> to logout. Just be aware that the internal logout implementation has a bug and it requires admin function access to work, otherwise you'll just have to leave the sessions hanging.
Original Message:
Sent: 12-09-2019 06:51 AM
From: Rafael Oliveira
Subject: Which is the pattern of the JSON/XML on CA SDM?
Hey guys. How are you?
I'm facing problems with the pattern of the JSON when I try to create a new ticket..
What i'm doing:
POST -> http://{host}/caisd-rest/in
with this json:
{
"in": {
"@id": "U' {ID HERE}'",
"@REL_ATTR": "U'{ID HERE}'",
"@COMMON_NAME": "WEB",
"description": "Descrição TESTE REST",
"pcat": "401634",
"summary": "Sumário via REST",
"status": "OP",
"customer": "U'{ID HERE}'",
"type": "I",
"priority": "3",
"string6": "Cliente web externo",
"z_local": "TJBA COSIS",
"email_address": "teste1@tes.com",
"customer.phone_number": "(75) 98933-6968",
"z_alt_phone_number": "(71) 65665-6969",
"zs_email_preferencial": "teste2@teste.com",
"zs_oab": "985",
"z_comarca": "400003",
"z_cidade": "400003",
"z_lotacao": "402981"
}
}
I tried to do this with the XML and i'm getting the same 400 bad request
<in>
<customer id="U'{ID HERE}'" REL_ATTR="U'{ID HERE}'" COMMON_NAME="WEB_EXTERNO"/>
<category id="U'{ID HERE}'" REL_ATTR="U'{ID HERE}'" COMMON_NAME="WEB_EXTERNO">401634</category>
<customer.phone_number>(75) 3433-6968</customer.phone_number>
<description>Descrição TESTE REST XML</description>
<email_address>teste1@tes.com</email_address>
<log_agent id="U'{ID HERE}'" REL_ATTR="U'{ID HERE}'" COMMON_NAME="WEB_EXTERNO"/>
<priority>0</priority>
<status>OP</status>
<string6>Cliente web externo</string6>
<summary>Sumário de Testes</summary>
<type>I</type>
<z_alt_phone_number>(71) 3433-6969</z_alt_phone_number>
<z_cidade>400002</z_cidade>
<z_comarca>400002</z_comarca>
<z_local>TJBA COSIS</z_local>
<z_lotacao>402651</z_lotacao>
<zs_email_preferencial>teste2@teste.com</zs_email_preferencial>
<zs_oab>123</zs_oab>
</in>
I'm getting '400 bad request' code. Is there something that am I missing? Obs: I'm using POSTMAN to request. Is there some configuration on POSTMAN to make this work?
Thank you for all!