{"responseMessage":"Invalid or missing type parameter.","responseCode":402}

GetawayHouseGetawayHouse Posts: 4Expensify Customer
edited August 22 in Integrations and API

Hello folks at Expensify!

I'm trying to use https://integrations.expensify.com/Integration-Server/doc/#reconciliation with ruby but I get an error.

{"responseMessage":"Invalid or missing type parameter.","responseCode":402}

Interesting fact is: If I change the credentials to something invalid I get a Authentication error, so the request format is probably right. (Code below)


Otherwise If I try with curl, I get a

{"responseMessage":"401 Unauthorized","responseCode":401}


Am I missing something? Do I need to create a specific policy?


Bellow is the relevant code (in ruby)

# Code in ruby

 def fetch_api_data

    response = HTTParty.post("https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations", body: api_job_description)

 end


 def api_job_description

  json = {

   type: 'reconciliation',

   credentials: {

    partnerUserID: ENV['GETAWAY_EXPENSIFY_PARTNET_USER_ID'],

    partnerUserSecret: ENV['GETAWAY_EXPENSIFY_PARTNET_USER_SECRET']

   },

   onReceive: {

    immediateResponse: ["returnRandomFileName"]

   },

   inputSettings: {

    startDate: '2019-08-01',

    endDate: '2019-08-02',

    domain: 'getaway.house',

    type: 'all',

    async: false

   },

   outputSettings: {

    fileExtension: 'csv'

   }

  }


  "requestJobDescription=#{json.to_json}"

 end

-------------------------------

Below is curl (without credentials, but I double checked the credentials when testing)

curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription={ "type":"reconciliation", "credentials":{ "partnerUserID":"not_telling_you", "partnerUserSecret":"not_telling_you_either" }, "inputSettings":{ "startDate":"2019-08-01", "endDate":"2019-08-02", "domain":"getaway.house", "type":"all", "async": false }, "outputSettings":{ "fileExtension":"csv" } }'

-------------------------------

Last question: The API asks for a "domain" parameters. I don't know what is it

-------------------------------

Also in https://integrations.expensify.com/Integration-Server/doc/#introduction the link to "community forum" is broken. It links to "https://community.expensify.com/categories/expensify-api-" leading to a 404.

Answers

  • Nicole TrepanierNicole Trepanier Posts: 566Expensify Success Coach - Admin Expensify Success Coach

    Hi @GetawayHouse! When trying to run this are you using credentials tied to your email address? Looking at your account, you aren't a domain admin so you won't be able to access this data.

    I've let my team know about the broken link. Thanks for reporting it!

  • GetawayHouseGetawayHouse Posts: 4Expensify Customer
    edited August 23

    Oh, that explains! Thanks for your reply.

    How do I get to be a domain admin? The domain is actually getaway.house?

  • Nicole TrepanierNicole Trepanier Posts: 566Expensify Success Coach - Admin Expensify Success Coach

    @GetawayHouse Yes, the domain is getaway.house. To become an admin you would need to ask one of the current admins to add you.

  • GetawayHouseGetawayHouse Posts: 4Expensify Customer

    Hi Nicole, I was added as a domain admin, now when I try to curl I get

    {"responseMessage":"Invalid or missing type parameter.","responseCode":402}

    # curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -d 'requestJobDescription={ "type":"reconciliation", "credentials":{ "partnerUserID":"secret", "partnerUserSecret":"secret" }, "inputSettings":{ "startDate":"2019-08-01", "endDate":"2019-08-02", "domain":"getaway.house", "type":"all", "async": false }, "outputSettings":{ "fileExtension":"csv" } }'

  • Ted PeetersTed Peeters Posts: 294Expensify Customer, Expensify Success Coach Expensify Success Coach

    When comparing your call with the example shown for the Reconciliation Export API it seems there are a few differences you'll need to check. The example call given shows as:

    curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' \
        -d 'requestJobDescription={
            "type":"reconciliation",
            "credentials":{
                "partnerUserID":"_REPLACE_",
                "partnerUserSecret":"_REPLACE_"
            },
            "inputSettings":{
                "startDate":"2016-01-01",
                "endDate":"2016-10-10",
                "domain":"example.com",
                "feed":"export_all_feeds",
                "type":"Unreported",
                "async": false
            },
            "outputSettings":{
                "fileExtension":"csv"
            }
        }'
        --data-urlencode '[email protected]_template.ftl'
    

    Yours appears to be as below, meaning your inputSettings: type is defined as all but it's possible this just needs to be All instead.

    curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' 
         -d 'requestJobDescription={ 
             "type":"reconciliation",
             "credentials":{
                 "partnerUserID":"secret",
                 "partnerUserSecret":"secret"
             },
             "inputSettings":{ 
                 "startDate":"2019-08-01",
                 "endDate":"2019-08-02",
                 "domain":"getaway.house",
                 "type":"all",
                 "async": false 
             },
             "outputSettings":{
                 "fileExtension":"csv" 
             } 
         }'
    

    Secondly, you've not yet defined a feed value in this call. I know it's Optional, but could you try adding the below into your inputSettings?

                 "feed":"export_all_feeds",
    

    Let us know how you get on!

  • GetawayHouseGetawayHouse Posts: 4Expensify Customer

    Oh! Thank you very much. The problem was the "all" vs "All". The error response is really misleading, I thought it was about the "type": "reconciliation" field.


    Anyway, thank you for you help :)

Sign In or Register to comment.