Community
Showing results for 
Search instead for 
Do you mean 
Reply

Add an activity for another user different to the API user

New Member
Posts: 7
Country: New_Zealand

Add an activity for another user different to the API user

How can I use the API to add an activity for a number of different users? Whatever values I set in scheduledFor are ignored, and the value returned when I add the activity is the user ID I'm using to login to the API. I tried including the contact ID of the user in the list of contacts, and also putting the contact ID in the scheduledFor field - none or these work. It seems like the only way to add activities on a different user to the one I'm logged in as is to generate a token for each and every user in the system which of course means knowing all their passwords. Seems like poor design if this is indeed the case.

Employee
Posts: 241
Country: USA

Re: Add an activity for another user different to the API user

Hi, 

 

This is expected functionality from most APIs (and in our SDK today) - you can't circumvent security via API.  In other words, you can't access data that you wouldn't have access to as a user in Act!.

 

You certainly should be able to include contacts on an activity, but you can't impersonate other users. 

 

--Xavier

Nickel Super Contributor
Posts: 352
Country: Canada

Re: Add an activity for another user different to the API user

You can create an activity that is scheduled FOR another user though, or not?  That's something you can do through the desktop / Web UI and you'd expect to be able to do via the API then as well, yeah?

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Employee
Posts: 241
Country: USA

Re: Add an activity for another user different to the API user

Yep, if you've been granted delegate permissions you would be able to schedule for.  Albeit not sure we support that current in Web API, you are absolutely correct that it should, since that is a product capability.

New Member
Posts: 7
Country: New_Zealand

Re: Add an activity for another user different to the API user

Indeed. I would expect that if a user has permission to place an activity or anything else for that matter on another user, that this would be possible within the API.

 

What is the process for getting this added as a bug fix/feature?

Employee
Posts: 241
Country: USA

Re: Add an activity for another user different to the API user

Posting here is enough - it's on our backlog to address.

Nickel Elite Contributor
Posts: 1,445
Country: USA

Re: Add an activity for another user different to the API user

Any update on this function? I may have to schedule for logged in API user and then reassign it in Act. It might be useful if I could always schedule for a specific person.

 

the video from the 2017 CC Conference was excellent. Gets everyone up the curve faster. Thanks.

Steve McCandlish
Employee
Posts: 70
Country: USA

Re: Add an activity for another user different to the API user

Have you tried the activities organizers endpoints within the API?  You can create an activity that is scheduled FOR another user using the organizers (POST: /api/organizers/{id}/activities) endpoint.

 

let me know if you have any issue?

 

Sample:

Scheduled For User's ID:   f155d4a6-f11f-44d8-afa2-42b090f76429

 

POST: /api/organizers/f155d4a6-f11f-44d8-afa2-42b090f76429/activities

{
  "startTime": "2017-11-09T12:30:00.000Z",
  "endTime": "2017-11-09T13:30:00.000Z",
  "isTimeless": false,
  "isPrivate": false,
  "activityPriorityName": "Low",
  "activityTypeName": "Meeting",
  "subject": "update subject",
  "contacts":
  [
    {
      "id": "f155d4a6-f11f-44d8-afa2-42b090f76429"
    },
    {
      "id": "689d7dc2-156d-42e4-8937-d9eb06a119b5"
    }
  ]
}

Copper Contributor
Posts: 143
Country: Netherlands

Re: Add an activity for another user different to the API user

The exact example posted above does not work for me (API 1.0.259.0). I get "message": "An error has occurred.",
"exceptionMessage": "ID Must be at least 36 characters",
"exceptionType": "System.ArgumentException","stackTrace": "   at act.web.api.Services.ActivityService.Split(String ID) in c:\\gitroot\\act.web.api\\act.web.api\\Services\\ActivityService.cs:line 933\r\n   at act.web.api.Services.ActivityService.Get(String id, ActFramework framework, IDictionary`2 mappers) in c:\\gitroot\\act.web.api\\act.web.api\\Services\\ActivityService.cs:line 326\r\n   at act.web.api.Services.ActivityService.Create(ActivityOccurrence activity, Nullable`1 organizerId, ActFramework framework, IDictionary`2 mappers) in c:\\gitroot\\act.web.api\\act.web.api\\Services\\ActivityService.cs:line 179\r\n   at act.web.api.Controllers.ActivitiesController.Post(Guid id, Ac.............

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands
Employee
Posts: 70
Country: USA

Re: Add an activity for another user different to the API user

Not able to duplicate this issue, could you send me the request body that is giving you the error and also verify that the URL organizers GUID is a user and what that users role is.  Also the Guids defined in the contacts array (body) what is there roles as well.  I just need this to try to re-create this issue.

 

Here I am logged in as me (Stephen Burton) and posting an activity for 'Standard User1' (organizers).  This works, I think I need more information about your request.

 

/api/organizers/1d996d3b-fcb9-4150-ae24-c180a71b0db6/activities

{
    "isCleared": false,
    "startTime": "2018-04-09T13:45:00-07:00",
    "endTime": "2018-04-09T14:25:00-07:00",
    "isPrivate": false,
    "activityPriorityName": "Low",
    "activityTypeId": 0,
    "activityTypeName": "Call",
    "details": "No details",
    "subject": "No subject",
    "contacts": [
        {
            "id": "0bf36134-67e2-42f1-b9b2-4845ae690fb8",
            "displayName": "Stephen Mark Burton"
        },
        {
            "id": "1d996d3b-fcb9-4150-ae24-c180a71b0db6",
            "displayName": "Standard User1"
        }
    ]
}