Click here to Skip to main content
15,568,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
i have a problem . I am working with workwave API problem that i am not understanding how can i resolve this is
1> how can i create a callback url ?
2> How can i get data from workwave to there ?

please help me about this. thanks for your valuable answer.

What I have tried:

for get i try this

private string CreateToken(string message, string secret)
           secret = secret ?? "";
           var encoding = new System.Text.ASCIIEncoding();
           byte[] keyByte = encoding.GetBytes(secret);
           byte[] messageBytes = encoding.GetBytes(message);
           using (var hmacsha256 = new HMACSHA256(keyByte))
               byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
               return Convert.ToBase64String(hashmessage);

string dataUrl = "{\"url \": \" \",\"signaturePassword\" : \""+ signPassword + "\",\"test\":\"true\"}";

string Str = CallBackUrl("", dataUrl, userid, ApiKey);

string signPassword = CreateToken("" + " w/", ApiKey);

string CallBackUrl(string url, string urlregister, string bigApiUserID, string BigApiKey)
           string responseStr = "";
           HttpStatusCode statusCode;
           WebRequest request = WebRequest.Create(url);
           request.Credentials = new NetworkCredential(bigApiUserID, BigApiKey);
           request.Method = "POST";
           byte[] bytes;
           bytes = System.Text.Encoding.ASCII.GetBytes(urlregister);
           request.Headers.Add("X-WorkWave-Key", BigApiKey);
           request.ContentType = "application/json";
           request.ContentLength = bytes.Length;
           Stream requestStream = request.GetRequestStream();
           requestStream.Write(bytes, 0, bytes.Length);
           HttpWebResponse response;
               response = (HttpWebResponse)request.GetResponse();
               statusCode = response.StatusCode;
               if (Convert.ToString(response.StatusCode) == "OK")
                   Stream responseStream = response.GetResponseStream();
                   responseStr = new StreamReader(responseStream).ReadToEnd();
                   return responseStr;
           catch (WebException  ex)
               using (var stream = ex.Response.GetResponseStream())
               using (var reader = new StreamReader(stream))
                   string str = Convert.ToString(reader.ReadToEnd());


           return responseStr;
Updated 21-Feb-17 23:32pm
Graeme_Grant 21-Feb-17 8:15am    
Callback Urls are usually required for OAuth 1.0a or OAuth 2.0 or for Webhooks. What are you trying to do?
abhishek goutam 21-Feb-17 8:35am    
my requirement is that create a url that i need to pass as a call back url . where i will get data from WorkWave api as json format
Graeme_Grant 21-Feb-17 8:40am    
if the API server that you are talking to has no alternatives, then you need to use your own endpoint/url either on a server that can receive http packets (web server for example) or your own app that is listening for http packets.

My suggestion would be to discuss it with them.
abhishek goutam 21-Feb-17 8:55am    
for this may i use a webservice and host it on our server example from that i can get data is that will work ?
Graeme_Grant 21-Feb-17 9:01am    
An endpoint/url is just a url on your server without a page - WEBAPI. If they're sending data to you, then the endpoint must support the verb POST. I am sure they explain this in their documentation.

1 solution

Looking at the workwave API documentation this doesn't look too bad.
1. Get your public facing webserver up and running (https would be highly recommended)
2. Create your webservice, looks like they need a RESTful api call back url. I personally use c# WebAPI projects for stuff like this. It needs to accept POST actions of JSON data.
I would create classes that mimic their json layout so that you can accept that type of object from them it deserializes quite nicely.
3. Once you have your Restful API service all setup, you need to update workwave's systems. The code you have above can be somewhat useful, but you need to use a POST action not a GET action to update their system with your new web service URL. That is how they will contact you by calling the URL that you give to them.

Thats a very high level view, but its really not too bad.
Share this answer
abhishek goutam 22-Feb-17 3:30am    
Hello j snooze thanks for your answer. This is my first time when i am integrating any api. So i am little bit confuse for this. Do you sample for this so i can use and it will help me for future as a reference. I really thankful for you
abhishek goutam 22-Feb-17 4:09am    
i have updated my function please take a look
j snooze 23-Feb-17 17:42pm    
your updated code looks on the right track for posting your url to their system.
now on your side create something like a webAPI project using visual studio.

In that project first create a class object to handle their data as seen on this page...look at the json on the right hand side.

(c# syntax...not tested but to help you get an idea)
class Notification{
public string requestId{get;set}
public string territoryId{get;set;}
public string event{get;set;}
public List data{get;set;} (need to define data here as it looks to be different per notification type, but they all seem to have a created, updated, deleted object)

Once you define the data you know you will get from them, you can create your WebAPI controller. So maybe I make a controller called Notification.

public class NotificationController : ApiController
public object Receive([FromBody]Notification postedDataFromWorkWave)

//do something with the posted data here

return Request.CreateResponse(HttpStatusCode.OK);

to test your new api you modify the code above to call your own service, grab the sample data from workwaves site and post the data to it. Hope that helps point you in the right direction.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900