Content in a Custom Connector

796 views
Skip to first unread message

mcol...@fmsworks.com

unread,
Mar 11, 2015, 4:12:30 PM3/11/15
to suppor...@runmyprocess.com
Hey,

so I'm trying to integrate RunMyProcess with Wrike. I created a new provider with the URL "www.wrike.com/api/v3/" and now I'm making a connector using this provider. The connector sends data in a POST method to create a new task in Wrike.

The content I am sending is the following JSON encoded data:
{"title": "Run MY Process", "description": "RUN IT NOW"}

The Wrike API specifies that when creating a task, the only parameter required is the title. That being said, when I test this connector, I get the following result:
{"errorDescription":"Parameter 'title' is required","error":"invalid_parameter"}

So as far as I can tell, I am doing everything correct in setting up this connector, except for the content section. I've tried searching examples of custom connectors using POST methods, but it's hard to find a decent example. So what am I missing here? Can anyone show me how they format the content data for a POST method?

Thanks!

Takafumi Hoshino

unread,
Mar 11, 2015, 4:24:58 PM3/11/15
to suppor...@runmyprocess.com
Hi,

Wrike integration is interesting.

I have never done this before but seems documentation suggest it is 
key=value
format
using Content-Type application/www-x-form-urlencoded

Can you try this?

[POST content]
title="Run MY Process"
description="RUN IT NOW"

[Content-type]
application/www-x-form-urlencoded

I built above suggestion from Wrike documentation gives example below.

curl -X POST -H "Authorization: bearer <access_token>" -d "parents=["IEAAAL2YI4AC5UOS"]&customFields=[{"id":"IEAAAL2YJUAAAATE","value":"testValue"}]&status=Active&shareds=["KUAAJP7I"]&responsibles=["KUAAJP7I"]&priorityBefore=IEAAAL2YKQAC5UOV&superTasks=["IEAAAL2YKQAC5UOV"]&title=Test task&followers=["KUAAJP7I"]&importance=High&dates={"start":"2015-02-18","due":"2015-02-21"}&description=Test task description&metadata=[{"key":"testMetaKey","value":"testMetaValue"}]&follow=true" https://www.wrike.com/api/v3/folders/IEAAAL2YI4AC5UOS/tasks

Best regards,

Taka







--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/6246008a-3b6a-4706-a026-3fdbc2b5b833%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.



--
---------------------------------------------------
Taka Hoshino
Fujitsu RunMyProcess
Google Account: thos...@runmyprocess.com
<Sent from Gmail web client>

Michael Coleman

unread,
Mar 11, 2015, 5:22:48 PM3/11/15
to suppor...@runmyprocess.com
Hey Taka,

thanks for that suggestion.  I was able to create a new task, but instead of it's title being "Run MY Process" it was ""Run MY Process" description="RUN IT NOW"".

How would I make sure the values are properly separated?  For more complicated data in my POST method, how would I send variables that are assigned JSON or Array data?

Thanks,
Michael Coleman

You received this message because you are subscribed to a topic in the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/a/runmyprocess.com/d/topic/supportforum/qEyrvKR1XIc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to supportforum...@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.

thoshino

unread,
Mar 12, 2015, 1:37:04 AM3/12/15
to suppor...@runmyprocess.com, mcol...@fmsworks.com
Hi Michael,

Can you put & symbol between the fields?
like this
title="Run MY Process"
&description="RUN IT NOW"

It seems their API accepts this format only (from documentation).
This is example they have. The fields accepts array or JSON as text.

parents=["IEAAAL2YI4AC5UOS"]&customFields=[{"id":"IEAAAL2YJUAAAATE","value":"testValue"}]&status=Active&shareds=["KUAAJP7I"]&responsibles=["KUAAJP7I"]&priorityBefore=IEAAAL2YKQAC5UOV&superTasks=["IEAAAL2YKQAC5UOV"]&title=Test task&followers=["KUAAJP7I"]&importance=High&dates={"start":"2015-02-18","due":"2015-02-21"}&description=Test task description&metadata=[{"key":"testMetaKey","value":"testMetaValue"}]&follow=true

