Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I am having trouble with the UPS JSON API. I know it has been done here before, because I have seen questions about decoding the return. UPS doesn't like what I am sending.

I am using JSONSetElement to create my JSON:

JSONSetElement ( "{}";
["UPSSecurity"; ""; JSONObject];
["UPSSecurity.UsernameToken"; ""; JSONObject];
["UPSSecurity.UsernameToken.Username"; "psamuelson"; JSONString];
["UPSSecurity.UsernameToken.Password"; "xxxxxx"; JSONString];

["UPSSecurity.ServiceAccessToken"; ""; JSONObject];
["UPSSecurity.ServiceAccessToken.AccessLicenseNumber"; "ABCABC"; JSONString];

["TrackRequest"; ""; JSONObject];
["TrackRequest.Request"; ""; JSONObject];
["TrackRequest.Request.RequestOption"; "1"; JSONString];

["TrackRequest.Request.TransactionReference"; ""; JSONObject];
["TrackRequest.Request.TransactionReference.CustomerContext"; "Your Test Case Summary Description"; JSONString];

["TrackRequest.InquiryNumber"; "1Z5690980355503859"; JSONString]

)

 

Which creates the following JSON, after a JSONFormatElements :

{
    "TrackRequest" :
    {
        "InquiryNumber" : "1Z5690980355503859",
        "Request" :
        {
            "RequestOption" : "1",
            "TransactionReference" :
            {
                "CustomerContext" : "Your Test Case Summary Description"
            }
        }
    },
    "UPSSecurity" :
    {
        "ServiceAccessToken" :
        {
            "AccessLicenseNumber" : "ABCABC"
        },
        "UsernameToken" :
        {
            "Password" : "XXXXXX",
            "Username" : "psamuelson"
        }
    }
}

 

The UserName and Password are for my UPS account. The AccessLicenseNumber is my Access Key from UPS.

The format of my XML appears to match the JSON example from their documentation, other than the order of objects (FileMaker seems to list them in alphabetical order), but I don't think that matters.

The URL is "httpspost://wwwcie.ups.com/rest/Track?"& $$UPS_JSON_Formatted   (where $$UPS_JSON_Formatted is my variable containing the JSON above).

I am using cURL options "--header \"Content-type: application/json\" --data-urlencode"

The response I get back from UPS is {"Error":{"Code":"4","Description":"JSON Syntax error"}}.

I think the JSON is correct, so I wonder if I am missing something with cURL options or something else.

Any ideas?

 

Thanks,

Paul

 

 

  • Author

This is what the documentation shows:

image.png.d8aaac9242b055940ae632bcac245c26.png

I do not know about UPS api but try by setting data as --data option. Instead of "httpspost" format in url, use curl options with data set from variable. Below is example (did just wrote from memory, not sure if syntax is 100% correct)

"--data @$$UPS_JSON_Formatted " &
"-X POST " &
"-H \"Content-type: application/json\""

Set url as "https://wwwcie.ups.com/rest/Track"

Edited by jvagla

  • Author

That did it. Thanks!

Now, on to decoding the returned data...

 

Thanks,

Paul

Paul,

Have you tried using Generator? It'll parse the JSON for you.

 

  • 1 year later...
  • Newbies
On 3/22/2018 at 2:23 PM, PaulSamuelson said:

That did it. Thanks!

Now, on to decoding the returned data...

 

Thanks,

Paul

Hi Paul,

I still can't get this to work properly. Would you please post the working code of your "Track Request"

Thanks

Gary

 

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.