Whispir Forums

Getting Started

RSS Feed

understanding the API

    • JamesJ
    • Topic created 3 years ago

    I am trying to work towards creating some C# code that can populate and update my organisations contact lists and distribution lists.

    I have been able to use C# example http://developer.whispir.com/forum/read/160836 to get it to return some workspace detail. (I had some issues at the start because I didn't realise the company workspace doesn't come up in the workspace list.)

    I am now trying to run the "Retrieve an Individual Workspace" call but it needs an ID for the workspace and I have no idea what the id is?

    Could someone tell me what I should be using as the id and where I should get it from?
    And if there is some other documentation that you used to figure out what the id should be then I would be interested in knowing about that to?

    Message edited by JamesJ 3 years ago

    Tags

  1. Jordan Walsh3 years ago

    Hi James,

    I think what you are looking to do is use the Workspace ID that is returned from the /workspaces API Call.

    Workspaces allow users to structure their messages, contacts, templates and distribution groups into different areas for usage and reporting.

    Each user has access to a series of workspaces for their use. You can access the Company (Default) Workspace, or an individual workspace by using an ID.

    You can retrieve a list of workspaces available for you to access using the /workspaces endpoint.

    e.g.

    GET https://api.whispir.com/workspaces?apikey=9dfsh89fds89hfsd98    
    Authorization: Basic abcic390nccddcn3n09ce90jc
    Accept: application/vnd.whispir.workspace-v1+json
    
    {
      "workspaces" : [ {
        "projectName" : "Operations",
        "projectNumber" : "",
        "status" : "A",
        "billingcostcentre" : "",
        "link" : [ {
          "uri" : "https://api.whispir.com/workspaces/89FJFF09JDFSOISD?apikey=9dfsh89fds89hfsd98",
          "rel" : "self",
          "method" : "GET"
        } ]
      }, {
        "projectName" : "HR",
        "projectNumber" : "",
        "status" : "A",
        "billingcostcentre" : "",
        "link" : [ {
          "uri" : "https://api.whispir.com/workspaces/90FSD90JDFSDFS90?apikey=9dfsh89fds89hfsd98",
          "rel" : "self",
          "method" : "GET"
        } ]
      }]
    }
    

    Note that you have a URL returned for each workspace e.g.

    "uri" : "https://api.whispir.com/workspaces/90FSD90JDFSDFS90?apikey=9dfsh89fds89hfsd98"
    

    This is the URL that should be used to access this particular workspace to send any messages. The ID is what is after the forwardslash, in this case: 90FSD90JDFSDFS90

    To send a message in this workspace, you would use the following code:

    POST https://api.whispir.com/workspaces/90FSD90JDFSDFS90/messages?apikey=9dfsh89fds89hfsd98    
    Authorization: Basic abcic390nccddcn3n09ce90jc
    Content-Type: application/vnd.whispir.message-v1+json
    
    {
        "to" : "61400000000",
        "subject" : "Test Message",
        "body" : "This is my message"
    }
    

    Because I have referenced the workspace ID in my URL, I am now in the context of this workspace, so any messages that are processed will be sent through this workspace.

    Hopefully this answers your question.

    Happy to help further if required.

    Jordan

[ Page 1 of 1 ]