I am missing the eureka-moment about API...
Moderator: crythias
-
- Znuny newbie
- Posts: 6
- Joined: 21 Dec 2017, 14:35
- Znuny Version: 5.0.14
- Real Name: Jan Johansson
I am missing the eureka-moment about API...
Hello!
Basically, I just cannot make friends with the api in 5.0.14... I consider myself not to be a developer, nor a proper programmer. But, I usually can make friends with most languages and platform.
Until now
Is there any kind soul that could provide me with a short exemple on how to leverage the API to let me create a gereric agent that created a GA job with the following (from a PERL or Python script running on the same machine as a OTRS install)
On ticket creation in the queue In-queue, with the subject that matches "Lorem Ipsum *" move to this queue and set status to closed successfully".
I am sure that once I see said exampel code I will go "Oh really, that simple? Am i really that daft..." and then go off to do great things with the rest of the API.
So.. Please?
Basically, I just cannot make friends with the api in 5.0.14... I consider myself not to be a developer, nor a proper programmer. But, I usually can make friends with most languages and platform.
Until now
Is there any kind soul that could provide me with a short exemple on how to leverage the API to let me create a gereric agent that created a GA job with the following (from a PERL or Python script running on the same machine as a OTRS install)
On ticket creation in the queue In-queue, with the subject that matches "Lorem Ipsum *" move to this queue and set status to closed successfully".
I am sure that once I see said exampel code I will go "Oh really, that simple? Am i really that daft..." and then go off to do great things with the rest of the API.
So.. Please?
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: I am missing the eureka-moment about API...
Generic agent,
Job Name: Get Eureka
Expand event Based execution (single ticket)
Ticket TicketCreate, click plus (it's now listed)
Expand Select Tickets
Subject: Lorum Ipsum
Expand Update/Add Ticket Attributes
Set new queue: DestinationQueue
Set new state: Closed Successfully
Click Submit
Job Name: Get Eureka
Expand event Based execution (single ticket)
Ticket TicketCreate, click plus (it's now listed)
Expand Select Tickets
Subject: Lorum Ipsum
Expand Update/Add Ticket Attributes
Set new queue: DestinationQueue
Set new state: Closed Successfully
Click Submit
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny newbie
- Posts: 6
- Joined: 21 Dec 2017, 14:35
- Znuny Version: 5.0.14
- Real Name: Jan Johansson
Re: I am missing the eureka-moment about API...
Oh, ive Done that about 300 times in the current system, which is why I want to leverage the API to do this automatically from another system. I apologize if I wasn’t clear , but I did specifically mention API in my original post.crythias wrote:Generic agent,
Job Name: Get Eureka
Expand event Based execution (single ticket)
Ticket TicketCreate, click plus (it's now listed)
Expand Select Tickets
Subject: Lorum Ipsum
Expand Update/Add Ticket Attributes
Set new queue: DestinationQueue
Set new state: Closed Successfully
Click Submit
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: I am missing the eureka-moment about API...
What have you tried? Are you needing to add or run a GenericAgent job or are you trying to do GenericAgent actions?
Which means: if you're trying to change the Queue, then you would use the Queue API.
You might make it somewhat easy by creating a sample generic agent, then
Then you can make a JobAdd with relevant fields
Which means: if you're trying to change the Queue, then you would use the Queue API.
You might make it somewhat easy by creating a sample generic agent, then
Code: Select all
SELECT job_key, job_value FROM generic_agent_jobs WHERE job_name='Get Eureka';
Code: Select all
$GenericAgentObject->JobAdd(
Name => 'Get Eureka Unique Name',
Data => {
JobKeyValue => 'JobValueValue',
...
Valid => 1,
},
UserID => 1,
);
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: I am missing the eureka-moment about API...
if remote systems should do it, use the webservice API
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
-
- Znuny newbie
- Posts: 6
- Joined: 21 Dec 2017, 14:35
- Znuny Version: 5.0.14
- Real Name: Jan Johansson
Re: I am missing the eureka-moment about API...
I want to leverage the api to use it to create a new generic agent in the system to avoid having to do it via the web forms.crythias wrote:What have you tried? Are you needing to add or run a GenericAgent job or are you trying to do GenericAgent actions?
Which means: if you're trying to change the Queue, then you would use the Queue API.
You might make it somewhat easy by creating a sample generic agent, thenThen you can make a JobAdd with relevant fieldsCode: Select all
SELECT job_key, job_value FROM generic_agent_jobs WHERE job_name='Get Eureka';
Code: Select all
$GenericAgentObject->JobAdd( Name => 'Get Eureka Unique Name', Data => { JobKeyValue => 'JobValueValue', ... Valid => 1, }, UserID => 1, );
Re: I am missing the eureka-moment about API...
O don't see here any need to create a generic agent for this
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
-
- Znuny newbie
- Posts: 6
- Joined: 21 Dec 2017, 14:35
- Znuny Version: 5.0.14
- Real Name: Jan Johansson
Re: I am missing the eureka-moment about API...
Let’s for the sake of argument say that I do, and tat the reason ties into the rest of the workflow.jojo wrote:O don't see here any need to create a generic agent for this
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: I am missing the eureka-moment about API...
Please let us know if creating a sample, then applying the key value pairs, according to the docs, isn't working. Any samples you've created would be of interest.
Basically, I suggested making a sample yourself, getting the values from the database, applying to the API, it works.
Basically, I suggested making a sample yourself, getting the values from the database, applying to the API, it works.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: I am missing the eureka-moment about API...
As I still doubt that a Generic Agent is what you need, can you please explain your usecase and workflow
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: I am missing the eureka-moment about API...
I'm with JoJo on this.
To make a GA is easy. It helps if you've done one.
If you're trying to make a bunch of them programmatically, that also is easy. Make one via web, get sample information via SQL, use the API.
But you'd make a bunch of them programmatically, generally, to only handle manual web based entries or, maybe, postmaster entries.
If you're handling postmaster entries, it's better to make and assign a PostMasterFilter.
If you're making a junk filter, ... wait. Why would you manually make a ticket that's automatically going to junk and closed? If you want that, just enable that closed successful as a next state in ticket creation.
If you're making an API that creates tickets that close automatically, you'd create the ticket then use the Queue API or State API.
To make a GA is easy. It helps if you've done one.
If you're trying to make a bunch of them programmatically, that also is easy. Make one via web, get sample information via SQL, use the API.
But you'd make a bunch of them programmatically, generally, to only handle manual web based entries or, maybe, postmaster entries.
If you're handling postmaster entries, it's better to make and assign a PostMasterFilter.
If you're making a junk filter, ... wait. Why would you manually make a ticket that's automatically going to junk and closed? If you want that, just enable that closed successful as a next state in ticket creation.
If you're making an API that creates tickets that close automatically, you'd create the ticket then use the Queue API or State API.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask