I'm trying to use DataMiner API to create a job via HTTP. I'm using Postman to test this.
After running the ConnectApp call, I'm trying to use the CreatJob call. I'm sending the following body in the HTTP Post:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CreateJob xmlns="http://www.skyline.be/api/v1">
<connection>{{connection}}</connection>
<domainID>5ea15997-7995-41db-926c-624d4bf5ca8e</domainID>
<job>
<ID>bc5f2b9a-85d6-4017-865f-d8e4456bdb2d</ID>
<Name>{{job-name}}</Name>
<TimeStartUTC>{{start-time}}</TimeStartUTC>
<TimeEndUTC>{{end-time}}</TimeEndUTC>
<Sections>
<DMAJobSection>
<ID>8724a340-6157-4b06-979d-57f9e4b411ab</ID>
<SectionDefinitionID>8724a340-6157-4b06-979d-57f9e4b411ab</SectionDefinitionID>
<Name>DefaultSectionDefinitionExtension</Name>
<Type>string</Type>
<Fields xsi:nil="true">
</Fields>/>
</DMAJobSection>
</Sections>
</job>
</CreateJob>
</soap12:Body>
</soap12:Envelope>
And for this, I'm getting the following response:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Skyline.DataMiner.Web.Common.WebApiException: The default job section is required.
at Skyline.DataMiner.Web.Common.v1.JobsModule.ExecuteCRUDAction[T](CRUDAction`1 action)
at Skyline.DataMiner.Web.Common.v1.JobsModule.CreateJob(String connection, DMAJob jobNew)
at Skyline.DataMiner.Web.v1.Json.<>c__DisplayClass388_0.<CreateJob>b__0()
at Skyline.DataMiner.Web.WAF.Engine.ValidateAndRun[T](String connection, Func`1 function, String interfaceName, String methodName, String[] argumentNames, Object[] argumentValues)
at Skyline.DataMiner.Web.v1.Json.CreateJob(String connection, String domainID, DMAJob job)
--- End of inner exception stack trace ---
I thought that the default job section data (job name, start and end time) were valid (bc5f2b9a-85d6-4017-865f-d8e4456bdb2d is the GUID from the default job section).
Can someone shed some light how to proceed?
Additionally, I couldn't find in DataMiner help information about the Fields tag, so I not sure how to pass a field value to DatMiner.
EDIT:
After trying Wale's approach, I'm having another error: "bruno test-postman is missing some sections that are defined on the job domain."
I think my three sections are present in my request, please let me know what I'm missing to have a successful create job call.
HTTP Request body:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CreateJob xmlns="http://www.skyline.be/api/v1">
<connection>{{connection}}</connection>
<domainID>5ea15997-7995-41db-926c-624d4bf5ca8e</domainID>
<job>
<Sections>
<DMAJobSection>
<SectionDefinitionID>bc5f2b9a-85d6-4017-865f-d8e4456bdb2d</SectionDefinitionID>
<Name>DefaultJobSection</Name>
<Fields>
<DMAJobFieldValueDisplay>
<ID>ab725528-df04-4798-ba1b-b9635a47c58b</ID>
<Name>Name</Name>
<Value>{{job-name}}</Value>
<Type>Text</Type>
</DMAJobFieldValueDisplay>
<DMAJobFieldValueDisplay>
<ID>e47a1a1d-abf7-4572-b05e-80976e81b8d6</ID>
<Name>Start Time</Name>
<Value>{{start-time}}</Value>
<Type>DateTime</Type>
</DMAJobFieldValueDisplay>
<DMAJobFieldValueDisplay>
<ID>daf59475-c03d-480d-8aef-23fc43c4a247</ID>
<Name>End Time</Name>
<Value>{{end-time}}</Value>
<Type>DateTime</Type>
</DMAJobFieldValueDisplay>
</Fields>
</DMAJobSection>
<DMAJobSection>
<ID>8724a340-6157-4b06-979d-57f9e4b411ab</ID>
<SectionDefinitionID>8724a340-6157-4b06-979d-57f9e4b411ab</SectionDefinitionID>
<Name>DefaultSectionDefinitionExtension</Name>
<Type>string</Type>
<Fields xsi:nil="true">
<DMAJobFieldValueDisplay>
<ID>a7e1a37a-203c-4074-8009-f4d9f12fd5f6</ID>
<Name>FieldDescriptorName: Service Definition Name</Name>
<Value>[MAIN] RF SAT IRD to SDI</Value>
<Type>GenericEnum`1</Type>
</DMAJobFieldValueDisplay>
</Fields>/>
</DMAJobSection>
<DMAJobSection>
<ID>c8c22f36-f436-4f08-8a8c-ff301639e342</ID>
<SectionDefinitionID>c8c22f36-f436-4f08-8a8c-ff301639e342</SectionDefinitionID>
<Name>Bookings</Name>
<Type>string</Type>
<Fields xsi:nil="true">
</Fields>
</DMAJobSection>
</Sections>
</job>
</CreateJob>
</soap12:Body>
</soap12:Envelope>
Section definitions (client test tool screenshot):
I think what you are missing is the location of the default job section. It should be within the <Sections/> tag along with other job sections.
From the WSDL the Fields tag needs the following data.
<v1:Fields>
<!--Zero or more repetitions:-->
<v1:DMAJobFieldValueDisplay>
<!--Optional:-->
<v1:ID>?</v1:ID>
<!--Optional:-->
<v1:Name>?</v1:Name>
<!--Optional:-->
<v1:Value>?</v1:Value>
<!--Optional:-->
<v1:DisplayValue>?</v1:DisplayValue>
<!--Optional:-->
<v1:Type>?</v1:Type>
<v1:IsMultiSelectionFilter>?</v1:IsMultiSelectionFilter>
<v1:ShowInListView>?</v1:ShowInListView>
<v1:IsRequired>?</v1:IsRequired>
<v1:IsHidden>?</v1:IsHidden>
<v1:IsReadOnly>?</v1:IsReadOnly>
<!--Optional:-->
<v1:Tooltip>?</v1:Tooltip>
</v1:DMAJobFieldValueDisplay>
</v1:Fields>
A CreateJob request would then look like this: In this example I have two job sections including the default one.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateJob xmlns="http://www.skyline.be/api/v1">
<connection>4f69f9e6-2f4b-4748-841c-c1d17d9f16a5</connection>
<domainID>b4faaddb-6315-49e2-9e89-524ab8639f73</domainID>
<job>
<Sections>
<DMAJobSection>
<SectionDefinitionID>bc5f2b9a-85d6-4017-865f-d8e4456bdb2d</SectionDefinitionID>
<Name>DefaultJobSection</Name>
<Fields>
<DMAJobFieldValueDisplay>
<ID>ab725528-df04-4798-ba1b-b9635a47c58b</ID>
<Name>Name</Name>
<Value>test 0034</Value>
<Type>Text</Type>
</DMAJobFieldValueDisplay>
<DMAJobFieldValueDisplay>
<ID>e47a1a1d-abf7-4572-b05e-80976e81b8d6</ID>
<Name>Start Time</Name>
<Value>1638464400000</Value>
<Type>DateTime</Type>
</DMAJobFieldValueDisplay>
<DMAJobFieldValueDisplay>
<ID>daf59475-c03d-480d-8aef-23fc43c4a247</ID>
<Name>End Time</Name>
<Value>1638468000000</Value>
<Type>DateTime</Type>
</DMAJobFieldValueDisplay>
</Fields>
</DMAJobSection>
<DMAJobSection>
<SectionDefinitionID>73593384-0d33-49f4-b9de-846695a16898</SectionDefinitionID>
<Name>MAIN</Name>
<Fields>
<DMAJobFieldValueDisplay>
<ID>3e949e84-e453-4032-ba66-cc7d2dc345af</ID>
<Name>Location</Name>
<Value>Lagos</Value>
<Type>Text</Type>
</DMAJobFieldValueDisplay>
</Fields>
</DMAJobSection>
</Sections>
</job>
</CreateJob>
</soap:Body>
</soap:Envelope>
I updated my question with further details.
Just did a quick look, but this type is not correct: “GenericEnum`1”
Instead it should be: “Dropdown”
Thanks Wim but I’m still having the same result after trying with “Dropdown” type.
Hi Wale, thanks for the help.
It indeed cleared the previous error but I’m now having another error:
“bruno test-postman is missing some sections that are defined on the job domain”
My job domain has three sections and they are for sure present in the XML.
The only different one is the Bookings section, as I don’t want to pass any field value so I’m leaving the Fields array empty.