How can I create an incident from an application using Rest Api
I want to create incidents in service manager 9.34 as long as a new one is generated in Resilient, an external application.
I have created and configure the external access with the data and allowed actions of the application.
I have already configured in the application the url http:/<ip>:<port>/SM/9/rest/Re_im, to which it will send the incidents.
When I access http:/<ip>:<port>/SM/9/rest/Re_im, it returns a list of service manager incidents and not the list of Resilient incidents.
I do not know what I'm missing so that in service manager the incidents related to the resilient application are created.
I appreciate your help.
I don't exactly understand what you mean...
If you have successfully created an incident using REST (assuming with the HTTP POST Mode ) the SM returns the created incident in JSON.
After that you can get the incident information using the HTTP GET Mode accessing via http:/<ip>:<port>/SM/9/rest/Re_im/<IM-Number>.
Hope that helps...
maybe this is a good starting point: https://community.softwaregrp.com/t5/Service-Manager-Service-Center/Curl-command-for-HPSM-webservices/td-p/949104
I have already created operators via REST using SoapUI (just for testing). If you are still interested I can make some screenshots...
If you've already configured the extaccess record for REST, you're pretty much there.
The difference is in the methods. REST uses GET, POST, PUT, DELETE and use that to determine what action Service Manager should take when it gets that method called.
In your example, navigating to that URL in a web browser invokes the 'GET' method; without passing a specific ticket number at the end of your URL, hitting that URL basically tells Service Manager to show you the key fields (whatever you have mapped in your extaccess record in the Unique Keys array of the RESTful tab). Appending an IM number (like http://<server>:<port>/SM/9/rest/Re_im/IM12345) will show you the details of that ticket (whatever you have exposed in the 'Fields' tab of the extaccess).
It sounds like what you want to do is POST rather than GET. On that RESTful tab, you'll see a section for 'Resource Collection Actions' (with a dropdown for what should happen when someone POSTs) and for 'Resource Actions', (with dropdowns for POST, PUT and DELETE). The values for those dropdowns are based on the values you put in your Allowed Action tab, but they usually get mapped to things like Create (add), Update (save) and Close.
For example, take a look at an Out of the Box extaccess record like 'IncidentManagement' and you'll see that the Resource Collection Action POST triggers the Create action name (mapped to the 'add' allowed action on the Allowed Actions tab) and the Resource Action for PUT and POST triggers the Update action name (mapped to the 'save' allowed action).
In that example, if someone POSTS a valid JSON object to http://<server>:<port>/SM/9/rest/incidents, that would create a new IM.
To get a sense of what your JSON object should look like, do a GET request to your URL with a specific ticket, and you should get back a specific ticket, structured in the way you'll need to send your data.
I recommend a tool like SOAP UI or other free REST/SOAP tools to test this out so you get a sense of what you need to pass in.