Jump to content

Unable to log request with API scheduler


Recommended Posts

Hi,

I am trying to log a request using the API scheduler (successfully used to create tasks before the task scheduler) and I am unable to get it to log a request.

Json file is as below (some information redacted): 

{
  "APIKey": "API key",
  "InstanceID": "Instance ID",
  "Zone":"eur",
  "Schedule": [
    {
      "Enabled":true,
      "CronSchedule":"30 15 * * * ",
      "ScheduleFrom":"2018-07-03T13:00:00.000Z",
      "ScheduleTo":"2020-01-01T00:00:00.000Z",
      "Service":"apps/com.hornbill.servicemanager/Requests",
      "API":"logRequest2",
      "APIParams":{
        "0":
        {
          "Type":"Content",
          "Parameter":"summary",
          "Content":"Summary text"
        },
        "1":
        {
          "Type":"Content",
          "Parameter":"description",
          "Content":"Description text"
        },
        "2":
        {
		  "Type":"Content",
		  "Parameter":"serviceID",
          "Content":"84"
        },
		"3":
		{
		  "Type":"Content",
          "Parameter":"catalogID",
          "Content":"307"
		}
      }
    }
  ]
}


		  

I am probably missing something but all I am trying to do is kick off a specific CI where the BPM will log a change request, add it to the change calendar and then close the request after (x) days. 

Any help appreciated.

(I know the { } look dodgy for section 3 but in the editor they are right.)

Link to comment
Share on other sites

HI @Dan Munns,

As per the API docs, you need to call one of the request type log request APIs, rather than the one you've selected (which is for internal use only):

image.png

So to log an Incident, your service & API should be:
 

"Service":"apps/com.hornbill.servicemanager/Incidents", 
"API":"logIncident",

The rest of the config looks fine to me...

Let me know how you get on.

Cheers,

Steve

Link to comment
Share on other sites

HI @Steve G thanks for your response. 

I have change the .json file as below, but I am still not having any luck with raising the request.

{
  "APIKey": "API Key",
  "InstanceID": "Instance ID",
  "Zone":"eur",
  "Schedule": [
    {
      "Enabled":true,
      "CronSchedule":"55 08 * * * ",
      "ScheduleFrom":"2018-07-03T13:00:00.000Z",
      "ScheduleTo":"2020-01-01T00:00:00.000Z",
      "Service":"apps/com.hornbill.servicemanager/ChangeRequests",
      "API":"logChangeRequest",
      "APIParams":{
        "0":
        {
          "Type":"Content",
          "Parameter":"summary",
          "Content":"Summary Text"
        },
        "1":
        {
          "Type":"Content",
          "Parameter":"description",
          "Content":"Description text"
        },
        "2":
        {
		  "Type":"Content",
		  "Parameter":"serviceID",
          "Content":"84"
        },
		"3":
		{
		  "Type":"Content",
          "Parameter":"catalogID",
          "Content":"307"
		}
      }
    }
  ]
}

If I remove the catalog ID line to will log a request (I have just found out) but I need it to log the request against a specific CI (as I will have about 6/7 of these once I can get it working). I have tried catalogName with no joy. Also I have noticed that the summary hasn't been populated on the request logged without the catalogID

Thanks 

Link to comment
Share on other sites

Hi @Dan Munns,

Spotted the issue with your config. The input param names for all APIs in Hornbill are case sensitive, so serviceID should be serviceId, and catalogID should be catalogId.

The following config worked for me, raising a Change Request every minute while it was running, with the summary, service and catalog item all correctly added:

{
  "APIKey": "redacted",
  "InstanceID": "redacted",
  "Zone": "eur",
  "Schedule": [{
    "Enabled": true,
    "CronSchedule": "0 * * * * 1-5",
    "ScheduleFrom": "2018-07-03T13:00:00.000Z",
    "ScheduleTo": "2020-01-01T00:00:00.000Z",
    "Service": "apps/com.hornbill.servicemanager/ChangeRequests",
    "API": "logChangeRequest",
    "APIParams": {
      "0": {
        "Type": "Content",
        "Parameter": "summary",
        "Content": "Some summary text"
      },
      "1": {
        "Type": "Content",
        "Parameter": "description",
        "Content": "Some descriptive text"
      },
      "2": {
        "Type": "Content",
        "Parameter": "serviceId",
        "Content": "568"
      },
      "3": {
        "Type": "Content",
        "Parameter": "catalogId",
        "Content": "132"
      },
      "4": {
        "Type": "Content",
        "Parameter": "catalogName",
        "Content": "Change Request Config Item"
      }
    }
  }]
}

Hope this helps,

Steve

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...