So, from RMP you can do
title=${title}
$description=${description}

And the ${title} or ${description} can be basically any type of data format that process variable supports. Can be string, number, array, or JSON for example.

Is this what you asked for?

Best regards,

Taka

mcol...@fmsworks.com

unread,
Mar 12, 2015, 3:54:13 PM3/12/15
to suppor...@runmyprocess.com, mcol...@fmsworks.com
Hey Taka,

seems to have worked perfectly, thanks for your help!

On a slightly different issue, do you know how I can setup the provider to automatically refresh the Access token? The Wrike API uses OAuth v2, and so far I have had to manually refresh the token and replace the values in the provider tab, which works for development and testing but isn't going to fly when this process is deployed. The official RMP user guide conveniently skips over explaining how to set this up. Do you have any tips?

Takafumi Hoshino

unread,
Mar 12, 2015, 4:05:01 PM3/12/15
to suppor...@runmyprocess.com, Michael Coleman
Hi Michael,

For now what we do is:

1. Create a provider + connector to get access_token using refresh_token.

2. Process will call this connector first (get access_token), then use that in next connector call (create task).

That step#1, you need to have gone through the OAuth 2.0 flow at least once so that you have the refresh token.

The POST content look like this.
client_secret=AAAAAAAAAAAAAAAAAAAAAA&grant_type=refresh_token&refresh_token=BBBBBBBBBBBBBB&client_id=CCCCCCCCC

to URL endpoint

I hope this helps!

Best regards,

Taka


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.

mcol...@fmsworks.com

unread,
Mar 12, 2015, 5:18:41 PM3/12/15
to suppor...@runmyprocess.com, mcol...@fmsworks.com
Okay, I was thinking it would be something along those lines. Ideally, I don't want to have to refresh the Access token every single time, only when it has expired.

I previously wrote a Ruby script to do something similar that would automatically refresh the token if it tried to POST and received an "expired token" error. The new Access token is saved in a text file that can be read later.

I noticed on the Configuration section of the provider tab, underneath the field for "Access token" is a field to call a composite API beside a label that says "Refresh the access token". Does this composite API get called automatically if the Access token has expired? Will the new Access token automatically be saved for the Provider, or do I need to save it in a variable and insert that variable in the "Access token" field?

mcol...@fmsworks.com

unread,
Mar 16, 2015, 11:02:40 AM3/16/15
to suppor...@runmyprocess.com, mcol...@fmsworks.com
Hi Taka,

I tried making a connector to refresh the access token in the way that you described, but I keep getting 404 errors. Do you have any advice?

Thanks,
Michael Coleman

Pray Desai

unread,
Mar 16, 2015, 2:13:24 PM3/16/15
to suppor...@runmyprocess.com, mcol...@fmsworks.com
Hi Michael,

Regarding your previous query on OAuth v2 provider configuration with Composite api to get new access token, it is a new feature released that will be documented soon. I would recommend you to use after its documentation is available. 

Regarding your 404 error, is there any error message that is displayed ? 
 
Attached are screenshots of provider/connector configurations that worked for us. Can you refer them and see if you find an issue in your configurations? If not, can you send screenshots of your provider/connector.

Regards,
Pray Desai,
Fujitsu RunMyProcess.
wrike-get-access-token.png
wrike-provider.png

mcol...@fmsworks.com

unread,
Mar 17, 2015, 11:01:57 AM3/17/15
to suppor...@runmyprocess.com, mcol...@fmsworks.com
Hi Pray,

I was able to get the connector to refresh the token. Thanks for the pictures, they really helped me figure out how to set it up.

Let me know as soon as you can about using a composite API to refresh the token.

Thanks,
Michael Coleman
Message has been deleted

mcol...@fmsworks.com

unread,
Mar 17, 2015, 11:48:45 AM3/17/15
to suppor...@runmyprocess.com
Reply all
Reply to author
Forward
0 new messages