POST new job

Posts about the simPRO API. Help/support/how-to etc.
Forum rules
  • Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
  • No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
  • Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
  • Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
  • Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
  • Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
  • Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
  • Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
Post Reply
Dazwah
Posts: 9
Joined: Wed Mar 29, 2023 10:18 pm

POST new job

Post by Dazwah » Mon Apr 03, 2023 10:12 am

Hello,

I have a few questions for when I post a new job;

POST /api/v1.0/companies/{companyID}/jobs/

The api doc states that "technicians" should be an integer, should it be an array of integers?
Also, how do I set a custom field in the same payload?

Last question is, how do I link a cost centre to the associated job? Does that have to be done after a job is created?
BlessingLinys
Posts: 1
Joined: Mon Apr 03, 2023 11:01 am

Re: POST new job

Post by BlessingLinys » Mon Apr 03, 2023 11:04 am

The "technicians" field should be an array of integers, even though the API documentation states it as an integer. You can provide an array of technician IDs to this field.

To set a custom field in the same payload, you can include it as a key-value pair in the payload data. For example, if the custom field is named "custom_field", you can include it like this:

{
"title": "Job Title",
"description": "Job Description",
"technicians": [1, 2, 3],
"custom_field": "Custom Field Value"
}

To link a cost centre to the associated job, you can provide the cost centre ID as a field in the payload data. For example:
{
"title": "Job Title",
"description": "Job Description",
"technicians": [1, 2, 3],
"cost_center": 12345
}

This will link the job to the cost centre with ID 12345. This can be done while creating the job itself, and does not need to be done after the job is created.
Dazwah
Posts: 9
Joined: Wed Mar 29, 2023 10:18 pm

Re: POST new job

Post by Dazwah » Mon Apr 03, 2023 10:17 pm

Thank you. Do you know where the cost centre is in the API? Want to know if its cost_center, cost_centre, costCentre.

With the custom field, is it purely based on the name of the custom field? I can see they have IDs
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: POST new job

Post by Sindre » Tue Apr 04, 2023 10:50 pm

Hi Dazwah,
For the setup of the actual cost centers, please see this link:
https://developer.simprogroup.com/apido ... st-Centers

For managaing a cost center on a job please see this link:
https://developer.simprogroup.com/apido ... 0b4eb3c8db

Regards
Sindre
API Developer | Simpro Software Group
Dazwah
Posts: 9
Joined: Wed Mar 29, 2023 10:18 pm

Re: POST new job

Post by Dazwah » Tue Apr 04, 2023 11:55 pm

Hi Sindre,

What I mean is, I cannot find in the "job" (api /api/v1.0/companies/{companyID}/jobs/)
where anything mentions cost_center, just wondering if its hidden elsewhere in the API documentation.

Im also trying to add attachments, can this just be done like the following?

{
"title": "Job Title",
"description": "Job Description",
"technicians": [1, 2, 3],
"cost_center": 12345,
"attachment":{
"file":{
"Filename":"myfilename.doc",
"Base64Data" :"mydata..."
}
}
}
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: POST new job

Post by Sindre » Wed Apr 05, 2023 12:42 am

Hi,
The cost centre info is in a nested structure under jobs, sections and cost centre.

You can use the parameter ?display=all on a job to see more details. ]

Code: Select all

api/v1.0/companies/0/jobs/{jobID}?display=all
Read more on subresources here:
https://developer.simprogroup.com/apido ... place-data

To get an overview of cost centres you can also use this endpoint which has a link to the nested structure:

Code: Select all

/api/v1.0/companies/{companyID}/jobCostCenters/
Regards
Sindre
API Developer | Simpro Software Group
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: POST new job

Post by Sindre » Wed Apr 05, 2023 4:48 am

The attachments will have to be added on the job level and not sections/cost centres.
https://developer.simprogroup.com/apido ... 6ee72946b0
Sindre
API Developer | Simpro Software Group
Dazwah
Posts: 9
Joined: Wed Mar 29, 2023 10:18 pm

Re: POST new job

Post by Dazwah » Wed Apr 05, 2023 4:59 am

To set a custom field in the same payload, you can include it as a key-value pair in the payload data. For example, if the custom field is named "custom_field", you can include it like this:

{
"title": "Job Title",
"description": "Job Description",
"technicians": [1, 2, 3],
"custom_field": "Custom Field Value"
}

Can you please verify that this is the correct way to set a custom field in the payload?
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: POST new job

Post by Sindre » Wed Apr 05, 2023 6:07 am

Hi,
Custom fields don't support POST request so I don't think you can add it like described.

You need to know the ID of the custom field you want to patch. So follow this endpoint:
https://developer.simprogroup.com/apido ... f9d625d754

Code: Select all

/api/v1.0/companies/{companyID}/jobs/{jobID}/customFields/{customFieldID}
Regards
Sindre
API Developer | Simpro Software Group
Post Reply