Class: UspsApi::ResourcesApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/usps_api/apis/resources_api.rb

Overview

ResourcesApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from UspsApi::BaseApi

Instance Method Details

#delete_campaigns(scope, crid, campaign_id) ⇒ ApiResponse

Cancel a previously existing Informed Delivery campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). campaign

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • campaign_id (String)

    Required parameter: ID of Informed Delivery

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
# File 'lib/usps_api/apis/resources_api.rb', line 1711

def delete_campaigns(scope,
                     crid,
                     campaign_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsErrorException)
                .local_error('401',
                             'Unauthorized',
                             InformedDeliveryCampaignsErrorException)
                .local_error('403',
                             'Forbidden',
                             InformedDeliveryCampaignsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             InformedDeliveryCampaignsErrorException)
                .local_error('503',
                             'Service Unavailable',
                             InformedDeliveryCampaignsErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end

#delete_carrier_pickup_confirmation_number(scope, confirmation_number, if_match) ⇒ ApiResponse

Cancel a previously scheduled carrier pick up. A carrier pickup can no longer be updated or cancelled once cancelled. A successful response indicates the carrier pickup has been cancelled. determines the level of access and permissions for the API. The value of this parameter should be set to “pickup” for pickup-related operations. Carrier Pickup confirmation number. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope3)

    Required parameter: The scope of the request, which

  • confirmation_number (String)

    Required parameter: This is the

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
# File 'lib/usps_api/apis/resources_api.rb', line 745

def delete_carrier_pickup_confirmation_number(scope,
                                              confirmation_number,
                                              if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/carrier-pickup/{confirmationNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(confirmation_number, key: 'confirmationNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PickupErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PickupErrorException)
                .local_error('403',
                             'Access is denied.',
                             PickupErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PickupErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             PickupErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_containers_with_container_id(scope, container_id) ⇒ ApiResponse

In the context of container tracking, deleting all tracking numbers from a container results in an empty container, which allows for the addition of new tracking numbers. This process effectively clears out any previous tracking information associated with the container, allowing for a fresh start. determines the level of access and permissions for the API. The value of this parameter should be set to “containers” for containers-related operations. container

Parameters:

  • scope (Scope4)

    Required parameter: The scope of the request, which

  • container_id (String)

    Required parameter: Container id for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
# File 'lib/usps_api/apis/resources_api.rb', line 857

def delete_containers_with_container_id(scope,
                                        container_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/containers/{container-id}/packages',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(container_id, key: 'container-id')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             ContainersErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             ContainersErrorException)
                .local_error('403',
                             'Access is denied.',
                             ContainersErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             ContainersErrorException)
                .local_error('503',
                             'Service is unavailable',
                             ContainersErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_containers_with_container_id_with_packages(scope, container_id, tracking_number) ⇒ ApiResponse

In the context of container tracking, deleting one tracking number from a container. determines the level of access and permissions for the API. The value of this parameter should be set to “containers” for containers-related operations. container. the package.

Parameters:

  • scope (Scope4)

    Required parameter: The scope of the request, which

  • container_id (String)

    Required parameter: Container id for the

  • tracking_number (String)

    Required parameter: tracking number for

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/usps_api/apis/resources_api.rb', line 906

def delete_containers_with_container_id_with_packages(scope,
                                                      container_id,
                                                      tracking_number)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/containers/{container-id}/packages/{tracking-number}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(container_id, key: 'container-id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'tracking-number')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             ContainersErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             ContainersErrorException)
                .local_error('403',
                             'Access is denied.',
                             ContainersErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             ContainersErrorException)
                .local_error('503',
                             'Service is unavailable',
                             ContainersErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_fast_appointment(scope, body: nil) ⇒ ApiResponse

Cancel Appointment Request provides the ability to cancel an appointment. determines the level of access and permissions for the API. The value of this parameter should be set to “fast-appointments” for fast-appointments-related operations. corresponding to the supported grant types.

Parameters:

  • scope (Scope2)

    Required parameter: The scope of the request, which

  • body (CancellationRequest) (defaults to: nil)

    Optional parameter: The input parameters

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/usps_api/apis/resources_api.rb', line 395

def delete_fast_appointment(scope,
                            body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/fast-appointments/appointment',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CancellationResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             FastAppointmentsErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             FastAppointmentsErrorException)
                .local_error('403',
                             'Access is denied.',
                             FastAppointmentsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             FastAppointmentsErrorException)
                .local_error('503',
                             'Service is unavailable',
                             FastAppointmentsErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_indicia_imb(scope, imb, x_payment_authorization_token) ⇒ ApiResponse

Cancel an Intelligent Mail Barcode (IMB) label for First-Class letters, flats, and cards or submit a refund request by providing the IMB. An IMB can be canceled if it has not yet been manifested. If it has been manifested, a refund request will be submitted for the unused IMB. Indicia without an IMB cannot be canceled. Note:

  • You can only request a refund of an IMB once.

determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. for First-Class letters, flats, and cards. Authorization Token from the payments API Call.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • imb (String)

    Required parameter: The Intelligent Mail Barcode (IMB)

  • x_payment_authorization_token (String)

    Required parameter: Payment

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
# File 'lib/usps_api/apis/resources_api.rb', line 3489

def delete_indicia_imb(scope,
                       imb,
                       x_payment_authorization_token)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/indicia/imb/{imb}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(imb, key: 'imb')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CancelIntelligentMailBarcodeResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_international_label(scope, tracking_number, x_payment_authorization_token) ⇒ ApiResponse

Cancel a label or submit a refund request by providing the label’s tracking number. A label can be canceled if a Shipping Services File has not been created. If a Shipping Services File has been created, submit a refund request for an unused label. A label is eligible for a refund if:

  • If the label has had a Shipping Services File created for it

  • The label is not from Click-N-Ship or PC Postage

  • Is a SCAN Form label that has had its Shipping Services File created

Note:

  • If the label is canceled, a Shipping Services File will not be created.

  • If a refund request is successfully submitted, a disputeId will be

returned that can be used to then track the status of the refund request. The system will only give one unique disputeId per customer reference ID (CRID) per day. Duplicate submissions of the same label, for the same CRID, on the same day, will be rejected. determines the level of access and permissions for the API. The value of this parameter should be set to “international-labels” for international-labels-related operations. number of the label. Authorization Token from the payments API Call.

Parameters:

  • scope (Scope8)

    Required parameter: The scope of the request, which

  • tracking_number (String)

    Required parameter: The unique tracking

  • x_payment_authorization_token (String)

    Required parameter: Payment

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
# File 'lib/usps_api/apis/resources_api.rb', line 2554

def delete_international_label(scope,
                               tracking_number,
                               x_payment_authorization_token)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/international-label/{trackingNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalLabelsCancelLabelResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_label(scope, tracking_number, x_payment_authorization_token) ⇒ ApiResponse

Cancel a label or submit a refund request by providing the label’s tracking number. A label can be canceled if a Shipping Services File has not been created. If a Shipping Services File has been created, submit a refund request for an unused label. A label is eligible for a refund if:

  • If the label has had a Shipping Services File created for it

  • The label is not from Click-N-Ship or PC Postage

  • Is a SCAN Form label that has had its Shipping Services File created

Note:

  • If the label is canceled, a Shipping Services File will not be created.

  • If a refund request is successfully submitted, a disputeId will be

returned that can be used to then track the status of the refund request. The system will only give one unique disputeId per customer reference ID (CRID) per day. Duplicate submissions of the same label, for the same CRID, on the same day, will be rejected. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. the domestic label. Authorization Token from the payments API Call.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • tracking_number (String)

    Required parameter: The tracking number of

  • x_payment_authorization_token (String)

    Required parameter: Payment

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
# File 'lib/usps_api/apis/resources_api.rb', line 3241

def delete_label(scope,
                 tracking_number,
                 x_payment_authorization_token)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/label/{trackingNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelsCancelLabelResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_label_branding(scope, image_uuid, x_payment_authorization_token) ⇒ ApiResponse

Delete a label branding image associated with your customer reference ID (CRID). The CRID will be taken from the ‘LABEL_OWNER` role of your Payment Authorization token. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. branding image Authorization Token from the payments API Call.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • image_uuid (String)

    Required parameter: The UUID of a label

  • x_payment_authorization_token (String)

    Required parameter: Payment

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
# File 'lib/usps_api/apis/resources_api.rb', line 3736

def delete_label_branding(scope,
                          image_uuid,
                          x_payment_authorization_token)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/branding/{imageUUID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(image_uuid, key: 'imageUUID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelBrandingImageDeleteResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_package_campaigns(scope, crid, campaign_id) ⇒ ApiResponse

Cancel a previously existing Informed Delivery package campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-package-campaigns” for informed-delivery-package-campaigns-related operations. Customer Registration ID (CRID). campaign.

Parameters:

  • scope (Scope7)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The Package campaign submitter’s

  • campaign_id (String)

    Required parameter: Unique identifier for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
# File 'lib/usps_api/apis/resources_api.rb', line 2292

def delete_package_campaigns(scope,
                             crid,
                             campaign_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CancelPackageCampaignResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryPackageCampaignsErrorException))
    .execute
end

#delete_subscriptions_adjustment_id(scope, subscription_id, if_match) ⇒ ApiResponse

Use this endpoint to delete a Subscription by its unique identifier. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-adjustments” for subscriptions-adjustments-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope28)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
# File 'lib/usps_api/apis/resources_api.rb', line 6175

def delete_subscriptions_adjustment_id(scope,
                                       subscription_id,
                                       if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_subscriptions_dispute_id(scope, subscription_id, if_match) ⇒ ApiResponse

Use this endpoint to delete a Subscription by its unique identifier. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-disputes” for subscriptions-disputes-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope29)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
# File 'lib/usps_api/apis/resources_api.rb', line 6446

def delete_subscriptions_dispute_id(scope,
                                    subscription_id,
                                    if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_subscriptions_ncoa_id(scope, subscription_id, if_match) ⇒ ApiResponse

Use this endpoint to delete a Subscription by its unique identifier. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-ncoa” for subscriptions-ncoa-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope30)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
# File 'lib/usps_api/apis/resources_api.rb', line 6715

def delete_subscriptions_ncoa_id(scope,
                                 subscription_id,
                                 if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_subscriptions_package_transaction_details_id(scope, subscription_id, if_match) ⇒ ApiResponse

Use this endpoint to delete a Subscription by its unique identifier. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-package-transaction-details” for subscriptions-package-transaction-details-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope31)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
# File 'lib/usps_api/apis/resources_api.rb', line 6993

def delete_subscriptions_package_transaction_details_id(scope,
                                                        subscription_id,
                                                        if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_subscriptions_tracking_id(scope, subscription_id, if_match) ⇒ ApiResponse

Use this endpoint to delete a Subscription by its unique identifier. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-tracking” for subscriptions-tracking-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope32)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
# File 'lib/usps_api/apis/resources_api.rb', line 7268

def delete_subscriptions_tracking_id(scope,
                                     subscription_id,
                                     if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#delete_subscriptions_unpaid_packages_id(scope, subscription_id, if_match) ⇒ ApiResponse

Use this endpoint to delete a Subscription by its unique identifier. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-unpaid-packages” for subscriptions-unpaid-packages-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation.

Parameters:

  • scope (Scope33)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
# File 'lib/usps_api/apis/resources_api.rb', line 7540

def delete_subscriptions_unpaid_packages_id(scope,
                                            subscription_id,
                                            if_match)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in  a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_address(scope, street_address, state, firm: nil, secondary_address: nil, city: nil, urbanization: nil, zip_code: nil, zip_plus4: nil) ⇒ ApiResponse

Standardizes street addresses including city and street abbreviations as well as providing missing information such as ZIP Code™ and ZIP + 4®. Must specify a street address, a state, and either a city or a ZIP Code™. determines the level of access and permissions for the API. The value of this parameter should be set to “addresses” for addresses-related operations. building along with the name of the road or street on which it is located. the address. the address. designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building. For more information please see [Postal Explorer](pe.usps.com/text/pub28/28c2_003.htm). address. code relevant only for Puerto Rico addresses. code. component of the ZIP+4 code. Using the correct ZIP+4 reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error.

Parameters:

  • scope (Scope)

    Required parameter: The scope of the request, which

  • street_address (String)

    Required parameter: The number of a

  • state (String)

    Required parameter: The two-character state code of

  • firm (String) (defaults to: nil)

    Optional parameter: Firm/business corresponding to

  • secondary_address (String) (defaults to: nil)

    Optional parameter: The secondary unit

  • city (String) (defaults to: nil)

    Optional parameter: This is the city name of the

  • urbanization (String) (defaults to: nil)

    Optional parameter: This is the urbanization

  • zip_code (String) (defaults to: nil)

    Optional parameter: This is the 5-digit ZIP

  • zip_plus4 (String) (defaults to: nil)

    Optional parameter: This is the 4-digit

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/usps_api/apis/resources_api.rb', line 41

def get_address(scope,
                street_address,
                state,
                firm: nil,
                secondary_address: nil,
                city: nil,
                urbanization: nil,
                zip_code: nil,
                zip_plus4: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/address',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(street_address, key: 'streetAddress')
                             .is_required(true))
               .query_param(new_parameter(state, key: 'state')
                             .is_required(true))
               .query_param(new_parameter(firm, key: 'firm'))
               .query_param(new_parameter(secondary_address, key: 'secondaryAddress'))
               .query_param(new_parameter(city, key: 'city'))
               .query_param(new_parameter(urbanization, key: 'urbanization'))
               .query_param(new_parameter(zip_code, key: 'ZIPCode'))
               .query_param(new_parameter(zip_plus4, key: 'ZIPPlus4'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AddressesAddressResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Address Not Found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_addresses(scope, street_address, firm_name: nil, secondary_address: nil, city: nil, state: nil, urbanization: nil, zip_code: nil, zip_plus4: nil) ⇒ ApiResponse

Standardizes street addresses including city and street abbreviations as well as providing missing information such as ZIP Code™ and ZIP + 4®. Must specify a street address, a state, and either a city or a ZIP Code™. determines the level of access and permissions for the API. The value of this parameter should be set to “addresses” for addresses-related operations. building along with the name of the road or street on which it is located. to the address. designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building. For more information please see [Postal Explorer](pe.usps.com/text/pub28/28c2_003.htm). address. the address. code relevant only for Puerto Rico addresses. code. component of the ZIP + 4® code. Using the correct ZIP + 4® reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error.

Parameters:

  • scope (Scope)

    Required parameter: The scope of the request, which

  • street_address (String)

    Required parameter: The number of a

  • firm_name (String) (defaults to: nil)

    Optional parameter: Firm/business corresponding

  • secondary_address (String) (defaults to: nil)

    Optional parameter: The secondary unit

  • city (String) (defaults to: nil)

    Optional parameter: This is the city name of the

  • state (String) (defaults to: nil)

    Optional parameter: The two-character state code of

  • urbanization (String) (defaults to: nil)

    Optional parameter: This is the urbanization

  • zip_code (String) (defaults to: nil)

    Optional parameter: This is the 5-digit ZIP

  • zip_plus4 (String) (defaults to: nil)

    Optional parameter: This is the 4-digit

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
# File 'lib/usps_api/apis/resources_api.rb', line 1339

def get_addresses(scope,
                  street_address,
                  firm_name: nil,
                  secondary_address: nil,
                  city: nil,
                  state: nil,
                  urbanization: nil,
                  zip_code: nil,
                  zip_plus4: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/address',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(street_address, key: 'streetAddress')
                             .is_required(true))
               .query_param(new_parameter(firm_name, key: 'firmName'))
               .query_param(new_parameter(secondary_address, key: 'secondaryAddress'))
               .query_param(new_parameter(city, key: 'city'))
               .query_param(new_parameter(state, key: 'state'))
               .query_param(new_parameter(urbanization, key: 'urbanization'))
               .query_param(new_parameter(zip_code, key: 'ZIPCode'))
               .query_param(new_parameter(zip_plus4, key: 'ZIPPlus4'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AddressesAddressResponse1.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Address Not Found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_adjustments(scope, crid, tracking_number, event_type, destination_zip_code: nil) ⇒ ApiResponse

The Adjustments API enables users to receive USPS Ship adjustments by a Package Identification Code (PIC) aka Tracking Number. determines the level of access and permissions for the API. The value of this parameter should be set to “adjustments” for adjustments-related operations. representation of package barcode data, commonly known as its tracking number. the adjustment. ZIP Code™.

Parameters:

  • scope (Scope1)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: Filter by CRID.

  • tracking_number (String)

    Required parameter: The human-readable

  • event_type (EventType)

    Required parameter: The type of event for

  • destination_zip_code (String) (defaults to: nil)

    Optional parameter: The destination

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/usps_api/apis/resources_api.rb', line 240

def get_adjustments(scope,
                    crid,
                    tracking_number,
                    event_type,
                    destination_zip_code: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/adjustments/{CRID}/{trackingNumber}/{eventType}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(event_type, key: 'eventType')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(destination_zip_code, key: 'destinationZIPCode'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AdjustmentsAdjustmentDetails.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_appointment_availability(scope, body: nil) ⇒ ApiResponse

Allows customers to check for appointment slots at the requested facility. determines the level of access and permissions for the API. The value of this parameter should be set to “fast-appointments” for fast-appointments-related operations. corresponding to the supported grant types.

Parameters:

  • scope (Scope2)

    Required parameter: The scope of the request, which

  • body (SlotAvailability) (defaults to: nil)

    Optional parameter: The input parameters

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/usps_api/apis/resources_api.rb', line 443

def get_appointment_availability(scope,
                                 body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/appointment-availability',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Slots.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             FastAppointmentsErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             FastAppointmentsErrorException)
                .local_error('403',
                             'Access is denied.',
                             FastAppointmentsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             FastAppointmentsErrorException)
                .local_error('503',
                             'Service is unavailable',
                             FastAppointmentsErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_campaigns(scope, crid, campaign_id) ⇒ ApiResponse

Return a single Informed Delivery campaign for a given Submitter CRID and Campaign ID determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). campaign

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • campaign_id (String)

    Required parameter: ID of Informed Delivery

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
# File 'lib/usps_api/apis/resources_api.rb', line 1657

def get_campaigns(scope,
                  crid,
                  campaign_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Campaign.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsErrorException)
                .local_error('401',
                             'Unauthorized',
                             InformedDeliveryCampaignsErrorException)
                .local_error('403',
                             'Forbidden',
                             InformedDeliveryCampaignsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             InformedDeliveryCampaignsErrorException)
                .local_error('503',
                             'Service Unavailable',
                             InformedDeliveryCampaignsErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end

#get_campaigns1(scope, crid, offset: 0, limit: 100, sort: nil, ezsearch: nil, barcode_count: nil, brand_display_name: nil, campaign_code: nil, campaign_grouping_code: nil, mid: nil, campaign_title: nil, created_datetime: nil, end_date: nil, last_modified_datetime: nil, mail_owner_crid: nil, mail_owner_name: nil, start_date: nil, status: nil, submitted_datetime: nil) ⇒ ApiResponse

Search, filter, sort, and paginate package campaigns for a given Submitter CRID determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-package-campaigns” for informed-delivery-package-campaigns-related operations. Registration ID (CRID). before returning results. This field must be either be 0 or be a multiple of the limit variable (e.g., is limit is 10, offset can be 0, 10, 20, etc.). If no offset parameter is included at all, a default of 0 will be used. This field must be a number between 1 and 1000. If no limit parameter is included at all, a default of 100 will be used. this, an integrator can input any column that they would like to sort by (e.g., sort=brandDisplayName,desc). An integrator can indicate either an ascending or descending order by inputting asc or desc after the field name. If asc or desc is not included, then the field will be sorted ascending by default. If no sort parameter is included at all, the response will be sorted by lastModifiedDatetime,desc by default. “contains” search across the Campaign Grouping Code, Campaign Code, Brand Display Name, and Campaign Title fields. For example inputting “Sale” will return any campaign for the CRID with a Campaign Grouping Code, Campaign Title, Campaign Code, or Brand Display Name that contains the word “Sale”. associated with a campaign. that is placed on Informed Delivery’s UIs when campaign is displayed. describes the campaign being created. This field is put into the campaign reports created for the campaign. field that describes the campaign being created. This field is put into the campaign reports created for the campaign. campaign. describes the campaign being created. This field is put into the campaign reports created for the campaign. campaign creation. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “createdDatetime>2025-07-05”). displayed update made to campaign, inclusive of status changes that occur when a campaign activates or completes. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “lastModifiedDatetime>2025-07-05”). ID (CRID) of the Mail Owner associated with the Informed Delivery campaign. associated with the Informed Delivery campaign. displayed values include Submitted, Active, Complete, Inactive, Cancelled, and Deleted campaign submission. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “submittedDatetime>2025-07-05”).

Parameters:

  • scope (Scope7)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • offset (Integer) (defaults to: 0)

    Optional parameter: Number of records to skip

  • limit (Integer) (defaults to: 100)

    Optional parameter: Number of results per page.

  • sort (String) (defaults to: nil)

    Optional parameter: Sorting order for results. To use

  • ezsearch (String) (defaults to: nil)

    Optional parameter: This filter will do a

  • barcode_count (Float) (defaults to: nil)

    Optional parameter: Number of packages

  • brand_display_name (String) (defaults to: nil)

    Optional parameter: User defined field

  • campaign_code (String) (defaults to: nil)

    Optional parameter: User defined field that

  • campaign_grouping_code (String) (defaults to: nil)

    Optional parameter: User defined

  • mid (String) (defaults to: nil)

    Optional parameter: The Mailer ID associated with the

  • campaign_title (String) (defaults to: nil)

    Optional parameter: User defined field that

  • created_datetime (Date) (defaults to: nil)

    Optional parameter: Date of initial

  • end_date (Date) (defaults to: nil)

    Optional parameter: Last day campaign will be

  • last_modified_datetime (Date) (defaults to: nil)

    Optional parameter: Date of last

  • mail_owner_crid (String) (defaults to: nil)

    Optional parameter: Customer Registration

  • mail_owner_name (String) (defaults to: nil)

    Optional parameter: Name of the Mail Owner

  • start_date (Date) (defaults to: nil)

    Optional parameter: First day campaign will be

  • status (Status1) (defaults to: nil)

    Optional parameter: Status of campaign - possible

  • submitted_datetime (Date) (defaults to: nil)

    Optional parameter: Date of initial

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
# File 'lib/usps_api/apis/resources_api.rb', line 2138

def get_campaigns1(scope,
                   crid,
                   offset: 0,
                   limit: 100,
                   sort: nil,
                   ezsearch: nil,
                   barcode_count: nil,
                   brand_display_name: nil,
                   campaign_code: nil,
                   campaign_grouping_code: nil,
                   mid: nil,
                   campaign_title: nil,
                   created_datetime: nil,
                   end_date: nil,
                   last_modified_datetime: nil,
                   mail_owner_crid: nil,
                   mail_owner_name: nil,
                   start_date: nil,
                   status: nil,
                   submitted_datetime: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(sort, key: 'sort'))
               .query_param(new_parameter(ezsearch, key: 'ezsearch'))
               .query_param(new_parameter(barcode_count, key: 'barcodeCount'))
               .query_param(new_parameter(brand_display_name, key: 'brandDisplayName'))
               .query_param(new_parameter(campaign_code, key: 'campaignCode'))
               .query_param(new_parameter(campaign_grouping_code, key: 'campaignGroupingCode'))
               .query_param(new_parameter(mid, key: 'MID'))
               .query_param(new_parameter(campaign_title, key: 'campaignTitle'))
               .query_param(new_parameter(created_datetime, key: 'createdDatetime'))
               .query_param(new_parameter(end_date, key: 'endDate'))
               .query_param(new_parameter(last_modified_datetime, key: 'lastModifiedDatetime'))
               .query_param(new_parameter(mail_owner_crid, key: 'mailOwnerCRID'))
               .query_param(new_parameter(mail_owner_name, key: 'mailOwnerName'))
               .query_param(new_parameter(start_date, key: 'startDate'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(, key: 'submittedDatetime'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CampaignDetailsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryPackageCampaignsQueryErrorResponseException))
    .execute
end

#get_campaigns_callback(scope, crid, offset: 0, limit: 100, sort: nil, campaign_id: nil, submitted_datetime: nil, total_barcodes: nil, total_barcodes_added: nil, total_barcodes_failed: nil) ⇒ ApiResponse

Search all callback keys for Add Many IMB transactions performed by given Submitter CRID determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). before returning results. This field must be either be 0 or be a multiple of the limit variable (e.g., is limit is 10, offset can be 0, 10, 20, etc.). If no offset parameter is included at all, a default of 0 will be used. This field must be a number between 1 and 1000. If no limit parameter is included at all, a default of 100 will be used. this, an integrator can input any column that they would like to sort by (e.g., sort=submittedDatetime,desc). An integrator can indicate either an ascending or descending order by inputting asc or desc after the field name. If asc or desc is not included, then the field will be sorted ascending by default. If no sort parameter is included at all, the response will be sorted by submittedDatetime,desc by default. Delivery campaign associated with the callback key transaction. callback key transaction. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “submittedDatetime>2025-07-05”). barcodes in a single callback key transaction. of barcodes successfully added to the campaign via the callback key transaction. of barcodes that failed to be added to the campaign via the callback key transaction.

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • offset (Integer) (defaults to: 0)

    Optional parameter: Number of records to skip

  • limit (Integer) (defaults to: 100)

    Optional parameter: Number of results per page.

  • sort (String) (defaults to: nil)

    Optional parameter: Sorting order for results. To use

  • campaign_id (String) (defaults to: nil)

    Optional parameter: ID of the Informed

  • submitted_datetime (Date) (defaults to: nil)

    Optional parameter: Date of initial

  • total_barcodes (Float) (defaults to: nil)

    Optional parameter: The total number of

  • total_barcodes_added (Float) (defaults to: nil)

    Optional parameter: The total number

  • total_barcodes_failed (Float) (defaults to: nil)

    Optional parameter: The total number

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
# File 'lib/usps_api/apis/resources_api.rb', line 1882

def get_campaigns_callback(scope,
                           crid,
                           offset: 0,
                           limit: 100,
                           sort: nil,
                           campaign_id: nil,
                           submitted_datetime: nil,
                           total_barcodes: nil,
                           total_barcodes_added: nil,
                           total_barcodes_failed: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}/callback',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(sort, key: 'sort'))
               .query_param(new_parameter(campaign_id, key: 'campaignID'))
               .query_param(new_parameter(, key: 'submittedDatetime'))
               .query_param(new_parameter(total_barcodes, key: 'totalBarcodes'))
               .query_param(new_parameter(total_barcodes_added, key: 'totalBarcodesAdded'))
               .query_param(new_parameter(total_barcodes_failed, key: 'totalBarcodesFailed'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3CampaignsCallbackResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end

#get_carrier_pickup_confirmation_number(scope, confirmation_number) ⇒ ApiResponse

Get the previously scheduled carrier pickup by confirmation number. Responds with the entity tag (ETag) to use when updating or cancelling this pickup. determines the level of access and permissions for the API. The value of this parameter should be set to “pickup” for pickup-related operations. Carrier Pickup confirmation number.

Parameters:

  • scope (Scope3)

    Required parameter: The scope of the request, which

  • confirmation_number (String)

    Required parameter: This is the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/usps_api/apis/resources_api.rb', line 626

def get_carrier_pickup_confirmation_number(scope,
                                           confirmation_number)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/carrier-pickup/{confirmationNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(confirmation_number, key: 'confirmationNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PickupConfirmation.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PickupErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PickupErrorException)
                .local_error('403',
                             'Access is denied.',
                             PickupErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PickupErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             PickupErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_carrier_pickup_eligibility(scope, street_address, secondary_address: nil, city: nil, state: nil, zip_code: nil, zip_plus4: nil, urbanization: nil) ⇒ ApiResponse

Check carrier pickup service availability at the specified address. Either the city and state or the ZIP Code&#8482; is required, in addition to the street address. Successful responses include the USPS standardized address when this location is eligible for carrier pickup. determines the level of access and permissions for the API. The value of this parameter should be set to “pickup” for pickup-related operations. building along with the name of the road or street on which it is located. designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building. For more information please see [Postal Explorer](pe.usps.com/text/pub28/28c2_003.htm). address. two-character state code of the address. The request accepts either the full state name or a two-character state code. The response will always return the two-character state code. code. component of the ZIP+4 code. Using the correct Zip+4 reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error. code relevant only for Puerto Rico addresses.

Parameters:

  • scope (Scope3)

    Required parameter: The scope of the request, which

  • street_address (String)

    Required parameter: The number of a

  • secondary_address (String) (defaults to: nil)

    Optional parameter: The secondary unit

  • city (String) (defaults to: nil)

    Optional parameter: This is the city name of the

  • state (String) (defaults to: nil)

    Optional parameter: This is the state name or

  • zip_code (String) (defaults to: nil)

    Optional parameter: This is the 5-digit ZIP

  • zip_plus4 (String) (defaults to: nil)

    Optional parameter: This is the 4-digit

  • urbanization (String) (defaults to: nil)

    Optional parameter: This is the urbanization

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/usps_api/apis/resources_api.rb', line 514

def get_carrier_pickup_eligibility(scope,
                                   street_address,
                                   secondary_address: nil,
                                   city: nil,
                                   state: nil,
                                   zip_code: nil,
                                   zip_plus4: nil,
                                   urbanization: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/carrier-pickup/eligibility',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(street_address, key: 'streetAddress')
                             .is_required(true))
               .query_param(new_parameter(secondary_address, key: 'secondaryAddress'))
               .query_param(new_parameter(city, key: 'city'))
               .query_param(new_parameter(state, key: 'state'))
               .query_param(new_parameter(zip_code, key: 'ZIPCode'))
               .query_param(new_parameter(zip_plus4, key: 'ZIPPlus4'))
               .query_param(new_parameter(urbanization, key: 'urbanization'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PickupAddress.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PickupErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PickupErrorException)
                .local_error('403',
                             'Access is denied.',
                             PickupErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PickupErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             PickupErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_city_state(scope, zip_code) ⇒ ApiResponse

Returns the city and state corresponding to the given ZIP Code&#8482;. determines the level of access and permissions for the API. The value of this parameter should be set to “addresses” for addresses-related operations. code.

Parameters:

  • scope (Scope)

    Required parameter: The scope of the request, which

  • zip_code (String)

    Required parameter: This is the 5-digit ZIP

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/usps_api/apis/resources_api.rb', line 106

def get_city_state(scope,
                   zip_code)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/city-state',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(zip_code, key: 'ZIPCode')
                             .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(AddressesCityAndState.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'A bad request was received.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_coa_records_search(scope, body) ⇒ ApiResponse

Returns a list of records for a person’s current and old addresses. determines the level of access and permissions for the API. The value of this parameter should be set to “ncoa-data-services” for ncoa-data-services-related operations. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
# File 'lib/usps_api/apis/resources_api.rb', line 4411

def get_coa_records_search(scope,
                           body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(RecordsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Missing required fields in the request will result in a 400'\
                              ' response.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized or invalid token is received in the request.',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden response means this client doesn’t have the proper'\
                              ' scope/role',
                             AddressesErrorException)
                .local_error('404',
                             'Indicates the endpoint was not found.',
                             AddressesErrorException)
                .local_error('500',
                             'An error has occurred within the application.',
                             AddressesErrorException))
    .execute
end

#get_code(scope_template, response_type, client_id, redirect_uri, user_id, scope: nil, state: nil) ⇒ ApiResponse

The client application identifier and redirect URI are configured during client application registration. The client application redirect URI specified here must match the one specified during client registration. The Authorization Code request and response is the first leg of the three-legged Authorization Code flow stipulated here:

  • **Authorization Code Grant**, see [IETF 6749, section

4.1](datatracker.ietf.org/doc/html/rfc6749#section-4.1).

The authorization code and state are appended as query parameters to the

redirect_uri upon a _successful___ authorization code redirection response.

Example
 ```

mycompany.com/authorize?code=lcJNTxcLB&state=IntcInJlZGlyZWN0X3RvX CI6XCIvZGFzaGJvYXJkXCIsXCJ1c2VyX2lkXCI6XCJhYmMtMTIzXCJ9Ig==

```

Errors are appended as query parameters to the redirect_uri once the

client application credentials are authenticated, and both the client_id and the redirect_uri are validated. An _error___ redirection response is then sent. The application is authorized to make the request, but other fields in the request are causing an error to occur.

Example
```

mycompany.com/authorize?error=access_denied&error_description=The% 20resource%20owner%20authorization%20grant%20does%20not%20exist%20or%20has %20been%20revoked.&error_uri=https%3A%2F%2Fdatatracker.ietf.org%2Fdoc%2Fht ml%2Frfc6749%23section-4.1.2.1&state=IntcInJlZGlyZWN0X3RvXCI6XCIvZGFzaGJvY XJkXCIsXCJ1c2VyX2lkXCI6XCJhYmMtMTIzXCJ9Ig==

```

**Authorization codes have a short expiration time. The client

application must complete the authorization code flow by requesting OAuth tokens using the authorization code.** request, which determines the level of access and permissions for the API. The value of this parameter should be set to “oauth2” for oauth2-related operations. response being requested, ‘code’ in this case. client application making the request. Resource Identifier (URI) that has been previously registered for the third-party client application. This input must be an exact match with the one(s) previously registered. The URI must use a encrypted connection, preventing attackers from intercepting and reading autorization code responses. The redirect_uri must use the https:// scheme for security reasons. See [Best Current Practice for OAuth 2.0 Security](datatracker.ietf.org/doc/html/rfc9700#name-client-as-ope n-redirector) for further security awareness. of the user’s account. requested. A client application may request a subset of scope that has already been configured during client application registration. The scope registered for the client application is used as default when the scope is omitted. **Only specify the scope in the request when the client application requires less scope, i.e. less access to APIs, than the default.** authorization code request is returned in authorization code response. It is recommended that the value for the state is a Base64 encoded, stringified JSON object and its value should be sufficient to correlate the code response to an authorization code request and user. A nonce value should be included in this JSON object for additional security. Effectively using the state parameter mitigates Cross-Site Request Forgery (CSRF). See [Best Current Practice for OAuth 2.0 Security](datatracker.ietf.org/doc/html/rfc9700#name-nonce) for further security awareness. The following is a normative example: “‘ {

"redirect_to": "/dashboard",   "user_id": "abcd1234",   "nonce":

“553393870385” } “‘ The result of converting to a string and Base64 encoding is: “` IntcInJlZGlyZWN0X3RvXCI6IFwiL2Rhc2hib2FyZFwiLFwidXNlcl9pZFwiOiBcImFiY2QxMj M0XCIsXCJub25jZVwiOiBcIjU1MzM5Mzg3MDM4NVwifSI= “`

Parameters:

  • scope_template (Scope16)

    Required parameter: The scope of the

  • response_type (ResponseType)

    Required parameter: The type of

  • client_id (String)

    Required parameter: The unique identifier of the

  • redirect_uri (String)

    Required parameter: The redirection Uniform

  • user_id (String)

    Required parameter: The unique subject identifier

  • scope (String) (defaults to: nil)

    Optional parameter: The OAuth2 scope being

  • state (String) (defaults to: nil)

    Optional parameter: The state value passed in the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
# File 'lib/usps_api/apis/resources_api.rb', line 4650

def get_code(scope_template,
             response_type,
             client_id,
             redirect_uri,
             user_id,
             scope: nil,
             state: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/authorize',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope_template, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(response_type, key: 'response_type')
                             .is_required(true))
               .query_param(new_parameter(client_id, key: 'client_id')
                             .is_required(true))
               .query_param(new_parameter(redirect_uri, key: 'redirect_uri')
                             .is_required(true))
               .query_param(new_parameter(user_id, key: 'user_id')
                             .is_required(true))
               .query_param(new_parameter(scope, key: 'scope'))
               .query_param(new_parameter(state, key: 'state'))
               .auth(Single.new('BearerTokenAuth')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  Check the input parameters and values.',
                             OauthStandardErrorResponseException)
                .local_error('401',
                             'Unauthorized Request.  Check the authentication scheme and'\
                              ' values being used to make the request.',
                             OauthStandardErrorResponseException)
                .local_error('403',
                             'Forbidden Request.  The request parameters conflict with'\
                              ' application registration. Suspected Potential Intrusion.',
                             OauthStandardErrorResponseException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             OauthStandardErrorResponseException)
                .local_error('503',
                             'Service Unavailable.',
                             OauthStandardErrorResponseException))
    .execute
end

#get_detail_data(scope, crid, callback_key, offset: 0, limit: 10, sort: nil, error_message: nil) ⇒ ApiResponse

Return IMB-level errors for a single callback key transaction determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). associated with the campaign. before returning results. This field must be either be 0 or be a multiple of the limit variable (e.g., is limit is 10, offset can be 0, 10, 20, etc.). If no offset parameter is included at all, a default of 0 will be used. This field must be a number between 1 and 1000. If no limit parameter is included at all, a default of 10 will be used. this, an integrator can input any column that they would like to sort by (e.g., sort=errorMessage,desc). An integrator can indicate either an ascending or descending order by inputting asc or desc after the field name. If asc or desc is not included, then the field will be sorted ascending by default. If no sort parameter is included at all, the response will be sorted by errorMessage,asc by default. IMB-level error message.

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • callback_key (String)

    Required parameter: The callback key

  • offset (Integer) (defaults to: 0)

    Optional parameter: Number of records to skip

  • limit (Integer) (defaults to: 10)

    Optional parameter: Number of results per page.

  • sort (String) (defaults to: nil)

    Optional parameter: Sorting order for results. To use

  • error_message (String) (defaults to: nil)

    Optional parameter: Filter results by

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
# File 'lib/usps_api/apis/resources_api.rb', line 1990

def get_detail_data(scope,
                    crid,
                    callback_key,
                    offset: 0,
                    limit: 10,
                    sort: nil,
                    error_message: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}/{callbackKey}/detail',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(callback_key, key: 'callbackKey')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(sort, key: 'sort'))
               .query_param(new_parameter(error_message, key: 'errorMessage'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DetailSuccessResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsQueryErrorResponseException))
    .execute
end

#get_dropoff_location(scope, destination_zip_code, destination_zip_plus4: nil, mail_class: nil, processing_category: nil, destination_entry_facility_type: nil, palletized: nil, mailing_date: nil) ⇒ ApiResponse

The Drop Off Location API can be used to find convenient USPS&#174; entry facilities for destination entry volume. If you supply a valid 5-digit destination ZIP Code&#8482; and optional parameters you will be provided with one or more acceptable entry locations which can be utilized to prevent mis-shipped adjustments. This API can be used in lieu of the Parcel, Address, and Mail Direction Files currently available through FAST. determines the level of access and permissions for the API. The value of this parameter should be set to “locations” for locations-related operations. ZIP Code&#8482; of the package. 4-digit component of the ZIP+4 code. Using the correct Zip+4 reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error. package being shipped: example: PARCEL_SELECT shape of the package being shipped, for more information on package shapes see the [Physical Standards for Parcels](pe.usps.com/text/dmm300/201.htm#ep1097220). Note: - ‘IRREGULAR` is deprecated as of 2/1/2025 and will convert to `NONSTANDARD`. - `NON_MACHINABLE` is deprecated as of 2/1/2025 and will convert to `NONSTANDARD`. Optional parameter: Indicates the facility type at which the packages will be dropped off. shipment or part of the shipment is being received on a pallet. be mailed. Defaults to today when omitted. The mailing date may be today plus 0 to 7 days in advance. Enter the date in the full-date notation as defined by [RFC 3339, section 5.6](datatracker.ietf.org/doc/html/rfc3339#section-5.6).

Parameters:

  • scope (Scope12)

    Required parameter: The scope of the request, which

  • destination_zip_code (String)

    Required parameter: The destination

  • destination_zip_plus4 (String) (defaults to: nil)

    Optional parameter: This is the

  • mail_class (MailClass12) (defaults to: nil)

    Optional parameter: The mail class of the

  • processing_category (ProcessingCategory12) (defaults to: nil)

    Optional parameter: The

  • destination_entry_facility_type (DestinationEntryFacilityType) (defaults to: nil)
  • palletized (Palletized1) (defaults to: nil)

    Optional parameter: Indicates if the

  • mailing_date (Date) (defaults to: nil)

    Optional parameter: The date the package will

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
# File 'lib/usps_api/apis/resources_api.rb', line 3949

def get_dropoff_location(scope,
                         destination_zip_code,
                         destination_zip_plus4: nil,
                         mail_class: nil,
                         processing_category: nil,
                         destination_entry_facility_type: nil,
                         palletized: nil,
                         mailing_date: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/dropoff-locations',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(destination_zip_code, key: 'destinationZIPCode')
                             .is_required(true))
               .query_param(new_parameter(destination_zip_plus4, key: 'destinationZIPPlus4'))
               .query_param(new_parameter(mail_class, key: 'mailClass'))
               .query_param(new_parameter(processing_category, key: 'processingCategory'))
               .query_param(new_parameter(destination_entry_facility_type, key: 'destinationEntryFacilityType'))
               .query_param(new_parameter(palletized, key: 'palletized'))
               .query_param(new_parameter(mailing_date, key: 'mailingDate'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ParcelDropShipmentFacilityLocation.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Invalid Address Information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#get_enrollment(scope, body: nil) ⇒ ApiResponse

Allows customers to get the USPS Ship enrollment status of a MID. The API will respond with whether the MID is enrolled in USPS Ship for Outbound, Returns, both, or neither, and the enrollment start date. determines the level of access and permissions for the API. The value of this parameter should be set to “ship-enrollment” for ship-enrollment-related operations. here

Parameters:

  • scope (Scope26)

    Required parameter: The scope of the request, which

  • body (EnrollmentRequest) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
# File 'lib/usps_api/apis/resources_api.rb', line 5822

def get_enrollment(scope,
                   body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/enrollment',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(EnrollmentStatuses.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('404',
                             'Not Found',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end

#get_international_base_rates_search(scope, body: nil) ⇒ ApiResponse

Given a set of SSF or scan-based rate ingredients, returns a international rates. Include contract-based rates in the results when the contractId and productId are present. determines the level of access and permissions for the API. The value of this parameter should be set to “international-prices” for international-prices-related operations. parameters to be used for the query.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
# File 'lib/usps_api/apis/resources_api.rb', line 2677

def get_international_base_rates_search(scope,
                                        body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/base-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalPricesBaseRatesQueryResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_international_extra_service_rates_search(scope, body: nil) ⇒ ApiResponse

Given a set of rate ingredients, returns international extra service rates. If contractId and productId are present, include contract-based rates in the results. determines the level of access and permissions for the API. The value of this parameter should be set to “international-prices” for international-prices-related operations. search parameters to be used for the query.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
# File 'lib/usps_api/apis/resources_api.rb', line 2731

def get_international_extra_service_rates_search(scope,
                                                 body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/extra-service-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalExtraRateDetails.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_international_service_standard(scope, country_code, mail_class) ⇒ ApiResponse

Retrieve the service standard message based on the provided country code and mail class. determines the level of access and permissions for the API. The value of this parameter should be set to “international-service-standard” for international-service-standard-related operations. code. The international mail class can be one of ‘FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE`, `PRIORITY_MAIL_INTERNATIONAL`, and `PRIORITY_MAIL_EXPRESS_INTERNATIONAL`.

Parameters:

  • scope (Scope10)

    Required parameter: The scope of the request, which

  • country_code (String)

    Required parameter: The ISO 2-char country

  • mail_class (InternationalMailClassOfTheLabel)

    Required parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
# File 'lib/usps_api/apis/resources_api.rb', line 2949

def get_international_service_standard(scope,
                                       country_code,
                                       mail_class)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/international-service-standard',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(country_code, key: 'countryCode')
                             .is_required(true))
               .query_param(new_parameter(mail_class, key: 'mailClass')
                             .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3InternationalServiceStandardResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource not found.',
                             AddressesErrorException)
                .local_error('500',
                             'Internal server error.',
                             AddressesErrorException))
    .execute
end

#get_list_label_branding(scope, x_payment_authorization_token, limit: 10, offset: 0, order_by: OrderBy::DESC, sort_by: SortBy::CREATEDDATETIME) ⇒ ApiResponse

Retrieve a paginated list of label branding images associated with your customer reference ID (CRID). The response may be sorted using the URL query parameters defined below. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. Authorization Token from the payments API Call. return. before returning the results. descending order. ‘imageName` or `createdDateTime`.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • limit (Integer) (defaults to: 10)

    Optional parameter: The number of items to

  • offset (Integer) (defaults to: 0)

    Optional parameter: The number of items to skip

  • order_by (OrderBy) (defaults to: OrderBy::DESC)

    Optional parameter: Sort results in ascending or

  • sort_by (SortBy) (defaults to: SortBy::CREATEDDATETIME)

    Optional parameter: Sort by field, e.g.,

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
# File 'lib/usps_api/apis/resources_api.rb', line 3622

def get_list_label_branding(scope,
                            x_payment_authorization_token,
                            limit: 10,
                            offset: 0,
                            order_by: OrderBy::DESC,
                            sort_by: SortBy::CREATEDDATETIME)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/branding',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(order_by, key: 'orderBy'))
               .query_param(new_parameter(sort_by, key: 'sortBy'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelBrandingGetListOfImagesResponseWithPagination.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_package_tracking(tracking_number, scope, x_forwarded_for: nil, expand: Expand::SUMMARY, destination_zip_code: nil, mailing_date: nil) ⇒ ApiResponse

This API allows users to retrieve either a summary or detailed information about a specific USPS&#174; package. Using the USPS&#174; Tracking Request, individuals can view the delivery status of various mail items, such as Priority Mail&#174;, Priority Mail Express&#174;, and Package Services (including Parcel Post&#174;, Bound Printed Matter, Library Mail, and Media Mail&#174;) that have USPS&#174; Tracking. By collecting mail class and service information from Product Tracking Systems, USPS&#174; Tracking provides users with delivery status updates. By entering the tracking number, users can view the summarized or detailed delivery status of single Priority Mail&#174; and Package Service parcels with Delivery Confirmation. By registering for the USPS&#174; Tracking by Email service, users can receive email notifications about their package tracking events. This service allows customers to submit their email address to be notified of current or future tracking activity. Users can choose to receive notifications for all activity to date, all future activity, or both. Whenever a mail piece receives an email notifiable event, an email with the relevant information will be generated and sent. With the new request type, users can make multiple requests for a single mail piece in a single request. Tracking status can be obtained using just the impb, and if multiple items are found, users can include additional details in the request. representation of package barcode data, commonly known as its tracking number. determines the level of access and permissions for the API. The value of this parameter should be set to “tracking” for tracking-related operations. address of the originating client, in additon to intermediate proxies that have forwarded the request. If a request goes through multiple proxies, the IP addresses of each successive proxy is listed. This means, the right-most IP address is the IP address of the most recent proxy and the left-most IP address is the IP address of the originating client. be expanded as Summary or Detail. When ommitted, the tracking summary information is returned. * SUMMARY - Data returned still contains the summary information, but this information is having only one line of text

  • DETAIL - Data returned still contains the detail and summary

information, but this information is broken down into fields instead of having only one line of text ZIP Code&#8482;. mailed.

Parameters:

  • tracking_number (String)

    Required parameter: The human-readable

  • scope (Scope18)

    Required parameter: The scope of the request, which

  • x_forwarded_for (String) (defaults to: nil)

    Optional parameter: Contains the IP

  • expand (Expand) (defaults to: Expand::SUMMARY)

    Optional parameter: Specify the fields that are to

  • destination_zip_code (String) (defaults to: nil)

    Optional parameter: The destination

  • mailing_date (Date) (defaults to: nil)

    Optional parameter: The date the package was

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
# File 'lib/usps_api/apis/resources_api.rb', line 4871

def get_package_tracking(tracking_number,
                         scope,
                         x_forwarded_for: nil,
                         expand: Expand::SUMMARY,
                         destination_zip_code: nil,
                         mailing_date: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/tracking/{trackingNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_forwarded_for, key: 'X-Forwarded-For'))
               .query_param(new_parameter(expand, key: 'expand'))
               .query_param(new_parameter(destination_zip_code, key: 'destinationZIPCode'))
               .query_param(new_parameter(mailing_date, key: 'mailingDate'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(proc do |response, should_symbolize|
                  APIHelper.deserialize_union_type(
                    UnionTypeLookUp.get(:GetPackageTrackingResponse),
                    response, should_symbolize, true
                  )
                end)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#get_parcel_locker_location(scope, city: nil, state: nil, zip_code: nil, offset: 0, limit: 30) ⇒ ApiResponse

The Parcel Locker Locations API can be used to search for operational USPS Parcel Locker locations by city/state combination or ZIP code. Parcel lockers are uniquely identified by their facility ID, found in the ‘facilityId` field. A parcel locker’s facility ID is required when creating a label for a package destined for a parcel locker. Labels can be created via the [Domestic Labels 3.0 API](developer.usps.com/domesticlabelsv3). A complete query consists of one of the following:

  • City/State Pair

  • ZIP Code&#8482;

  • City/State Pair and ZIP Code&#8482;

Notes:

- Parcel locker data is broken up ("paginated") across several requests

using the ‘offset=0&limit=50` query parameters. Please see the documentation for each parameter. determines the level of access and permissions for the API. The value of this parameter should be set to “locations” for locations-related operations. Clients should URI-encode this value so that spaces are properly represented. For example, if looking for parcel lockers in “Los Angeles”, the `city` parameter’s value should look like this: ‘city=Los%20Angeles`. (Note: the space is converted to `%20`.) Notes: - If `city` is set, then `state` must also be set. The API will respond with a 400 Bad Request if `state` does not accompany `city`. for the state to search. Notes: - If `state` is set, then `city` must also be set. The API will respond with a 400 Bad Request if `city` does not accompany `state`. lockers to skip. Examples: - Given the request `GET /parcel-locker-locations?offset=0&limit=20`, if there are 100 total results, the response will contain the first 20 parcel lockers available at that ZIPCode. See the documentation on the `limit` parameter. - Given the request `GET /parcel-locker-locations?ZIPCode=56789&offset=40&limit=20`, if there are 100 total results, the API will skip the first 40 parcel lockers and respond with the next 20. - Given the request `GET /parcel-locker-locations?city=Denver&state=CO&offset=20&limit=20`, if there are 15 total results, the response will include no parcel lockers because the API skipped over all 15 lockers. to include in the response. Notes: - If the number of total results is less than `limit`, then all results are returned. - The last page will have the remaining amount of parcel lockers out of the total amount if the value of `limit` does not evenly divide by the total amount of parcel lockers that match the city/state or ZIPCode.

Parameters:

  • scope (Scope12)

    Required parameter: The scope of the request, which

  • city (String) (defaults to: nil)

    Optional parameter: This is the city to search.

  • state (String) (defaults to: nil)

    Optional parameter: This is the two-character code

  • zip_code (String) (defaults to: nil)

    Optional parameter: This is the 5-digit ZIP code. Nine-digit and eleven-digit ZIP codes are not accepted.

  • offset (Float) (defaults to: 0)

    Optional parameter: Specifies the number of parcel

  • limit (Float) (defaults to: 30)

    Optional parameter: Indicates how many parcel lockers

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
# File 'lib/usps_api/apis/resources_api.rb', line 4194

def get_parcel_locker_location(scope,
                               city: nil,
                               state: nil,
                               zip_code: nil,
                               offset: 0,
                               limit: 30)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/parcel-locker-locations',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(city, key: 'city'))
               .query_param(new_parameter(state, key: 'state'))
               .query_param(new_parameter(zip_code, key: 'ZIPCode'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ParcelLockerLocation.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_payment_account_account_number(scope, account_number, account_type, permit_zip_code: nil, amount: nil) ⇒ ApiResponse

You can check if sufficient funds exist in the account, if you pass the amount parameter. In case you omit the amount parameter, you can still retrieve general information about the account, such as its non-profit status. determines the level of access and permissions for the API. The value of this parameter should be set to “payments” for payments-related operations. payment account payment account either Electronic Payment System account or Permit. associated to the permit number. This value is required when the account-type is ‘PERMIT’. account will be checked to see if there are sufficient funds at present to process a payment transaction for that amount.

Parameters:

  • scope (Scope19)

    Required parameter: The scope of the request, which

  • account_number (String)

    Required parameter: Account number for

  • account_type (AccountType11)

    Required parameter: The type of

  • permit_zip_code (String) (defaults to: nil)

    Optional parameter: The ZIP Code&#8482;

  • amount (Float) (defaults to: nil)

    Optional parameter: If amount is supplied, the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
# File 'lib/usps_api/apis/resources_api.rb', line 5205

def (scope,
                                       ,
                                       ,
                                       permit_zip_code: nil,
                                       amount: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/payment-account/{account-number}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(, key: 'account-number')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(, key: 'accountType')
                             .is_required(true))
               .query_param(new_parameter(permit_zip_code, key: 'permitZIPCode'))
               .query_param(new_parameter(amount, key: 'amount'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentsPaymentAccount.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Not found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_post_office_location(scope, street_address: nil, secondary_address: nil, city: nil, state: nil, urbanization: nil, zip_code: nil, zip_plus4: nil, lat: nil, long: nil, post_office_type: nil, mailing_service: nil, business_service: nil, passport_service: nil, pickup_service: nil, financial_service: nil, hours: nil, radius: 20, length: nil, width: nil, height: nil, offset: nil, limit: 20) ⇒ ApiResponse

A complete query consists of one of the following:

* Complete domestic address
* City/State Pair
* ZIP Code&#8482;
* Latitude/Longitude pair

Users can provide additional filters such as a radius (distance and units, defaults to 20 miles), location type, desired services, open times, and package dimensions. determines the level of access and permissions for the API. The value of this parameter should be set to “locations” for locations-related operations. building along with the name of the road or street on which it is located. designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building. For more information please see [Postal Explorer](pe.usps.com/text/pub28/28c2_003.htm). address. of the address. code relevant only for Puerto Rico addresses. code. component of the ZIP+4 code. Using the correct Zip+4 reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error. type of post office requested. Service supported at the facility Business Service supported at the facility Passport Service supported at the facility Service supported at the facility. If requesting PICKUP_PARCEL_LOCKER then the length, width and height parameters are always required. Financial Service supported at the facility. Locations to those supporting Retail Services at the enumerated times. If not provided, all with be returned. from the location given to the respective Post Office. If no radius is provided a default radius of 20 miles will be used inches. The maximum dimension is always length. inches. The second longest dimension is always width. inches. before returning the results

Parameters:

  • scope (Scope12)

    Required parameter: The scope of the request, which

  • street_address (String) (defaults to: nil)

    Optional parameter: The number of a

  • secondary_address (String) (defaults to: nil)

    Optional parameter: The secondary unit

  • city (String) (defaults to: nil)

    Optional parameter: This is the city name of the

  • state (String) (defaults to: nil)

    Optional parameter: This is two-character state code

  • urbanization (String) (defaults to: nil)

    Optional parameter: This is the urbanization

  • zip_code (String) (defaults to: nil)

    Optional parameter: This is the 5-digit ZIP

  • zip_plus4 (String) (defaults to: nil)

    Optional parameter: This is the 4-digit

  • lat (Float) (defaults to: nil)

    Optional parameter: The latitude geo coordinate.

  • long (Float) (defaults to: nil)

    Optional parameter: The longitude geo coordinate.

  • post_office_type (Array[PostOfficeType1]) (defaults to: nil)

    Optional parameter: The

  • mailing_service (Array[MailingService]) (defaults to: nil)

    Optional parameter: Mailing

  • business_service (Array[BusinessService]) (defaults to: nil)

    Optional parameter:

  • passport_service (Array[PassportService]) (defaults to: nil)

    Optional parameter:

  • pickup_service (Array[PickupService]) (defaults to: nil)

    Optional parameter: Pick-Up

  • financial_service (Array[FinancialService]) (defaults to: nil)

    Optional parameter:

  • hours (Hours) (defaults to: nil)

    Optional parameter: Limit the response Post Office

  • radius (Integer) (defaults to: 20)

    Optional parameter: The max distance (in miles)

  • length (Float) (defaults to: nil)

    Optional parameter: This is the package length in

  • width (Float) (defaults to: nil)

    Optional parameter: This is the package width in

  • height (Float) (defaults to: nil)

    Optional parameter: This is the package height in

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
# File 'lib/usps_api/apis/resources_api.rb', line 4064

def get_post_office_location(scope,
                             street_address: nil,
                             secondary_address: nil,
                             city: nil,
                             state: nil,
                             urbanization: nil,
                             zip_code: nil,
                             zip_plus4: nil,
                             lat: nil,
                             long: nil,
                             post_office_type: nil,
                             mailing_service: nil,
                             business_service: nil,
                             passport_service: nil,
                             pickup_service: nil,
                             financial_service: nil,
                             hours: nil,
                             radius: 20,
                             length: nil,
                             width: nil,
                             height: nil,
                             offset: nil,
                             limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/post-office-locations',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(street_address, key: 'streetAddress'))
               .query_param(new_parameter(secondary_address, key: 'secondaryAddress'))
               .query_param(new_parameter(city, key: 'city'))
               .query_param(new_parameter(state, key: 'state'))
               .query_param(new_parameter(urbanization, key: 'urbanization'))
               .query_param(new_parameter(zip_code, key: 'ZIPCode'))
               .query_param(new_parameter(zip_plus4, key: 'ZIPPlus4'))
               .query_param(new_parameter(lat, key: 'LAT'))
               .query_param(new_parameter(long, key: 'LONG'))
               .query_param(new_parameter(post_office_type, key: 'postOfficeType'))
               .query_param(new_parameter(mailing_service, key: 'mailingService'))
               .query_param(new_parameter(business_service, key: 'businessService'))
               .query_param(new_parameter(passport_service, key: 'passportService'))
               .query_param(new_parameter(pickup_service, key: 'pickupService'))
               .query_param(new_parameter(financial_service, key: 'financialService'))
               .query_param(new_parameter(hours, key: 'hours'))
               .query_param(new_parameter(radius, key: 'radius'))
               .query_param(new_parameter(length, key: 'length'))
               .query_param(new_parameter(width, key: 'width'))
               .query_param(new_parameter(height, key: 'height'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3PostOfficeLocationsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid Address Information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#get_rate_list(scope, body: nil) ⇒ ApiResponse

Given size/weight/destination of pieces, returns a list of potential rates. Can also search for contract rates by providing mailer id, EPS, permit number or vendor number and account. If searching for contract rates, then a specified mail class is required. determines the level of access and permissions for the API. The value of this parameter should be set to “international-prices” for international-prices-related operations. parameters to be used for the query.

Parameters:

  • scope (Scope9)

    Required parameter: The scope of the request, which

  • body (InternationalRateListQuery) (defaults to: nil)

    Optional parameter: The search

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
# File 'lib/usps_api/apis/resources_api.rb', line 2785

def get_rate_list(scope,
                  body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/base-rates-list/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalRateListQueryResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_reconciliation_adjustments(scope, crid, event_type, start_date, start_time, end_date, end_time, page_num: 20, page_size: 20) ⇒ ApiResponse

The Reconciliation Adjustments API enables users to receive USPS Ship adjustments by a Package Identification Code (PIC) aka Tracking Number. determines the level of access and permissions for the API. The value of this parameter should be set to “reconciliation-adjustments” for reconciliation-adjustments-related operations. type. representation of start date the reconciliation adjustment event occurred, in the format of YYYYMMDD. representation of start time the reconciliation adjustment event occurred, in the format of HHMMSS. representation of end date the reconciliation adjustment event occurred, in the format of YYYYMMDD. representation of end time the reconciliation adjustment event occurred, in the format of HHMMSS. return

Parameters:

  • scope (Scope21)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: Filter by CRID.

  • event_type (AdjustmentSubtype)

    Required parameter: Filter by event

  • start_date (String)

    Required parameter: The human-readable

  • start_time (String)

    Required parameter: The human-readable

  • end_date (String)

    Required parameter: The human-readable

  • end_time (String)

    Required parameter: The human-readable

  • page_num (Integer) (defaults to: 20)

    Optional parameter: The page number to return

  • page_size (Integer) (defaults to: 20)

    Optional parameter: The number of items to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
# File 'lib/usps_api/apis/resources_api.rb', line 5342

def get_reconciliation_adjustments(scope,
                                   crid,
                                   event_type,
                                   start_date,
                                   start_time,
                                   end_date,
                                   end_time,
                                   page_num: 20,
                                   page_size: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/reconciliation-adjustments/{CRID}/{eventType}/{startDate}/{startTime}/{endDate}/{endTime}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(event_type, key: 'eventType')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(start_date, key: 'startDate')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(start_time, key: 'startTime')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(end_date, key: 'endDate')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(end_time, key: 'endTime')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(page_num, key: 'pageNum'))
               .query_param(new_parameter(page_size, key: 'pageSize'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3ReconciliationAdjustmentsEventTypeStartDateStartTimeEndDateEndTimeResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_return_valid_zip5_codes(scope) ⇒ ApiResponse

**Return valid 5-digit Origin and Destination ZIP codes that have service standards associated with them and are not exempt. determines the level of access and permissions for the API. The value of this parameter should be set to “service-standards-directory” for service-standards-directory-related operations.

Parameters:

  • scope (Scope24)

    Required parameter: The scope of the request, which

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
# File 'lib/usps_api/apis/resources_api.rb', line 5746

def get_return_valid_zip5_codes(scope)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/zip5Codes',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Zip5CodesResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource not found.',
                             AddressesErrorException)
                .local_error('500',
                             'Internal server error.',
                             AddressesErrorException))
    .execute
end

#get_service_standards(scope, origin_zip_code, destination_zip_code, mail_class: nil, destination_type: DestinationType::STREET, service_type_codes: nil, destination_entry_facility_type: nil, weight: nil, length: nil, height: nil, width: nil, dimensions_uom: DimensionsUom::ENUM_IN, rate_holder_crid: nil, presort: false) ⇒ ApiResponse

Returns the average number of days it will take a package to arrive at its destination for the selected mail class. When requesting standards for USPS_GROUND_ADVANTAGE two standards will be returned (one for packages greater than or equal to a pound and one for packages less than a pound, this will be called out in the notes field), unless a weight is provided. determines the level of access and permissions for the API. The value of this parameter should be set to “service-standards” for service-standards-related operations. where the package is shipped from using either all 9 digits, 5 digits, or first 3 digits. Code&#8482; where the package is shipped to using either all 9 digits or 5 digits. divides mail into different services, called “classes.” Each class of mail has different features, service levels, postage prices, and presort requirements. Note: Mail class enumerations “LETTERS”, “CARDS”, and FLATS“ are specific to First Class Mail only. type indicator for non-expedited mailing. Defaults to ‘STREET’ if omitted. are designators used to represent USPS classes of mail in conjunction with the type of Extra Service(s) being requested. For valid Service Type Code options, please refer to the [Service Type Code list](postalpro.usps.com/IMPB_Service_Type_Codes). Optional parameter: Types of Facilities: * NONE * DESTINATION_NETWORK_DISTRIBUTION_CENTER * DESTINATION_SECTIONAL_CENTER_FACILITY * DESTINATION_DELIVERY_UNIT * DESTINATION_SERVICE_HUB shipped. Required if looking up ‘USPS_GROUND_ADVANTAGE` estimates or standards. For getting estimates with `USPS_GROUND_ADVANTAGE`, if the package weight is greater than one pound then weight will be required. dimensionsUOM. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required only for Priority Mail Next Day packages. dimensionsUOM. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required only for Priority Mail Next Day packages. dimensionsUOM. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required only for Priority Mail Next Day packages. of measure * in - Inches ID (CRID) associated with the business or mailer. whether the Presort feature is to be used for this mail piece. Presort is only available for `mailClass` values of `LETTERS`, `FLATS`, or `CARDS`.

Parameters:

  • scope (Scope23)

    Required parameter: The scope of the request, which

  • origin_zip_code (String)

    Required parameter: The ZIP Code&#8482;

  • destination_zip_code (String)

    Required parameter: The ZIP

  • mail_class (MailClass8) (defaults to: nil)

    Optional parameter: The Postal Service

  • destination_type (DestinationType) (defaults to: DestinationType::STREET)

    Optional parameter: Destination

  • service_type_codes (String) (defaults to: nil)

    Optional parameter: Service Type Codes

  • destination_entry_facility_type (DestinationEntryFacilityType4) (defaults to: nil)
  • weight (Float) (defaults to: nil)

    Optional parameter: The weight of the package being

  • length (Float) (defaults to: nil)

    Optional parameter: The length of the container, in

  • height (Float) (defaults to: nil)

    Optional parameter: The height of the container, in

  • width (Float) (defaults to: nil)

    Optional parameter: The width of the container, in

  • dimensions_uom (DimensionsUom) (defaults to: DimensionsUom::ENUM_IN)

    Optional parameter: Dimensions unit

  • rate_holder_crid (String) (defaults to: nil)

    Optional parameter: Customer Registration

  • presort (TrueClass | FalseClass) (defaults to: false)

    Optional parameter: Indicates

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
# File 'lib/usps_api/apis/resources_api.rb', line 5675

def get_service_standards(scope,
                          origin_zip_code,
                          destination_zip_code,
                          mail_class: nil,
                          destination_type: DestinationType::STREET,
                          service_type_codes: nil,
                          destination_entry_facility_type: nil,
                          weight: nil,
                          length: nil,
                          height: nil,
                          width: nil,
                          dimensions_uom: DimensionsUom::ENUM_IN,
                          rate_holder_crid: nil,
                          presort: false)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/standards',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(origin_zip_code, key: 'originZIPCode')
                             .is_required(true))
               .query_param(new_parameter(destination_zip_code, key: 'destinationZIPCode')
                             .is_required(true))
               .query_param(new_parameter(mail_class, key: 'mailClass'))
               .query_param(new_parameter(destination_type, key: 'destinationType'))
               .query_param(new_parameter(service_type_codes, key: 'serviceTypeCodes'))
               .query_param(new_parameter(destination_entry_facility_type, key: 'destinationEntryFacilityType'))
               .query_param(new_parameter(weight, key: 'weight'))
               .query_param(new_parameter(length, key: 'length'))
               .query_param(new_parameter(height, key: 'height'))
               .query_param(new_parameter(width, key: 'width'))
               .query_param(new_parameter(dimensions_uom, key: 'dimensionsUOM'))
               .query_param(new_parameter(rate_holder_crid, key: 'rateHolderCRID'))
               .query_param(new_parameter(presort, key: 'presort'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Standard.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request',
                             ServiceStandardsErrorException)
                .local_error('401',
                             'Unauthorized request',
                             ServiceStandardsErrorException)
                .local_error('403',
                             'Access is denied',
                             ServiceStandardsErrorException)
                .local_error('404',
                             'Resource Not Found',
                             ServiceStandardsErrorException)
                .local_error('503',
                             'Service Unavailable',
                             ServiceStandardsErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_service_standards_estimates(scope, origin_zip_code, destination_zip_code, acceptance_date: nil, acceptance_time: nil, mail_class: nil, destination_type: DestinationType::STREET, service_type_codes: nil, destination_entry_facility_type: nil, weight: nil, weight_uom: WeightUom::LB, length: nil, height: nil, width: nil, dimensions_uom: DimensionsUom::ENUM_IN, rate_holder_crid: nil, presort: false) ⇒ ApiResponse

Allows customers to get estimates on delivery standards between 3 or 5 digit ZIP Code&#8482;s for the selected mail classes. When requesting estimates for USPS_GROUND_ADVANTAGE two estimates will be returned (one for packages greater than or equal to a pound and one for packages less than a pound. This will be called out in the notes field) unless a weight is provided. determines the level of access and permissions for the API. The value of this parameter should be set to “service-standards” for service-standards-related operations. where the package is shipped from using either all 9 digits, 5 digits, or first 3 digits. Code&#8482; where the package is shipped to using either all 9 digits or 5 digits. mailed. Acceptance date may be up to 30 days in advance. Today’s date is used if omitted. mailed. Today’s time defaults to 8:00 am if omitted. divides mail into different services, called “classes.” Each class of mail has different features, service levels, postage prices, and presort requirements. Note: Mail class enumerations “LETTERS”, “CARDS”, and FLATS“ are specific to First Class Mail only. type indicator for non-expedited mailing. Defaults to ‘STREET’ if omitted. are designators used to represent USPS classes of mail in conjunction with the type of Extra Service(s) being requested. For valid Service Type Code options, please refer to the [Service Type Code list](postalpro.usps.com/IMPB_Service_Type_Codes). Optional parameter: Types of Facilities: * NONE * DESTINATION_NETWORK_DISTRIBUTION_CENTER * DESTINATION_SECTIONAL_CENTER_FACILITY * DESTINATION_DELIVERY_UNIT * DESTINATION_SERVICE_HUB shipped. For getting estimates with ‘USPS_GROUND_ADVANTAGE`, if the package weight is greater than one pound then weight will be required. `weight` is also required for Priority Mail Next Day packages and must be no greater than 20 pounds. If the package is greater than 20 pounds, it will be treated as standard Priority Mail. Measurement * lb - Pounds dimensionsUOM. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required only for Priority Mail Next Day packages. dimensionsUOM. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required only for Priority Mail Next Day packages. dimensionsUOM. If partial dimensions are provided, an error response will return. `length`, `width`, and `height` are required only for Priority Mail Next Day packages. of measure * in - Inches ID (CRID) associated with the business or mailer. whether the Presort feature is to be used for this mail piece. Presort is only available for `mailClass` values of `LETTERS`, `FLATS`, or `CARDS`.

Parameters:

  • scope (Scope23)

    Required parameter: The scope of the request, which

  • origin_zip_code (String)

    Required parameter: The ZIP Code&#8482;

  • destination_zip_code (String)

    Required parameter: The ZIP

  • acceptance_date (Date) (defaults to: nil)

    Optional parameter: Date Package will be

  • acceptance_time (String) (defaults to: nil)

    Optional parameter: Time Package will be

  • mail_class (MailClass8) (defaults to: nil)

    Optional parameter: The Postal Service

  • destination_type (DestinationType) (defaults to: DestinationType::STREET)

    Optional parameter: Destination

  • service_type_codes (String) (defaults to: nil)

    Optional parameter: Service Type Codes

  • destination_entry_facility_type (DestinationEntryFacilityType4) (defaults to: nil)
  • weight (Float) (defaults to: nil)

    Optional parameter: The weight of the package being

  • weight_uom (WeightUom) (defaults to: WeightUom::LB)

    Optional parameter: Weight Unit of

  • length (Float) (defaults to: nil)

    Optional parameter: The length of the container, in

  • height (Float) (defaults to: nil)

    Optional parameter: The height of the container, in

  • width (Float) (defaults to: nil)

    Optional parameter: The width of the container, in

  • dimensions_uom (DimensionsUom) (defaults to: DimensionsUom::ENUM_IN)

    Optional parameter: Dimensions unit

  • rate_holder_crid (String) (defaults to: nil)

    Optional parameter: Customer Registration

  • presort (TrueClass | FalseClass) (defaults to: false)

    Optional parameter: Indicates

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
# File 'lib/usps_api/apis/resources_api.rb', line 5548

def get_service_standards_estimates(scope,
                                    origin_zip_code,
                                    destination_zip_code,
                                    acceptance_date: nil,
                                    acceptance_time: nil,
                                    mail_class: nil,
                                    destination_type: DestinationType::STREET,
                                    service_type_codes: nil,
                                    destination_entry_facility_type: nil,
                                    weight: nil,
                                    weight_uom: WeightUom::LB,
                                    length: nil,
                                    height: nil,
                                    width: nil,
                                    dimensions_uom: DimensionsUom::ENUM_IN,
                                    rate_holder_crid: nil,
                                    presort: false)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/estimates',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(origin_zip_code, key: 'originZIPCode')
                             .is_required(true))
               .query_param(new_parameter(destination_zip_code, key: 'destinationZIPCode')
                             .is_required(true))
               .query_param(new_parameter(acceptance_date, key: 'acceptanceDate'))
               .query_param(new_parameter(acceptance_time, key: 'acceptanceTime'))
               .query_param(new_parameter(mail_class, key: 'mailClass'))
               .query_param(new_parameter(destination_type, key: 'destinationType'))
               .query_param(new_parameter(service_type_codes, key: 'serviceTypeCodes'))
               .query_param(new_parameter(destination_entry_facility_type, key: 'destinationEntryFacilityType'))
               .query_param(new_parameter(weight, key: 'weight'))
               .query_param(new_parameter(weight_uom, key: 'weightUOM'))
               .query_param(new_parameter(length, key: 'length'))
               .query_param(new_parameter(height, key: 'height'))
               .query_param(new_parameter(width, key: 'width'))
               .query_param(new_parameter(dimensions_uom, key: 'dimensionsUOM'))
               .query_param(new_parameter(rate_holder_crid, key: 'rateHolderCRID'))
               .query_param(new_parameter(presort, key: 'presort'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Estimate.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request',
                             ServiceStandardsErrorException)
                .local_error('401',
                             'Unauthorized request',
                             ServiceStandardsErrorException)
                .local_error('403',
                             'Access is denied',
                             ServiceStandardsErrorException)
                .local_error('404',
                             'Resource Not Found',
                             ServiceStandardsErrorException)
                .local_error('503',
                             'Service Unavailable',
                             ServiceStandardsErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_single_label_branding(scope, image_uuid, x_payment_authorization_token) ⇒ ApiResponse

Retrieve a label branding image associated with your customer reference ID (CRID). The CRID will be taken from the ‘LABEL_OWNER` role of your Payment Authorization token. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. branding image Authorization Token from the payments API Call.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • image_uuid (String)

    Required parameter: The UUID of a label

  • x_payment_authorization_token (String)

    Required parameter: Payment

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
# File 'lib/usps_api/apis/resources_api.rb', line 3681

def get_single_label_branding(scope,
                              image_uuid,
                              x_payment_authorization_token)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/branding/{imageUUID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(image_uuid, key: 'imageUUID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelBrandingGetImageResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_single_package_campaign(scope, crid, campaign_id) ⇒ ApiResponse

Retrieve details of a single Informed Delivery package campaign by CRID and campaign ID determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-package-campaigns” for informed-delivery-package-campaigns-related operations. Registration ID (CRID). campaign.

Parameters:

  • scope (Scope7)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • campaign_id (String)

    Required parameter: Unique identifier for the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
# File 'lib/usps_api/apis/resources_api.rb', line 2209

def get_single_package_campaign(scope,
                                crid,
                                campaign_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SinglePackageCampaignResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryPackageCampaignsQueryErrorResponseException))
    .execute
end

#get_subscriptions_adjustment(scope, crid, offset: nil, limit: 20) ⇒ ApiResponse

Get list of all Adjustment Subscriptions you have created, by CRID determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-adjustments” for subscriptions-adjustments-related operations. separated list of values. before returning the results

Parameters:

  • scope (Scope28)

    Required parameter: The scope of the request, which

  • crid (Array[String])

    Required parameter: Filter by CRID. Comma

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
# File 'lib/usps_api/apis/resources_api.rb', line 5956

def get_subscriptions_adjustment(scope,
                                 crid,
                                 offset: nil,
                                 limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(crid, key: 'CRID')
                             .is_required(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3SubscriptionsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid label request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#get_subscriptions_adjustment_id(scope, subscription_id) ⇒ ApiResponse

Get a previously created subscription by its unique id. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-adjustments” for subscriptions-adjustments-related operations. of the subscription.

Parameters:

  • scope (Scope28)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
# File 'lib/usps_api/apis/resources_api.rb', line 6058

def get_subscriptions_adjustment_id(scope,
                                    subscription_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsAdjustmentsSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_dispute(scope, crid, offset: nil, limit: 20) ⇒ ApiResponse

Get list of all Disputes Subscriptions you have created, by CRID determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-disputes” for subscriptions-disputes-related operations. separated list of values. before returning the results

Parameters:

  • scope (Scope29)

    Required parameter: The scope of the request, which

  • crid (Array[String])

    Required parameter: Filter by CRID. Comma

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
# File 'lib/usps_api/apis/resources_api.rb', line 6227

def get_subscriptions_dispute(scope,
                              crid,
                              offset: nil,
                              limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(crid, key: 'CRID')
                             .is_required(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3SubscriptionsResponse1.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid label request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#get_subscriptions_dispute_id(scope, subscription_id) ⇒ ApiResponse

Get a previously created subscription by its unique id. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-disputes” for subscriptions-disputes-related operations. of the subscription.

Parameters:

  • scope (Scope29)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
# File 'lib/usps_api/apis/resources_api.rb', line 6329

def get_subscriptions_dispute_id(scope,
                                 subscription_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsDisputesSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_ncoa(scope, crid: nil, offset: nil, limit: 20) ⇒ ApiResponse

Get list of all NCOA Subscriptions you have created, by CRID. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-ncoa” for subscriptions-ncoa-related operations. list of values. before returning the results

Parameters:

  • scope (Scope30)

    Required parameter: The scope of the request, which

  • crid (String) (defaults to: nil)

    Optional parameter: Filter by CRID. Comma-separated

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
# File 'lib/usps_api/apis/resources_api.rb', line 6498

def get_subscriptions_ncoa(scope,
                           crid: nil,
                           offset: nil,
                           limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(crid, key: 'CRID'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid label request information.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_ncoa_id(scope, subscription_id) ⇒ ApiResponse

Get a previously created subscription by its unique id. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-ncoa” for subscriptions-ncoa-related operations. of the subscription.

Parameters:

  • scope (Scope30)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
# File 'lib/usps_api/apis/resources_api.rb', line 6598

def get_subscriptions_ncoa_id(scope,
                              subscription_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsNcoaSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_package_transaction_details(scope, crid, offset: nil, limit: 20) ⇒ ApiResponse

Get list of all Package Transaction Details Subscriptions you have created, by CRID determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-package-transaction-details” for subscriptions-package-transaction-details-related operations. separated list of values. before returning the results

Parameters:

  • scope (Scope31)

    Required parameter: The scope of the request, which

  • crid (Array[String])

    Required parameter: Filter by CRID. Comma

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
# File 'lib/usps_api/apis/resources_api.rb', line 6769

def get_subscriptions_package_transaction_details(scope,
                                                  crid,
                                                  offset: nil,
                                                  limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(crid, key: 'CRID')
                             .is_required(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3SubscriptionsResponse2.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid label request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#get_subscriptions_package_transaction_details_id(scope, subscription_id) ⇒ ApiResponse

Get a previously created subscription by its unique id. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-package-transaction-details” for subscriptions-package-transaction-details-related operations. of the subscription.

Parameters:

  • scope (Scope31)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
# File 'lib/usps_api/apis/resources_api.rb', line 6873

def get_subscriptions_package_transaction_details_id(scope,
                                                     subscription_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsPackageTransactionDetailsSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_tracking(scope, mid: nil, tracking_number: nil, offset: nil, limit: 20) ⇒ ApiResponse

Get list of all Tracking Subscriptions you have created, by MID or Tracking Number. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-tracking” for subscriptions-tracking-related operations. Comma-separated list of values. tracking number. Comma-separated list of values. before returning the results

Parameters:

  • scope (Scope32)

    Required parameter: The scope of the request, which

  • mid (Array[String]) (defaults to: nil)

    Optional parameter: Filter by MID.

  • tracking_number (Array[String]) (defaults to: nil)

    Optional parameter: Filter by

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
# File 'lib/usps_api/apis/resources_api.rb', line 7048

def get_subscriptions_tracking(scope,
                               mid: nil,
                               tracking_number: nil,
                               offset: nil,
                               limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(mid, key: 'MID'))
               .query_param(new_parameter(tracking_number, key: 'trackingNumber'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(V3SubscriptionsResponse3.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid label request information.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_tracking_id(scope, subscription_id) ⇒ ApiResponse

Get a previously created subscription by its unique id. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-tracking” for subscriptions-tracking-related operations. of the subscription.

Parameters:

  • scope (Scope32)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
# File 'lib/usps_api/apis/resources_api.rb', line 7151

def get_subscriptions_tracking_id(scope,
                                  subscription_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsTrackingSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_unpaid_packages(scope, crid, offset: nil, limit: 20) ⇒ ApiResponse

“Get list of all Unpaid Packages Subscriptions you have created, by CRID” determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-unpaid-packages” for subscriptions-unpaid-packages-related operations. Comma-separated list of values. before returning the results

Parameters:

  • scope (Scope33)

    Required parameter: The scope of the request, which

  • crid (Array[String])

    Required parameter: Filter by CRID.

  • offset (Integer) (defaults to: nil)

    Optional parameter: The number of items to skip

  • limit (Integer) (defaults to: 20)

    Optional parameter: The number of items to return

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
# File 'lib/usps_api/apis/resources_api.rb', line 7320

def get_subscriptions_unpaid_packages(scope,
                                      crid,
                                      offset: nil,
                                      limit: 20)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(crid, key: 'CRID')
                             .is_required(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsUnpaidPackagesSubscription.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Invalid label request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_subscriptions_unpaid_packages_id(scope, subscription_id) ⇒ ApiResponse

Get a previously created subscription by its unique id. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-unpaid-packages” for subscriptions-unpaid-packages-related operations. of the subscription.

Parameters:

  • scope (Scope33)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
# File 'lib/usps_api/apis/resources_api.rb', line 7423

def get_subscriptions_unpaid_packages_id(scope,
                                         subscription_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsUnpaidPackagesSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_summary_data(scope, crid, callback_key) ⇒ ApiResponse

Return summary-level information on a single callback key transaction determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). associated with the campaign.

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • callback_key (String)

    Required parameter: The callback key

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
# File 'lib/usps_api/apis/resources_api.rb', line 1935

def get_summary_data(scope,
                     crid,
                     callback_key)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}/{callbackKey}/summary',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(callback_key, key: 'callbackKey')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SummarySuccessResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsQueryErrorResponseException))
    .execute
end

#get_user_profile(scope) ⇒ ApiResponse

Get user account profile information. Based on the 'OpenID Connect Core 1.0', Final, November 2014, see [OpenID Foundation](openid.net/specs/openid-connect-core-1_0.html#UserInfo ). For userinfo, see openid.net/specs/openid-connect-core-1_0.html#UserInfo. Must use the Bearer authentication scheme.

```
Authorization: Bearer

eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1c3BzLmNvbSIsInN1YiI6IjI0ODI4OTc2MTAwMSIsI mF1ZCI6InM2QmhkUmtxdDMiLCJub25jZSI6Im4tMFM2X1d6QTJNaiIsImV4cCI6MTMxMTI4MTk 3MCwiaWF0IjoxMzExMjgwOTcwLCJuYW1lIjoiSmFuZSBEb2UiLCJnaXZlbl9uYW1lIjoiSmFuZ SIsImZhbWlseV9uYW1lIjoiRG9lIiwibG9jYWxlIjoiZW4tdXMiLCJhenAiOiJ1c3BzLmNvbSI sImFjciI6IkFBTDEiLCJhbXIiOiJwd2QifQ.qJ2SUGKn4TabFfMYODW1RLxirFmeeYPDyFvuJR 0ywRVaRnoe7Rlk8yKM3v2fCBUi2lMo00whNhNWmqQktpGgvkVGWXGMNIlVxJCqt_aPFx3oOvkh KWGI49JI5NyXrpj4tfYD5pIYbrihkF7eMYG3XyqYMx1VLhhV0PmWhpq787K7_AGfRlNVQnD_WE HJt4SoEnsiw8vcwDWXcXr5yCzAEn8mfCSTlamqVBUyey1Fyg_xgQIRj_b9CO-O4kXsBM3vqo5C O2qET2tRd37niaQvV-g418sEpnw1iAtxWfcyU4IIjWlQa7AxAc3T4Vx6XOwn1CNI22ZhdaBskU tD-EexWQ

```

determines the level of access and permissions for the API. The value of this parameter should be set to “oauth2-oidc” for oauth2-oidc-related operations.

Parameters:

  • scope (Scope34)

    Required parameter: The scope of the request, which

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
# File 'lib/usps_api/apis/resources_api.rb', line 7606

def (scope)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/userinfo',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResourceOwnerUserClaims.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  Check the input parameters and values.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized Request.  Check the authentication scheme and'\
                              ' values being used to make the request.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#get_zip_code(scope, street_address, city, state, firm: nil, secondary_address: nil, zip_code: nil, zip_plus4: nil) ⇒ ApiResponse

Returns the ZIP Code&#8482; and ZIP + 4&#174; corresponding to the given address, city, and state (use USPS state abbreviations). determines the level of access and permissions for the API. The value of this parameter should be set to “addresses” for addresses-related operations. building along with the name of the road or street on which it is located. address. code of the address. the address. designator, such as apartment(APT) or suite(STE) number, defining the exact location of the address within a building. For more information please see [Postal Explorer](pe.usps.com/text/pub28/28c2_003.htm). code. component of the ZIP+4 code. Using the correct ZIP+4 reduces the number of times your mail is handled and can decrease the chance of a misdelivery or error.

Parameters:

  • scope (Scope)

    Required parameter: The scope of the request, which

  • street_address (String)

    Required parameter: The number of a

  • city (String)

    Required parameter: This is the city name of the

  • state (String)

    Required parameter: This is the two-character state

  • firm (String) (defaults to: nil)

    Optional parameter: Firm/business corresponding to

  • secondary_address (String) (defaults to: nil)

    Optional parameter: The secondary unit

  • zip_code (String) (defaults to: nil)

    Optional parameter: This is the 5-digit ZIP

  • zip_plus4 (String) (defaults to: nil)

    Optional parameter: This is the 4-digit

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/usps_api/apis/resources_api.rb', line 172

def get_zip_code(scope,
                 street_address,
                 city,
                 state,
                 firm: nil,
                 secondary_address: nil,
                 zip_code: nil,
                 zip_plus4: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/zipcode',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(street_address, key: 'streetAddress')
                             .is_required(true))
               .query_param(new_parameter(city, key: 'city')
                             .is_required(true))
               .query_param(new_parameter(state, key: 'state')
                             .is_required(true))
               .query_param(new_parameter(firm, key: 'firm'))
               .query_param(new_parameter(secondary_address, key: 'secondaryAddress'))
               .query_param(new_parameter(zip_code, key: 'ZIPCode'))
               .query_param(new_parameter(zip_plus4, key: 'ZIPPlus4'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ZipCode8482Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#patch_label_branding(scope, image_uuid, x_payment_authorization_token, body) ⇒ ApiResponse

Rename the previously uploaded Label Branding Image associated with your customer reference ID (CRID). The CRID will be taken from the ‘LABEL_OWNER` role of your Payment Authorization token. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. branding image Authorization Token from the payments API Call. description here

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • image_uuid (String)

    Required parameter: The UUID of a label

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (Array[LabelsJsonPatchRequest])

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
# File 'lib/usps_api/apis/resources_api.rb', line 3793

def patch_label_branding(scope,
                         image_uuid,
                         x_payment_authorization_token,
                         body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/{scope}/v3/branding/{imageUUID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(image_uuid, key: 'imageUUID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelBrandingImagePatchResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#patch_label_edit(scope, tracking_number, x_payment_authorization_token, body) ⇒ ApiResponse

Allow customers to edit package attributes for previously created labels including weight, dimensions, rate indicator, processing category and containers. These fields eligible for editing will not impact label images, so previous label images can still be used. Changing these rate ingredients may affect the prices of the label. Therefore, the Payment Authorization token is required. Note: Label edits will not be supported for the following scenarios; instead, unused label refunds should be requested and new labels should be created.

  • All label edits are disallowed if the original label was created with

‘suppressPostage = false`.

  • No dimensional updates are supported for Cubic Soft Pack labels.

  • Cubic labels cannot be edited to non-cubic rate indicators.

determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. the domestic label. Authorization Token from the payments API Call. type description here

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • tracking_number (String)

    Required parameter: The tracking number of

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (Array[LabelsJsonPatchRequest1])

    Required parameter: TODO:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
# File 'lib/usps_api/apis/resources_api.rb', line 3307

def patch_label_edit(scope,
                     tracking_number,
                     x_payment_authorization_token,
                     body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/{scope}/v3/label/{trackingNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelMetadata.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_add_imb(scope, crid, campaign_id, body) ⇒ ApiResponse

Add IMBs to an existing NON-SEQ campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). Informed Delivery campaign, generated internally by Informed Delivery and returned for successfully created campaigns. here

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • campaign_id (String)

    Required parameter: Unique identifier for an

  • body (ImBsRequest)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
# File 'lib/usps_api/apis/resources_api.rb', line 1811

def post_add_imb(scope,
                 crid,
                 campaign_id,
                 body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}/pieces',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ImBsResponseLessThan25Success.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException))
    .execute
end

#post_base_rates_search(scope, body: nil) ⇒ ApiResponse

Returns an eligible price given a set of package rate ingredients. determines the level of access and permissions for the API. The value of this parameter should be set to “prices” for prices-related operations. be used for the query.

Parameters:

  • scope (Scope5)

    Required parameter: The scope of the request, which

  • body (BaseRatesQuery) (defaults to: nil)

    Optional parameter: The search parameters to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/usps_api/apis/resources_api.rb', line 1048

def post_base_rates_search(scope,
                           body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/base-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PricesBaseRatesQueryResult1.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_campaigns(scope, crid, body) ⇒ ApiResponse

Create a new Informed Delivery campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID).

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • body (Campaign)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
# File 'lib/usps_api/apis/resources_api.rb', line 1404

def post_campaigns(scope,
                   crid,
                   body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/campaigns/{CRID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Campaign.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsErrorException)
                .local_error('401',
                             'Unauthorized',
                             InformedDeliveryCampaignsErrorException)
                .local_error('403',
                             'Forbidden',
                             InformedDeliveryCampaignsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             InformedDeliveryCampaignsErrorException)
                .local_error('503',
                             'Service Unavailable',
                             InformedDeliveryCampaignsErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end

#post_campaigns1(scope, crid, body) ⇒ ApiResponse

Create a new Informed Delivery package campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-package-campaigns” for informed-delivery-package-campaigns-related operations. Customer Registration ID (CRID). here

Parameters:

  • scope (Scope7)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The Package campaign submitter’s

  • body (PackageCampaign)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
# File 'lib/usps_api/apis/resources_api.rb', line 2036

def post_campaigns1(scope,
                    crid,
                    body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/campaigns/{CRID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PackageCampaign.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryPackageCampaignsErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end

#post_carrier_pickup(scope, body) ⇒ ApiResponse

Schedule a carrier pickup on a specified date. You can schedule pickups Monday - Saturday until 2:00 AM CT on the day of the pickup. After 2:00 AM CT, same-day pickup is not available. If the address is eligible for carrier pickup, then you can schedule your pickup up to one year in advance. determines the level of access and permissions for the API. The value of this parameter should be set to “pickup” for pickup-related operations. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/usps_api/apis/resources_api.rb', line 576

def post_carrier_pickup(scope,
                        body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/carrier-pickup',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PickupConfirmation.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PickupErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PickupErrorException)
                .local_error('403',
                             'Access is denied.',
                             PickupErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PickupErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             PickupErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_close(scope, x_payment_authorization_token, container_id, body) ⇒ ApiResponse

Allows the caller to close a container and generate a manifest. determines the level of access and permissions for the API. The value of this parameter should be set to “pmod” for pmod-related operations. Authorization Token from the payments API Call. container. This is the IMpb tracking number when impbContainerType is ‘OPEN_DISTRIBUTE_PALLET.’ For all other containers, this is the container ID. description here

Parameters:

  • scope (Scope17)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • container_id (String)

    Required parameter: Container ID for the OD

  • body (CloseOdContainerRequest)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
# File 'lib/usps_api/apis/resources_api.rb', line 4776

def post_close(scope,
               x_payment_authorization_token,
               container_id,
               body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/pmod/manifest/{container-id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .template_param(new_parameter(container_id, key: 'container-id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CloseOpenAndDistributeContainerResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PmodErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PmodErrorException)
                .local_error('403',
                             'Access is denied.',
                             PmodErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PmodErrorException)
                .local_error('503',
                             'Service is unavailable',
                             PmodErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_containers(scope, body: nil) ⇒ ApiResponse

Allows the caller to get a container label and associate packages to that container. determines the level of access and permissions for the API. The value of this parameter should be set to “containers” for containers-related operations. description here

Parameters:

  • scope (Scope4)

    Required parameter: The scope of the request, which

  • body (ContainersContainer) (defaults to: nil)

    Optional parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
# File 'lib/usps_api/apis/resources_api.rb', line 957

def post_containers(scope,
                    body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/containers',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:dynamic_deserializer))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             ContainersErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             ContainersErrorException)
                .local_error('403',
                             'Access is denied.',
                             ContainersErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             ContainersErrorException)
                .local_error('503',
                             'Service is unavailable',
                             ContainersErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_containers_with_container_id(scope, container_id, body: nil) ⇒ ApiResponse

This endpoint allows the caller to add additional items to an already created container. This endpoint can also be used to add items to Open and Distribute containers created through [Open and Distribute 3.0 - Create an Open and Distribute container](developers.usps.com/pmodv3#tag/Resources/operation/post -pmod). determines the level of access and permissions for the API. The value of this parameter should be set to “containers” for containers-related operations. container description here

Parameters:

  • scope (Scope4)

    Required parameter: The scope of the request, which

  • container_id (String)

    Required parameter: Container id for the

  • body (ContaineridPackagesBody) (defaults to: nil)

    Optional parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/usps_api/apis/resources_api.rb', line 801

def post_containers_with_container_id(scope,
                                      container_id,
                                      body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/containers/{container-id}/packages',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(container_id, key: 'container-id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ContainersContainer.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             ContainersErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             ContainersErrorException)
                .local_error('403',
                             'Access is denied.',
                             ContainersErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             ContainersErrorException)
                .local_error('503',
                             'Service is unavailable',
                             ContainersErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_dispute(body) ⇒ ApiResponse

Returns a dispute request details. be used for the query.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
# File 'lib/usps_api/apis/resources_api.rb', line 4373

def post_dispute(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/disputes/v3/dispute',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Dispute.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Error response',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException))
    .execute
end

#post_extra_service_rates_search(scope, body: nil) ⇒ ApiResponse

Returns eligible extra service prices, descriptions, and SKUs given a set of package rate ingredients. NOTE: The request using an integer (instead of an array) for extraServices is deprecated and will be removed in June 2025. determines the level of access and permissions for the API. The value of this parameter should be set to “prices” for prices-related operations. body Optional parameter: The search parameters to be used for the query.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/usps_api/apis/resources_api.rb', line 1101

def post_extra_service_rates_search(scope,
                                    body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/extra-service-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .validator(proc do |value|
                              UnionTypeLookUp.get(:PostExtraServiceRatesSearchBody)
                                             .validate(value)
                            end))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PricesExtraServiceRateDetail.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_fast_appointment(scope, body: nil) ⇒ ApiResponse

Create Appointment Request provides the ability to create an appointment. determines the level of access and permissions for the API. The value of this parameter should be set to “fast-appointments” for fast-appointments-related operations. corresponding to the supported grant types.

Parameters:

  • scope (Scope2)

    Required parameter: The scope of the request, which

  • body (Appointment) (defaults to: nil)

    Optional parameter: The input parameters

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/usps_api/apis/resources_api.rb', line 299

def post_fast_appointment(scope,
                          body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/fast-appointments/appointment',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Appointment.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             FastAppointmentsErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             FastAppointmentsErrorException)
                .local_error('403',
                             'Access is denied.',
                             FastAppointmentsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             FastAppointmentsErrorException)
                .local_error('503',
                             'Service is unavailable',
                             FastAppointmentsErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_get_user_profile(scope) ⇒ ApiResponse

Get user account profile information. Based on the 'OpenID Connect Core 1.0', Final, November 2014, see [OpenID Foundation](openid.net/specs/openid-connect-core-1_0.html#UserInfo ). For userinfo, see openid.net/specs/openid-connect-core-1_0.html#UserInfo. Must use the Bearer authentication scheme.

```
Authorization: Bearer

eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1c3BzLmNvbSIsInN1YiI6IjI0ODI4OTc2MTAwMSIsI mF1ZCI6InM2QmhkUmtxdDMiLCJub25jZSI6Im4tMFM2X1d6QTJNaiIsImV4cCI6MTMxMTI4MTk 3MCwiaWF0IjoxMzExMjgwOTcwLCJuYW1lIjoiSmFuZSBEb2UiLCJnaXZlbl9uYW1lIjoiSmFuZ SIsImZhbWlseV9uYW1lIjoiRG9lIiwibG9jYWxlIjoiZW4tdXMiLCJhenAiOiJ1c3BzLmNvbSI sImFjciI6IkFBTDEiLCJhbXIiOiJwd2QifQ.qJ2SUGKn4TabFfMYODW1RLxirFmeeYPDyFvuJR 0ywRVaRnoe7Rlk8yKM3v2fCBUi2lMo00whNhNWmqQktpGgvkVGWXGMNIlVxJCqt_aPFx3oOvkh KWGI49JI5NyXrpj4tfYD5pIYbrihkF7eMYG3XyqYMx1VLhhV0PmWhpq787K7_AGfRlNVQnD_WE HJt4SoEnsiw8vcwDWXcXr5yCzAEn8mfCSTlamqVBUyey1Fyg_xgQIRj_b9CO-O4kXsBM3vqo5C O2qET2tRd37niaQvV-g418sEpnw1iAtxWfcyU4IIjWlQa7AxAc3T4Vx6XOwn1CNI22ZhdaBskU tD-EexWQ

```

Parameters:

  • scope (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
# File 'lib/usps_api/apis/resources_api.rb', line 7662

def (scope)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/userinfo',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ResourceOwnerUserClaims.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  Check the input parameters and values.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized Request.  Check the authentication scheme and'\
                              ' values being used to make the request.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_indicia_imb(scope, x_payment_authorization_token, body) ⇒ ApiResponse

Generates an Intelligent Mail Barcode (IMB) label for First-Class letters, flats, and cards. [See specification USPS-B-3200](postalpro.usps.com/node/2190). Notes:

  • Only supported for ‘PAYER’ Roles with an EPS accountType.

  • When IMB labels are placed on letters, flats, or cards that are larger

than the label itself, the label should be placed in the top right corner in order to avoid delays in processing. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. Authorization Token from the payments API Call. here

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (IndiciaImbRequest)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
# File 'lib/usps_api/apis/resources_api.rb', line 3430

def post_indicia_imb(scope,
                     x_payment_authorization_token,
                     body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/indicia/imb',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IndiciaImbResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_international_indicia(scope, x_payment_authorization_token, body) ⇒ ApiResponse

Generates a First-Class Mail International indicia for use on letter, flat, and cards mailings. Note:

  • First-Class Mail International can be used for mailing correspondence

(no trading cards, bookmarks, stickers, etc.) or nonnegotiable documents (just paper; no cash, checks, or other items with cash value). No customs form is required.

  • Different countries have different rules on what can be mailed. Look up

your shipping destination in the [Index of Countries and Localities](pe.usps.com/text/Imm/immctry.htm) for specifics on what can and cannot be mailed with First-Class Mail International.

  • Only supported for ‘PAYER’ Roles with an EPS accountType.

  • Indicia should be placed in the top right corner of letters, flats, and

cards in order to avoid delays in processing.

  • An Indicia created using this endpoint is non-refundable.

determines the level of access and permissions for the API. The value of this parameter should be set to “international-labels” for international-labels-related operations. Authorization Token from the payments API Call. Indicia request payload containing necessary data for generating a First-Class Mail International indicia.

Parameters:

  • scope (Scope8)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (InternationalLabelsIndiciaRequest)

    Required parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
# File 'lib/usps_api/apis/resources_api.rb', line 2622

def post_international_indicia(scope,
                               x_payment_authorization_token,
                               body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/indicia',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalLabelsIndiciaResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_international_label(scope, x_payment_authorization_token, body, x_idempotency_key: nil) ⇒ ApiResponse

Generates a international shipping label based upon the input dimensions requested:

| Element                       | Description |
| ----------------------------- | --------|
| **toAddress**                 | International destination address of

the recipient. Used in pricing as the country. |

| **fromAddress**               | Domestic address where the package is

being mailed from. |

| **senderAddress**             | Domestic address of the business. Can

differ from the ‘fromAddress` in the case the business is using a third-party logistics provider or mailing from off-site locations. |

| **packageDescription**        | Package characteristics used to price

the shipment including requested mail class, weight, dimensions, and more. |

| **imageInfo**                 | Additional details used to update

label characteristics. |

| **customsForm**               | Additional details required for

sending international packages.| The default media type of the response has multiple parts. Setting the Accept header to either application/json or application/xml will only affect the metadata part of the multipart response. **How to use this API** The metadata part of the multipart response representation is only in application/json format media type, as default. The application/xml media type is not supported at this time. Ignore the Content-Encoding header in the second part, the label image file. The contents of this part are not compressed. Ignore the Content-Transfer-Encoding header in the second part, the label image file. The contents of this part are always Base64 encoded. Instructions Extract the first part of the multipart response as application/json media type. Extract the second part of the multipart response and Base64 decode it to yield the binary image file. Save the binary image file, given the Content-Type header value and the filename of this part (e.g. application/pdf, label.pdf). It is recommended that you run a virus scan on the resulting downloaded file. determines the level of access and permissions for the API. The value of this parameter should be set to “international-labels” for international-labels-related operations. Authorization Token from the payments API Call. description here that serves as an idempotency key for safe request retries and duplicate charge prevention during label creation. This value must be a randomly generated UUID and unique per customer (CRID) across all label creation requests. When the same idempotency key is resubmitted with an identical request payload, the API will return the existing label without creating a duplicate or charging additional postage. The UUID will be included in the electronic manifest data (Shipping Services File D5 field) sent to Postal systems.

Parameters:

  • scope (Scope8)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (InternationalPackageRequest)

    Required parameter: TODO: type

  • x_idempotency_key (UUID | String) (defaults to: nil)

    Optional parameter: A unique UUID

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
# File 'lib/usps_api/apis/resources_api.rb', line 2420

def post_international_label(scope,
                             x_payment_authorization_token,
                             body,
                             x_idempotency_key: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/international-label',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(x_idempotency_key, key: 'X-Idempotency-Key'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalPackageResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_label(scope, x_payment_authorization_token, body, x_idempotency_key: nil) ⇒ ApiResponse

Generates a shipping label based upon the following: | Element | Description | | —————————– | ——–| | toAddress | Address where the package is being shipped to. The ZIP Code™ in the ‘toAddress` object is used to calculate pricing. | | fromAddress | Address where the package is being shipped from. The ZIP Code™ in the `fromAddress` object is used to calculate pricing. | | senderAddress | Address of the business involved. The `senderAddress` can be different from the `fromAddress` when the business address is not where the package is being shipped from. | | returnAddress | Address where the package should be returned to if it is deemed undeliverable or returned to sender. This address will be printed in the return address block of the label. | | packageDescription | Package characteristics used to price the shipment including requested mail class, weight, dimensions, and more. | | imageInfo | Additional details used to determine how to generate the label image. | | customsForm | Additional details required when creating shipments originating from or destinating to MPOs, APOs, FPOs, or DPOs (Military, Army, Fleet, and Diplomatic Post Offices) and some Military and U.S., Possessions, Territories, and Freely Associated States (PTFAS).| The default media type of the response has multiple parts. Setting the Accept header to either application/json or application/xml will only affect the metadata part of the multipart response. **How to use this API** The metadata part of the multipart response representation is only in application/json format media type, as default. The application/xml media type is not supported at this time. Ignore the Content-Encoding header in the second part, the label image file. The contents of this part are not compressed. Ignore the Content-Transfer-Encoding header in the second part, the label image file. The contents of this part are always Base64 encoded. Ignore the Content-Encoding header in the third part, the receipt image file. The contents of this part are not compressed. Ignore the Content-Transfer-Encoding header in the third part, the receipt image file. The contents of this part are always Base64 encoded. Instructions Extract the first part of the multipart response as application/json media type. Extract the second part of the multipart response and Base64 decode it to yield the binary image file. Save the binary image file, given the Content-Type header value and the filename of this part (e.g. application/pdf, label.pdf). It is recommended that you run a virus scan on the resulting downloaded file. Extract the third part of the multipart response and Base64 decode it to yield the binary image file. Save the binary image file, given the Content-Type header value and the filename of this part (e.g. application/pdf, receipt.pdf). It is recommended that you run a virus scan on the resulting downloaded file. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. Authorization Token from the payments API Call. description here that serves as an idempotency key for safe request retries and duplicate charge prevention during label creation. This value must be a randomly generated UUID and unique per customer (CRID) across all label creation requests. When the same idempotency key is resubmitted with an identical request payload, the API will return the existing label without creating a duplicate or charging additional postage. The UUID will be included in the electronic manifest data (Shipping Services File D5 field) sent to Postal systems.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (DomesticPackageRequest)

    Required parameter: TODO: type

  • x_idempotency_key (UUID | String) (defaults to: nil)

    Optional parameter: A unique UUID

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
# File 'lib/usps_api/apis/resources_api.rb', line 3051

def (scope,
               x_payment_authorization_token,
               body,
               x_idempotency_key: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/label',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(x_idempotency_key, key: 'X-Idempotency-Key'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelPackageResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_label_branding(scope, x_payment_authorization_token, body) ⇒ ApiResponse

The USPS Logo Branding endpoint allows you to upload your custom image or logo to USPS APIs. A UUID is generated for your custom image to leverage for outbound Domestic Labels and Return Labels requests. The user will indicate how their custom image or multiple images will display, and the option to specify the shape of their image when generating labels and return labels. Note:

  • It may take up to 15 minutes for the label image to propagate to all

regions for label usage.

  • There is a limit of 100 images to be stored per customer reference ID

(CRID). The CRID will be taken from the ‘LABEL_OWNER` role of your Payment Authorization token.

  • The root svg element requires a ‘viewbox` attribute

  • The displayed aspect ratio of images on a label is 1:1 for square images

and 33:5 for rectangle images.

* Recommendation: Allow the artwork inside the viewbox to occupy 100% of

the space. This will allow your logo to be shown at the highest resolution possible.

  • ‘<script/>` element tags and `DOCTYPE` definitions are not allowed. The

‘<use/>` and `<image/>` tags are not allowed to use the attribute `xhref`. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. Authorization Token from the payments API Call. type description here

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (LabelBrandingImageUploadRequest)

    Required parameter: TODO:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
# File 'lib/usps_api/apis/resources_api.rb', line 3561

def (scope,
                        x_payment_authorization_token,
                        body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/branding',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(LabelBrandingImageUploadResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_label_indicia(scope, x_payment_authorization_token, body) ⇒ ApiResponse

Generates a First-Class indicia for use on letter, flat, or card mailings. Notes:

  • Only supported for ‘PAYER’ Roles with an EPS accountType.

  • Indicia should be placed in the top right corner of letters, flats, and

cards in order to avoid delays in processing.

  • An Indicia created using this endpoint is non-refundable and cannot be

refunded using the DELETE /indicia/imb endpoint. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. Authorization Token from the payments API Call. payload containing necessary data for generating a First-Class indicia.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (LabelsIndiciaRequest)

    Required parameter: Indicia request

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
# File 'lib/usps_api/apis/resources_api.rb', line 3370

def (scope,
                       x_payment_authorization_token,
                       body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/indicia',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalLabelsIndiciaResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_label_reprint(scope, tracking_number, x_payment_authorization_token, body) ⇒ ApiResponse

Reprint an international shipping label. Allows for different ‘ImageInfo` options to be specified.

  • Labels can only be reprinted up to the mailing date.

  • Labels can only be reprinted up to 3 times.

  • Canceled labels are not eligible for reprint.

determines the level of access and permissions for the API. The value of this parameter should be set to “international-labels” for international-labels-related operations. number of the label. Authorization Token from the payments API Call. TODO: type description here

Parameters:

  • scope (Scope8)

    Required parameter: The scope of the request, which

  • tracking_number (String)

    Required parameter: The unique tracking

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (InternationalLabelsLabelReprintRequest)

    Required parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
# File 'lib/usps_api/apis/resources_api.rb', line 2482

def (scope,
                       tracking_number,
                       x_payment_authorization_token,
                       body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/international-label-reprint/{trackingNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalLabelReprintResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_label_reprint1(scope, tracking_number, x_payment_authorization_token, body) ⇒ ApiResponse

Reprint a Domestic Outbound or Domestic Return shipping label. Allows for different ‘ImageInfo` options to be specified.

  • Receipts cannot be reprinted.

  • Labels can only be reprinted up to the mailing date.

  • Labels can only be reprinted up to 3 times.

  • Canceled labels are not eligible for reprint.

determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. the domestic label. Authorization Token from the payments API Call. description here

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • tracking_number (String)

    Required parameter: The tracking number of

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (LabelsLabelReprintRequest)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
# File 'lib/usps_api/apis/resources_api.rb', line 3857

def (scope,
                        tracking_number,
                        x_payment_authorization_token,
                        body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/label-reprint/{trackingNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(proc do |response, should_symbolize|
                  APIHelper.deserialize_union_type(
                    UnionTypeLookUp.get(:PostLabelReprint1Response),
                    response, should_symbolize, true
                  )
                end)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_letter_rates_search(scope, body: nil) ⇒ ApiResponse

Returns an eligible price given a set of letter rate ingredients for First-Class Mail. determines the level of access and permissions for the API. The value of this parameter should be set to “prices” for prices-related operations. to be used for the query.

Parameters:

  • scope (Scope5)

    Required parameter: The scope of the request, which

  • body (LetterRatesQuery) (defaults to: nil)

    Optional parameter: The search parameters

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
# File 'lib/usps_api/apis/resources_api.rb', line 1264

def post_letter_rates_search(scope,
                             body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/letter-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PricesLetterRatesQueryResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_letter_rates_search1(scope, body: nil) ⇒ ApiResponse

Returns an eligible price given a set of letter rate ingredients for First-Class Mail International. determines the level of access and permissions for the API. The value of this parameter should be set to “international-prices” for international-prices-related operations. parameters to be used for the query.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
# File 'lib/usps_api/apis/resources_api.rb', line 2892

def post_letter_rates_search1(scope,
                              body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/letter-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalPricesLetterRatesQueryResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_manifest(scope, body: nil) ⇒ ApiResponse

Allows the caller to close a container and generate a manifest. determines the level of access and permissions for the API. The value of this parameter should be set to “containers” for containers-related operations.

Parameters:

  • scope (Scope4)

    Required parameter: The scope of the request, which

  • body (Manifest) (defaults to: nil)

    Optional parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
# File 'lib/usps_api/apis/resources_api.rb', line 1003

def post_manifest(scope,
                  body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/containers/manifest',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             ContainersErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             ContainersErrorException)
                .local_error('403',
                             'Access is denied.',
                             ContainersErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             ContainersErrorException)
                .local_error('503',
                             'Service is unavailable',
                             ContainersErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_options_search(scope, body) ⇒ ApiResponse

Based on the inputs below, the API generates a comprehensive list of shipping options that comply with USPS Shipping Standards, all within a single request. For deliveries with international mail classes, there are no commitments. International delivery may vary based upon origin, destination, and customs delays. For more details, visit [International Mail & Shipping Services](www.usps.com/international/mail-shipping-services.htm). For deliveries with return mail classes, there are no commitments. Return delivery will vary based upon when the return item is entered into the mailstream. For more details, visit [Managing Customer Returns](www.usps.com/business/return-services.htm). APO, DPO, and FPO locations typically do not offer commitments. For more details, visit [Military & Diplomatic Mail](www.usps.com/ship/apo-fpo-dpo.htm).

| Element                          | Description |
| -------------------------------- | --------|
| **originZIPCode**                | The origin ZIP Code&#8482; is where

the package is being mailed from and is used for calculating pricing. |

| **destinationZIPCode**           | The destination ZIP Code&#8482; of

the recipient is used for calculating pricing. |

| **destinationEntryFacilityType** | The Destination Entry Facility Type

the package will be mailed from and is used in calculating Shipping Standards. |

| **packageDescription**           | Package characteristics used to

price the shipment including requested mail class, weight, dimensions, and more. |

| **pricingOptions**               | Pricing options such as price type

and supporting information needed for pricing the shipping option. | determines the level of access and permissions for the API. The value of this parameter should be set to “shipments” for shipments-related operations. Required parameter: TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
# File 'lib/usps_api/apis/resources_api.rb', line 5896

def post_options_search(scope,
                        body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/options/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true)
                            .validator(proc do |value|
                              UnionTypeLookUp.get(:OptionsRequest)
                                             .validate(value)
                            end))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(proc do |response, should_symbolize|
                  APIHelper.deserialize_union_type(
                    UnionTypeLookUp.get(:OptionsResponse),
                    response, should_symbolize, true
                  )
                end)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_package_tracking_notifications(tracking_number, scope, body, x_forwarded_for: nil) ⇒ ApiResponse

By registering for the USPS&#174; Tracking by Email service, users can receive email notifications about their package tracking events. This service allows customers to submit their email address to be notified of current or future tracking activity. Users can choose to receive notifications for all activity to date, all future activity, or both. Whenever a mail piece receives an email notifiable event, an email with the relevant information will be generated and sent. With the new request type, users can make multiple requests for a single mail piece in a single request. Tracking status can be obtained using just the impb, and if multiple items are found, users can include additional details in the request.

  • **uniqueTrackingID (MP-Suffix)** - The impb may be reused during the

USPS&#174; retention period. This field uniquely identifies the shipment status of a unique mailpiece when there exists multiple occurrences of the same impb during this retention period. MPSUFFIX value is located in Track/Confirm Fields API response data. Unique to each TrackID.

  • OR

  • **approximateIntakeDate (MP-Date)** - When the mailpiece was taken into

USPS&#174; for shipment. The impb may be reused during the USPS&#174; retention period. This field helps to uniquely identify the shipment status of a unique mailpiece when there exists multiple occurrences of the same impb during this retention period. MPDATE value is located in Track/Confirm Fields API response data. Unique to each TrackId. **One email address** is required and user can enter up to three for notifications. *SMS cell phone numbers are not supported at this time.* RequestType at least one is needed and up to 7 within this list [ AL, FD, ED, TD, UP, FS, OA] representation of package barcode data, commonly known as its tracking number. determines the level of access and permissions for the API. The value of this parameter should be set to “tracking” for tracking-related operations. information to send notifications to. address of the originating client, in additon to intermediate proxies that have forwarded the request. If a request goes through multiple proxies, the IP addresses of each successive proxy is listed. This means, the right-most IP address is the IP address of the most recent proxy and the left-most IP address is the IP address of the originating client.

Parameters:

  • tracking_number (String)

    Required parameter: The human-readable

  • scope (Scope18)

    Required parameter: The scope of the request, which

  • body (TrackingNotificationRequest)

    Required parameter: Contact

  • x_forwarded_for (String) (defaults to: nil)

    Optional parameter: Contains the IP

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
# File 'lib/usps_api/apis/resources_api.rb', line 4969

def post_package_tracking_notifications(tracking_number,
                                        scope,
                                        body,
                                        x_forwarded_for: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/tracking/{trackingNumber}/notifications',
                                 Server::DEFAULT)
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(x_forwarded_for, key: 'X-Forwarded-For'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TrackingNotificationAcknowledgment.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('404',
                             'Package with tracking number not found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too many requests have been received from the client in a'\
                              ' short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#post_payments_payment_authorization(scope, body: nil) ⇒ ApiResponse

Create a payment authorization token that can be subsequently used for purchasing labels. Tokens are valid for eight hours after issuance. The roles input is required to generate this token. The roles object should contain information for each role for the transaction in which this token will be used. The ‘PAYER` and `LABEL_OWNER` roles are required to pay for any label transaction. The available roles are:

  • PAYER - This role is used to specify who will pay for the

transaction. When using the ‘PAYER` role, the `accountType` and `CRID` must be specified. If the `accountType` is `EPS`, the `accountNumber` must be active in the Enterprise Payment System (EPS).

  • RATE_HOLDER - This role is used to specify whose rates will be used

in the transaction and will be used to lookup any contract-specific service standards. When using the ‘RATE_HOLDER` role, the `accountType` and `CRID` must be specified.

  • LABEL_OWNER - This role is used to specify whose label ranges will

be used in the transaction. When using the ‘LABEL_OWNER` role, the `CRID`, `MID` and `manifestMID` must be specified. The `MID` and `CRID` must be enrolled in USPS Ship Outbound or Returns.

  • SHIPPER - This role is used to specify who is entering the packages

into the mailstream. When using ‘SHIPPER` role, the `CRID` must be specified.

  • MAIL_OWNER - This role is used to specify who owns the package

contents. When using the ‘MAIL_OWNER` role, the `CRID` must be specified. This does not populate the mail owner field in the D1 record of the Shipping Service File (SSF). Please use the `packageDescription.mailOwnerMID` field in the Label Request to populate the D1 field.

  • PLATFORM - This role is used to specify the platform used to make

the API calls. When using the ‘PLATFORM` role, the `CRID` must be specified.

  • RETURN_LABEL_PAYER - This role is used to specify who will pay for

the return label transaction. Optional if outbound and return label payer are the same. When using the ‘RETURN_LABEL_PAYER` role, the `accountType` and `CRID` must be specified. If the `accountType` is `EPS`, the `accountNumber` must be active in the Enterprise Payment System (EPS).

  • RETURN_LABEL_RATE_HOLDER - This role is used to specify the owner of

the Contracted Postage Rates for the return label in a combined outbound/return request. Optional if outbound and return label rate holder are the same. When using the ‘RETURN_LABEL_RATE_HOLDER` role, the `accountType` and `CRID` must be specified.

  • RETURN_LABEL_OWNER - This role is used to specify whose label ranges

will be used in the return label in a combined outbound/return request. Optional if outbound and return label owner are the same. When using the RETURN_LABEL_OWNER role, the ‘CRID`, `MID` and `manifestMID` must be specified. The `MID` and `CRID` must be enrolled in USPS Ship Returns.

  • LABEL_PROVIDER - This role is used to specify the label provider for

the transaction. When using the ‘LABEL_PROVIDER` role, the `CRID`, `accountNumber`, and `accountType` must be specified and the only supported accountType is `EPS`. The `accountNumber` must be active in the Enterprise Payment System (EPS). determines the level of access and permissions for the API. The value of this parameter should be set to “payments” for payments-related operations. TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
# File 'lib/usps_api/apis/resources_api.rb', line 5146

def post_payments_payment_authorization(scope,
                                        body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/payment-authorization',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InterestedPartiesIdentityInformation.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_pmod(scope, x_payment_authorization_token, body) ⇒ ApiResponse

Create a new Open and Distribute container with the associated attributes from the request body. Packages can be added to the container until manifest using [Domestic Labels 3.0 - Create a Domestic Shipping Label](developers.usps.com/domesticlabelsv3) or [Containers 3.0 - Add Packages or Mail to a Container Manifest](developers.usps.com/containersv3). Packages can be removed from the container using [Containers 3.0 - Remove All Packages from a Container](developers.usps.com/containersv3) or [Containers 3.0 - Remove Individual Packages from a Container](developers.usps.com/containersv3). The response will contain the IMpb label and a 99M IMcb label. determines the level of access and permissions for the API. The value of this parameter should be set to “pmod” for pmod-related operations. Authorization Token from the payments API Call. description here

Parameters:

  • scope (Scope17)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (CreateOdContainerRequest)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
# File 'lib/usps_api/apis/resources_api.rb', line 4719

def post_pmod(scope,
              x_payment_authorization_token,
              body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/pmod/create',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateOdContainerResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PmodErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PmodErrorException)
                .local_error('403',
                             'Access is denied.',
                             PmodErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PmodErrorException)
                .local_error('503',
                             'Service is unavailable',
                             PmodErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_qrcode_search(scope, body: nil) ⇒ ApiResponse

The QR Code API enables shippers and integrators to request and receive QR codes for packages addressed to USPS lockers upon delivery. This empowers shippers to manage their customers’ post-purchase experience by sharing package pickup instructions directly with their customers. Access to the QR Code API is restricted to tracking numbers associated with mailer IDs (MIDs) owned by the integrator or shipper. The API response returns a base64-encoded QR code image, which must be converted into an image before use. determines the level of access and permissions for the API. The value of this parameter should be set to “qr-code” for qr-code-related operations. here

Parameters:

  • scope (Scope20)

    Required parameter: The scope of the request, which

  • body (QrCodeRequest) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
# File 'lib/usps_api/apis/resources_api.rb', line 5270

def post_qrcode_search(scope,
                       body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(proc do |response, should_symbolize|
                  APIHelper.deserialize_union_type(
                    UnionTypeLookUp.get(:PostQrcodeSearchResponse),
                    response, should_symbolize, true
                  )
                end)
                .is_api_response(true)
                .local_error('400',
                             'Bad request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied',
                             AddressesErrorException)
                .local_error('404',
                             'No record found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_rate_list(scope, body: nil) ⇒ ApiResponse

Returns a list of eligible prices given dimensions/weight/destination of pieces. Search for contract prices; either by:

  • Enterprise Payment System (EPS) account

  • Meter number

  • Permit number

A specific mail class is required when searching for contract prices. determines the level of access and permissions for the API. The value of this parameter should be set to “prices” for prices-related operations. be used for the query.

Parameters:

  • scope (Scope5)

    Required parameter: The scope of the request, which

  • body (RateListQuery) (defaults to: nil)

    Optional parameter: The search parameters to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
# File 'lib/usps_api/apis/resources_api.rb', line 1162

def post_rate_list(scope,
                   body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/base-rates-list/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(BaseRateDetails.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_return_label(scope, x_payment_authorization_token, body, x_idempotency_key: nil) ⇒ ApiResponse

Generates a returns shipping label based upon the input dimensions requested. | Element | Description | | —————————— | ——– | | toAddress | Address where the return package is being shipped to. The ZIP Code™ in the ‘toAddress` object is used to calculate pricing. | | fromAddress | Address where the return package is being shipped from. The ZIP Code™ in the `fromAddress` object is used to calculate pricing. | | senderAddress | Address of the business involved (typically the sender of the original package). The `senderAddress` can be different from the `toAddress` when the business address is not where the package is being shipped to. | | returnAddress | Address where the package should be returned to if it is deemed undeliverable or returned to sender. This address will be printed in the return address block of the label. This could be a secondary return address in case the `toAddress` is deemed undeliverable or returned to sender. | | packageDescription | Package characteristics used to price the shipment including requested mail class, weight, dimensions, and more. | | imageInfo | Additional details used to update label characteristics | | customsForm | Additional details required when creating shipments originating from or destinating to MPOs, APOs, FPOs, or DPOs (Military, Army, Fleet, and Diplomatic Post Offices) and some Military and U.S. Possessions, Territories, and Freely Associated States (PTFAS).| The default media type of the response has multiple parts. Setting the Accept header to either `application/json` or `application/xml` will only affect the metadata part of the multipart response. **How to use this API** The metadata part of the multipart response representation is only in application/json format media type, as default. Ignore the Content-Encoding header in the second part, the label image file. The contents of this part are not compressed. Ignore the Content-Transfer-Encoding header in the second part, the label image file. The contents of this part are always Base64 encoded. Ignore the Content-Encoding header in the third part, the receipt image file. The contents of this part are not compressed. Ignore the Content-Transfer-Encoding header in the third part, the receipt image file. The contents of this part are always Base64 encoded. Instructions Extract the first part of the multipart response as application/json media type. Extract the second part of the multipart response and Base64 decode it to yield the binary image file. Save the binary image file, given the Content-Type header value and the filename of this part (e.g. application/pdf, label.pdf). It is recommended that you run a virus scan on the resulting downloaded file. Extract the third part of the multipart response and Base64 decode it to yield the binary image file. Save the binary image file, given the Content-Type header value and the filename of this part (e.g. application/pdf, receipt.pdf). It is recommended that you run a virus scan on the resulting downloaded file. determines the level of access and permissions for the API. The value of this parameter should be set to “labels” for labels-related operations. Authorization Token from the payments API Call. description here that serves as an idempotency key for safe request retries and duplicate charge prevention during label creation. This value must be a randomly generated UUID and unique per customer (CRID) across all label creation requests. When the same idempotency key is resubmitted with an identical request payload, the API will return the existing label without creating a duplicate or charging additional postage. The UUID will be included in the electronic manifest data (Shipping Services File D5 field) sent to Postal systems.

Parameters:

  • scope (Scope11)

    Required parameter: The scope of the request, which

  • x_payment_authorization_token (String)

    Required parameter: Payment

  • body (ReturnsPackageRequest)

    Required parameter: TODO: type

  • x_idempotency_key (UUID | String) (defaults to: nil)

    Optional parameter: A unique UUID

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
# File 'lib/usps_api/apis/resources_api.rb', line 3172

def post_return_label(scope,
                      x_payment_authorization_token,
                      body,
                      x_idempotency_key: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/return-label',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(x_payment_authorization_token, key: 'X-Payment-Authorization-Token')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(x_idempotency_key, key: 'X-Idempotency-Key'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ReturnLabelPackageResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' the client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_return_service_standards_directory(scope, body) ⇒ ApiResponse

**Request Directory of Service Standards**: Return service standard data. Origin/Destination ZIP codes can be 3-digit or 5-digit. determines the level of access and permissions for the API. The value of this parameter should be set to “service-standards-directory” for service-standards-directory-related operations. here

Parameters:

  • scope (Scope24)

    Required parameter: The scope of the request, which

  • body (V3ReporterRequest)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
# File 'lib/usps_api/apis/resources_api.rb', line 5781

def post_return_service_standards_directory(scope,
                                            body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/reporter',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ServiceStandardsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request. There is an error in the received request.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource not found.',
                             AddressesErrorException)
                .local_error('500',
                             'Internal server error.',
                             AddressesErrorException))
    .execute
end

#post_revoke(scope, token, token_type_hint: TokenTypeHint::REFRESH_TOKEN) ⇒ ApiResponse

Prevent tokens from being further used to access APIs by invalidating OAuth tokens which are no longer needed. This resource is based on the 'OAuth 2.0 Token Revocation', IETF Draft RFC 7009, August 2013, see [OAuth 2.0 Token Revocation](datatracker.ietf.org/doc/html/rfc7009). Basic Authentication is used to access this resource, using the issued client Id and client secret.

“‘ Authorization: Basic N0MyejJiS1FodDJUTEJjVTE2VmxlZUplQm1hdExiMjQ6TENtSE85RUFENXk0bUNURA== “` Only refresh tokens may be revoked, since access tokens are self-contained, and formatted using JSON Web Token industry standard. determines the level of access and permissions for the API. The value of this parameter should be set to “oauth2” for oauth2-related operations. type of the given token. See OAuth Token Types Hint registry, www.rfc-editor.org/rfc/rfc7009#section-4.1.2.1

Parameters:

  • scope (Scope16)

    Required parameter: The scope of the request, which

  • token (String)

    Required parameter: The token (a hash value).

  • token_type_hint (TokenTypeHint) (defaults to: TokenTypeHint::REFRESH_TOKEN)

    Optional parameter: A hint to the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
# File 'lib/usps_api/apis/resources_api.rb', line 4536

def post_revoke(scope,
                token,
                token_type_hint: TokenTypeHint::REFRESH_TOKEN)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/revoke',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .form_param(new_parameter(token, key: 'token')
                            .is_required(true))
               .form_param(new_parameter(token_type_hint, key: 'token_type_hint'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  Check the input parameters and values.',
                             OauthStandardErrorResponseException)
                .local_error('401',
                             'Unauthorized Request.  Check the authentication scheme and'\
                              ' values being used to make the request.',
                             OauthStandardErrorResponseException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             OauthStandardErrorResponseException)
                .local_error('503',
                             'Service Unavailable.',
                             OauthStandardErrorResponseException))
    .execute
end

#post_scan_form(scope, body) ⇒ ApiResponse

The default media type of the response is multipart-mixed. Setting the Accept header to either application/json or application/xml will only affect the metadata part of the multipart response. **How to use this API**

The metadata part of the multipart response representation is only in

application/json format media type, as default. The application/xml media type is not supported at this time.

Ignore the Content-Encoding header in the second part, the SCAN form

image file. The contents of this part are not compressed.

Ignore the Content-Transfer-Encoding header in the second part, the SCAN

form image file. The contents of this part are always Base64 encoded.

Instructions

Extract the first part of the multipart response as application/json

media type.

Extract the second part of the multipart response and Base64 decode it

to yield the binary image file.

Save the binary image file, given the Content-Type header value and the

filename of this part (e.g. application/pdf, SCANForm.pdf).

It is recommended that you run a virus scan on the resulting downloaded

file.

determines the level of access and permissions for the API. The value of this parameter should be set to “scan-forms” for scan-forms-related operations. description here

Parameters:

  • scope (Scope22)

    Required parameter: The scope of the request, which

  • body (ScanFormsScanForm1)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
# File 'lib/usps_api/apis/resources_api.rb', line 5440

def post_scan_form(scope,
                   body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/scan-form',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScanFormsScanForm.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_shipments_tracking(scope, body) ⇒ ApiResponse

Submits a real-time tracking event for a shipment in transit. Each event captures the trailer’s current GPS coordinates and event milestone, and links the customer’s external load number to the USPS FAST Appointment ID — providing unified visibility for both drivers and customers. | Element | Description | | ——- | ———– | | externalLoadNumber | The caller’s internal load identifier. Associates the customer’s shipment reference with the USPS appointment, giving drivers and customers a shared reference across systems. | | appointmentID | The FAST-assigned appointment ID that this tracking event is associated with. | | appointmentDate | The scheduled date and time (ISO 8601) of the USPS dock appointment. | | trailerID | Unique identifier for the physical trailer carrying the shipment. | | schedulerCRID | The CRID of the scheduler submitting the tracking event. | | ETA | Estimated time of arrival at the current destination. Required for all event types except ‘FACILITY_ARRIVE` and `FACILITY_DEPART`. | | ETAStatus | Status of the ETA relative to the current stop (not the appointment). Required for all event types except `FACILITY_ARRIVE` and `FACILITY_DEPART`. | | location | The destination stop details including location type, stop type, stop sequence, and either a `dropSiteKey` (USPS) or `ZIPCode5` (CUSTOMER / NON_USPS). | | currentLocation | The real-time GPS coordinates (latitude/longitude) and timestamp of the trailer’s current position. | | currentEvent | The milestone event type being reported for this update. | | positionalInfo | Telemetry data including ping interval, distance traveled, speed, and GPS accuracy. | | resourceInfo | Optional metadata about who submitted the event, device permission states, and comments. | **Location Type Rules** The required identifier for the ‘location` object depends on `locationType`: | locationType | Required Field | | ———— | ————– | | `USPS` | `dropSiteKey` | | `CUSTOMER` | `ZIPCode5` | | `NON_USPS` | `ZIPCode5` | **Event Types** Use `currentEvent.eventType` to report the current milestone in the shipment’s journey. Choose the event type that best reflects the trailer’s actual status at the time of submission. | eventType | When to Use | ETA Required | ETAStatus Required | | ——— | ———– | ———— | —————— | | ‘EN_ROUTE` | The trailer has departed its origin or a prior stop and is actively traveling toward the next destination. Use this as the standard in-transit event to report periodic location updates during movement. | Yes | Yes | | `PRE_ARRIVAL` | The trailer is approaching the next stop and is within a defined proximity or time threshold. Use this event to give the receiving facility advance notice before physical arrival so staff can prepare for the appointment. | Yes | Yes | | `FACILITY_ARRIVE` | The trailer has physically arrived at the scheduled stop (USPS facility, customer, or non-USPS location). Submit this event when the trailer checks in or is confirmed on-site. `ETA` and `ETAStatus` are not required because arrival is the status. | No | No | | `FACILITY_DEPART` | The trailer has completed its activity at a stop and has physically departed. Submit this event when the trailer leaves the facility or customer location and before the next `EN_ROUTE` update begins. `ETA` and `ETAStatus` are not required because departure itself is the status. | No | No | Instructions

  1. Obtain a valid OAuth 2.0 bearer token with the ‘logistics` scope before

making requests.

  1. Populate ‘externalLoadNumber` with your internal load reference and

‘appointmentID` with the USPS FAST appointment ID to link the two systems.

  1. Set ‘location.locationType` to `USPS`, `CUSTOMER`, or `NON_USPS` to the

desired destination and include the corresponding required identifier (‘dropSiteKey` or `ZIPCode5`).

  1. Set ‘currentEvent.eventType` to the appropriate milestone. For

‘FACILITY_ARRIVE` and `FACILITY_DEPART`, omit `ETA` and `ETAStatus`.

  1. For all other event types, include ‘ETA` (ISO 8601 date-time) and a

valid ‘ETAStatus` value: `ON_TIME`, `EARLY`, `DELAYED`, `LATE`, `CANCELLED`, `REDIRECTED`, or `RESCHEDULED`.

  1. Provide accurate GPS coordinates in ‘currentLocation` at each ping. The

‘positionalInfo.pingInterval` controls how frequently updates are sent (in milliseconds).

  1. Optionally include ‘resourceInfo` to record whether the submission was

‘MANUAL` or `AUTOMATIC`, submitted by a `CUSTOMER` or `DRIVER`, and any relevant comments. determines the level of access and permissions for the API. The value of this parameter should be set to “logistics” for logistics-related operations. event to create

Parameters:

  • scope (Scope13)

    Required parameter: The scope of the request, which

  • body (ShipmentTrackingEvent)

    Required parameter: Shipment tracking

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
# File 'lib/usps_api/apis/resources_api.rb', line 4332

def post_shipments_tracking(scope,
                            body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/shipment-tracking',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ShipmentTrackingEvent.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad request',
                             LogisticsErrorException)
                .local_error('401',
                             'Unauthorized',
                             LogisticsErrorException)
                .local_error('403',
                             'Forbidden',
                             LogisticsErrorException)
                .local_error('429',
                             'Too Many Requests',
                             LogisticsErrorException)
                .local_error('503',
                             'Service unavailable',
                             LogisticsErrorException))
    .execute
end

#post_subscriptions_adjustment(scope, body) ⇒ ApiResponse

Create a Subscription to Adjustment Events Topic. A subscription can be created for a Customer Registration ID and you can specify what type of adjustment events you want to receive. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-adjustments” for subscriptions-adjustments-related operations. input parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
# File 'lib/usps_api/apis/resources_api.rb', line 6009

def post_subscriptions_adjustment(scope,
                                  body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsAdjustmentsSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_subscriptions_dispute(scope, body) ⇒ ApiResponse

Create a Subscription to Disputes Events Topic. A subscription can be created for a Customer Registration ID and you can specify what type of dispute events you want to receive. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-disputes” for subscriptions-disputes-related operations. input parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
# File 'lib/usps_api/apis/resources_api.rb', line 6280

def post_subscriptions_dispute(scope,
                               body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsDisputesSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_subscriptions_ncoa(scope, body) ⇒ ApiResponse

Create a Subscription to be alerted for Change of Address for specfied the address. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-ncoa” for subscriptions-ncoa-related operations. parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
# File 'lib/usps_api/apis/resources_api.rb', line 6549

def post_subscriptions_ncoa(scope,
                            body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsNcoaSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request information.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_subscriptions_package_transaction_details(scope, body) ⇒ ApiResponse

Create a Subscription to Package Transaction Details Events Topic. A subscription can be created for a Customer Registration ID. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-package-transaction-details” for subscriptions-package-transaction-details-related operations. parameter: The input parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
# File 'lib/usps_api/apis/resources_api.rb', line 6823

def post_subscriptions_package_transaction_details(scope,
                                                   body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsPackageTransactionDetailsSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_subscriptions_tracking(scope, body) ⇒ ApiResponse

Create a Subscription to Tracking Events Topic. A subscription can be created for a mailer id or a tracking number. You also can specify what type of tracking events you want to receive. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-tracking” for subscriptions-tracking-related operations. input parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
# File 'lib/usps_api/apis/resources_api.rb', line 7102

def post_subscriptions_tracking(scope,
                                body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsTrackingSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request information.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Access Denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_subscriptions_unpaid_subscriptions(scope, body) ⇒ ApiResponse

Create a Subscription to Unpaid Packages Events Topic. A subscription can be created for a Customer Registration ID and you can specify what type of Unpaid Packages events you want to receive. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-unpaid-packages” for subscriptions-unpaid-packages-related operations. The input parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
# File 'lib/usps_api/apis/resources_api.rb', line 7374

def post_subscriptions_unpaid_subscriptions(scope,
                                            body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/subscriptions',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsUnpaidPackagesSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request information',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_token(scope, body: nil) ⇒ ApiResponse

Issue one or more OAuth tokens for a client application to use to make subsequent resource requests. Based on the _OAuth 2.0 Authorization Framework_, IETF Draft RFC 6749, October 2012, see [The OAuth 2.0 Authorization Framework](datatracker.ietf.org/doc/html/rfc6749). The expires_in and refresh_token_expires_in fields in the token response specify the respective valid lifetimes for each token. The following OAuth grant types are supported:

  • **Client Credentials Grant**, see [IETF 6749, section

4.4](datatracker.ietf.org/doc/html/rfc6749#section-4.4).

  • **Refresh Token**, see [IETF 6749, section

6](datatracker.ietf.org/doc/html/rfc6749#section-6)

  • **Authorization Code Grant**, see [IETF 6749, section

4.1](datatracker.ietf.org/doc/html/rfc6749#section-4.1). determines the level of access and permissions for the API. The value of this parameter should be set to “oauth2” for oauth2-related operations. AuthorizationCodeCredentialsTokenRequest | nil] body Optional parameter: The input parameters corresponding to the supported grant types.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
# File 'lib/usps_api/apis/resources_api.rb', line 4472

def post_token(scope,
               body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/token',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .validator(proc do |value|
                              UnionTypeLookUp.get(:PostTokenBody)
                                             .validate(value)
                            end))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize)))
    .response(new_response_handler
                .deserializer(proc do |response, should_symbolize|
                  APIHelper.deserialize_union_type(
                    UnionTypeLookUp.get(:PostTokenResponse),
                    response, should_symbolize, true
                  )
                end)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  Check the input parameters and values.',
                             OauthStandardErrorResponseException)
                .local_error('401',
                             'Unauthorized Request.  Check the authentication scheme and'\
                              ' values being used to make the request.',
                             OauthStandardErrorResponseException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             OauthStandardErrorResponseException)
                .local_error('503',
                             'Service Unavailable.',
                             OauthStandardErrorResponseException))
    .execute
end

#post_total_rates_search(scope, body: nil) ⇒ ApiResponse

This API returns a list of eligible prices, including extra service fees, given the dimensions, weight, origin and destination of your package. determines the level of access and permissions for the API. The value of this parameter should be set to “prices” for prices-related operations. parameters to be used for the query.

Parameters:

  • scope (Scope5)

    Required parameter: The scope of the request, which

  • body (PricesTotalRatesQuery) (defaults to: nil)

    Optional parameter: The search

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
# File 'lib/usps_api/apis/resources_api.rb', line 1213

def post_total_rates_search(scope,
                            body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/total-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PricesTotalRateDetails.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_total_rates_search1(scope, body: nil) ⇒ ApiResponse

Performs a search for base price and extraServices using the submitted rate ingredients. If itemValue is not included the response will not include insurance, registered mail, and collect on delivery extra services. If the extraService array is not specified then all eligible extra services will be included. determines the level of access and permissions for the API. The value of this parameter should be set to “international-prices” for international-prices-related operations. search parameters to be used for the query.

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
# File 'lib/usps_api/apis/resources_api.rb', line 2840

def post_total_rates_search1(scope,
                             body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/total-rates/search',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(InternationalPricesTotalRateDetails.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             AddressesErrorException)
                .local_error('403',
                             'Access is denied.',
                             AddressesErrorException)
                .local_error('404',
                             'Resource Not Found',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service is unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#post_tracking_number_campaigns(scope, crid, campaign_id, body) ⇒ ApiResponse

Add tracking numbers to an Informed Delivery package campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-package-campaigns” for informed-delivery-package-campaigns-related operations. Customer Registration ID (CRID). campaign. description here

Parameters:

  • scope (Scope7)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The Package campaign submitter’s

  • campaign_id (String)

    Required parameter: Unique identifier for the

  • body (TrackingNumberRequest)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
# File 'lib/usps_api/apis/resources_api.rb', line 2332

def post_tracking_number_campaigns(scope,
                                   crid,
                                   campaign_id,
                                   body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}/pieces',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TrackingNumberSuccessResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             APIException))
    .execute
end

#proof_of_delivery(tracking_number, scope, body, x_forwarded_for: nil) ⇒ ApiResponse

Proof of Delivery is a letter that includes the recipient’s name and a copy of their signature. The Proof of Delivery API allows the customer to request proof of delivery notification via email. representation of package barcode data, commonly known as its tracking number. determines the level of access and permissions for the API. The value of this parameter should be set to “tracking” for tracking-related operations. information required for returning the proof of delivery to the recipient. address of the originating client, in additon to intermediate proxies that have forwarded the request. If a request goes through multiple proxies, the IP addresses of each successive proxy is listed. This means, the right-most IP address is the IP address of the most recent proxy and the left-most IP address is the IP address of the originating client.

Parameters:

  • tracking_number (String)

    Required parameter: The human-readble

  • scope (Scope18)

    Required parameter: The scope of the request, which

  • body (ProofOfDeliveryRequest)

    Required parameter: Additional

  • x_forwarded_for (String) (defaults to: nil)

    Optional parameter: Contains the IP

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
# File 'lib/usps_api/apis/resources_api.rb', line 5039

def proof_of_delivery(tracking_number,
                      scope,
                      body,
                      x_forwarded_for: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/{scope}/v3/tracking/{trackingNumber}/proof-of-delivery',
                                 Server::DEFAULT)
               .template_param(new_parameter(tracking_number, key: 'trackingNumber')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter(x_forwarded_for, key: 'X-Forwarded-For'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProofOfDeliveryResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('404',
                             'Package with tracking number not found.',
                             AddressesErrorException)
                .local_error('429',
                             'Too many requests have been received from the client in a'\
                              ' short amount of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'An unknown error has occurred.',
                             APIException))
    .execute
end

#put_campaigns(scope, crid, campaign_id, body) ⇒ ApiResponse

Edit a previously existing Informed Delivery campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). campaign here

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • campaign_id (String)

    Required parameter: ID of Informed Delivery

  • body (CampaignEdit)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
# File 'lib/usps_api/apis/resources_api.rb', line 1765

def put_campaigns(scope,
                  crid,
                  campaign_id,
                  body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CampaignEditResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsErrorException))
    .execute
end

#put_carrier_pickup_confirmation_number(scope, confirmation_number, if_match, body) ⇒ ApiResponse

Update information contained in a previously scheduled carrier pickup such as the pickup date, the types and counts of packages for the carrier to pick up, the weight or the pickup location. determines the level of access and permissions for the API. The value of this parameter should be set to “pickup” for pickup-related operations. Carrier Pickup confirmation number. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. description here

Parameters:

  • scope (Scope3)

    Required parameter: The scope of the request, which

  • confirmation_number (String)

    Required parameter: This is the

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (PickupConfirmation)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/usps_api/apis/resources_api.rb', line 683

def put_carrier_pickup_confirmation_number(scope,
                                           confirmation_number,
                                           if_match,
                                           body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/carrier-pickup/{confirmationNumber}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(confirmation_number, key: 'confirmationNumber')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PickupConfirmation.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             PickupErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             PickupErrorException)
                .local_error('403',
                             'Access is denied.',
                             PickupErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             PickupErrorException)
                .local_error('503',
                             'Service is unavailable.',
                             PickupErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_fast_appointment(scope, body: nil) ⇒ ApiResponse

Update Appointment Request provides the ability to update an appointment. determines the level of access and permissions for the API. The value of this parameter should be set to “fast-appointments” for fast-appointments-related operations. corresponding to the supported grant types.

Parameters:

  • scope (Scope2)

    Required parameter: The scope of the request, which

  • body (Appointment) (defaults to: nil)

    Optional parameter: The input parameters

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/usps_api/apis/resources_api.rb', line 347

def put_fast_appointment(scope,
                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/fast-appointments/appointment',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Appointment.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.  There is an error in the received request.',
                             FastAppointmentsErrorException)
                .local_error('401',
                             'Unauthorized request.',
                             FastAppointmentsErrorException)
                .local_error('403',
                             'Access is denied.',
                             FastAppointmentsErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amount of time.',
                             FastAppointmentsErrorException)
                .local_error('503',
                             'Service is unavailable',
                             FastAppointmentsErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_package_campaigns(scope, crid, campaign_id, body) ⇒ ApiResponse

Edit a previously existing Informed Delivery package campaign determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-package-campaigns” for informed-delivery-package-campaigns-related operations. Customer Registration ID (CRID). campaign. description here

Parameters:

  • scope (Scope7)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The Package campaign submitter’s

  • campaign_id (String)

    Required parameter: Unique identifier for the

  • body (EditPackageCampaign)

    Required parameter: TODO: type

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
# File 'lib/usps_api/apis/resources_api.rb', line 2249

def put_package_campaigns(scope,
                          crid,
                          campaign_id,
                          body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/campaigns/{CRID}/{campaignID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(campaign_id, key: 'campaignID')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(EditPackageCampaignResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryPackageCampaignsErrorException))
    .execute
end

#put_subscriptions_adjustment_id(scope, subscription_id, if_match, body) ⇒ ApiResponse

Use this endpoint to update the callback url, secret, or status. If filter properties need to change, a new subscription needs to be created. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-adjustments” for subscriptions-adjustments-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. input parameters corresponding to the supported grant types.

Parameters:

  • scope (Scope28)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (SubscriptionsAdjustmentsSubscription)

    Required parameter: The

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
# File 'lib/usps_api/apis/resources_api.rb', line 6114

def put_subscriptions_adjustment_id(scope,
                                    subscription_id,
                                    if_match,
                                    body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsAdjustmentsSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_subscriptions_dispute_id(scope, subscription_id, if_match, body) ⇒ ApiResponse

Use this endpoint to update the callback url, secret, or status. If filter properties need to change, a new subscription needs to be created. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-disputes” for subscriptions-disputes-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. input parameters corresponding to the supported grant types.

Parameters:

  • scope (Scope29)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (SubscriptionsDisputesSubscription)

    Required parameter: The

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
# File 'lib/usps_api/apis/resources_api.rb', line 6385

def put_subscriptions_dispute_id(scope,
                                 subscription_id,
                                 if_match,
                                 body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsDisputesSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_subscriptions_ncoa_id(scope, subscription_id, if_match, body) ⇒ ApiResponse

Use this endpoint to update the callback url, secret, or status. If filter properties need to change, a new subscription needs to be created. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-ncoa” for subscriptions-ncoa-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. parameters corresponding to the supported grant types.

Parameters:

  • scope (Scope30)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (SubscriptionsNcoaSubscription)

    Required parameter: The input

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
# File 'lib/usps_api/apis/resources_api.rb', line 6654

def put_subscriptions_ncoa_id(scope,
                              subscription_id,
                              if_match,
                              body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsNcoaSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_subscriptions_package_transaction_details_id(scope, subscription_id, if_match, body) ⇒ ApiResponse

Use this endpoint to update the callback url, secret, or status. If filter properties need to change, a new subscription needs to be created. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-package-transaction-details” for subscriptions-package-transaction-details-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. parameter: The input parameters corresponding to the supported grant types.

Parameters:

  • scope (Scope31)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (SubscriptionsPackageTransactionDetailsSubscription)

    Required

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
# File 'lib/usps_api/apis/resources_api.rb', line 6931

def put_subscriptions_package_transaction_details_id(scope,
                                                     subscription_id,
                                                     if_match,
                                                     body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsPackageTransactionDetailsSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_subscriptions_tracking_id(scope, subscription_id, if_match, body) ⇒ ApiResponse

Use this endpoint to update the callback url, secret, or status. If filter properties need to change, a new subscription needs to be created. determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-tracking” for subscriptions-tracking-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. input parameters corresponding to the supported grant types.

Parameters:

  • scope (Scope32)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (SubscriptionsTrackingSubscription)

    Required parameter: The

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
# File 'lib/usps_api/apis/resources_api.rb', line 7207

def put_subscriptions_tracking_id(scope,
                                  subscription_id,
                                  if_match,
                                  body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsTrackingSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request.',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized.',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden.',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable.',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#put_subscriptions_unpaid_packages_id(scope, subscription_id, if_match, body) ⇒ ApiResponse

“Use this endpoint to update the callback URL, secret, or status. If filter properties need to change, a new subscription needs to be created.” determines the level of access and permissions for the API. The value of this parameter should be set to “subscriptions-unpaid-packages” for subscriptions-unpaid-packages-related operations. of the subscription. indicating the version of the resource to get or update. All DELETE and PUT operations require an ETag to be supplied as the If-Match parameter. The ETag is returned in the GET operation and is good for one hour or until it is used in a DELETE or PUT operation. The input parameters corresponding to the supported grant types.

Parameters:

  • scope (Scope33)

    Required parameter: The scope of the request, which

  • subscription_id (String)

    Required parameter: The unique identifier

  • if_match (String)

    Required parameter: The value of the entity tag

  • body (SubscriptionsUnpaidPackagesSubscription)

    Required parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
# File 'lib/usps_api/apis/resources_api.rb', line 7479

def put_subscriptions_unpaid_packages_id(scope,
                                         subscription_id,
                                         if_match,
                                         body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/{scope}/v3/subscriptions/{subscriptionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(subscription_id, key: 'subscriptionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(if_match, key: 'If-Match')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Or.new('OAuth_authorization_code', 'OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SubscriptionsUnpaidPackagesSubscription.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             AddressesErrorException)
                .local_error('401',
                             'Unauthorized',
                             AddressesErrorException)
                .local_error('403',
                             'Forbidden',
                             AddressesErrorException)
                .local_error('429',
                             'Too Many Requests. Too many requests have been received from'\
                              ' client in  a short amout of time.',
                             AddressesErrorException)
                .local_error('503',
                             'Service Unavailable',
                             AddressesErrorException)
                .local_error('default',
                             'Other unanticipated errors that may occur.',
                             APIException))
    .execute
end

#query_mail_campaigns(scope, crid, offset: 0, limit: 100, sort: nil, ezsearch: nil, barcode_count: nil, brand_display_name: nil, campaign_code: nil, mid: nil, mailpiece_shape: nil, campaign_title: nil, campaign_type: nil, created_datetime: nil, campaign_source: nil, end_date: nil, end_serial: nil, last_modified_datetime: nil, last_modified_source: nil, last_modified_username: nil, mail_owner_crid: nil, mail_owner_name: nil, postal_one_saturation_job_id: nil, is_shareable: nil, start_date: nil, start_serial: nil, status: nil, submitted_datetime: nil, has_url_params: nil) ⇒ ApiResponse

Search, filter, sort, and paginate campaigns for a given Submitter CRID determines the level of access and permissions for the API. The value of this parameter should be set to “informed-delivery-campaigns” for informed-delivery-campaigns-related operations. Registration ID (CRID). before returning results. This field must be either be 0 or be a multiple of the limit variable (e.g., is limit is 10, offset can be 0, 10, 20, etc.). If no offset parameter is included at all, a default of 0 will be used. This field must be a number between 1 and 1000. If no limit parameter is included at all, a default of 100 will be used. this, an integrator can input any column that they would like to sort by (e.g., sort=brandDisplayName,desc). An integrator can indicate either an ascending or descending order by inputting asc or desc after the field name. If asc or desc is not included, then the field will be sorted ascending by default. If no sort parameter is included at all, the response will be sorted by lastModifiedDatetime,desc by default. “contains” search across the Campaign Code, Brand Display Name, and Campaign Title fields. For example inputting “Sale” will return any campaign for the CRID with a Campaign Title, Campaign Code, or Brand Display Name that contains the word “Sale”. with a NON-SEQ campaign. This count will always be 0 for MID, SEQ, and SAT campaigns. that is placed on Informed Delivery’s UIs when campaign is displayed. describes the campaign being created. This field is put into the campaign reports created for the campaign. this field will be used to match IMBs to MID and SEQ type campaigns. If an IMB has the Mailer ID (MID) associated with an active MID/SEQ campaign, it is eligible to be displayed with the campaign’s image and Target URL. types of mail pieces the campaign should be applied to * LT (Letter) * CD (Card) * FL (Flat) When filtering, either the LT/CD/FL or Letter/Card/Flat values can be used. describes the campaign being created. This field is put into the campaign reports created for the campaign. campaign should be applied to mail pieces * A01 (Non-Sequential or NON-SEQ): Individual barcodes added to campaign after submission * A02 (Mailer ID or MID): All mailpieces with given Mailer ID added to campaign

  • A03 (Sequential or SEQ): All mailpieces with given Mailer ID and serial

range added to campaign * A04 (Saturation or SAT): Mailpieces will be matched to saturation pieces When filtering, either the A01/A02/A03/A04 or NON-SEQ/MID/SEQ/SAT values can be used. campaign creation. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “createdDatetime>2025-07-05”). system that was originally used to create campaign (e.g. API, PO!, MCP, Admin Console). This field will not update if campaign is subsequently edited or cancelled. displayed serial range for SEQ type campaigns. This field is required for SEQ campaigns only and is not allowed for submission for any other campaign types. update made to campaign, inclusive of status changes that occur when a campaign activates or completes. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “lastModifiedDatetime>2025-07-05”). on system that was used to make last update to campaign (e.g. API, PO!, MCP, Admin Console). This field will update each time a campaign is created, edited, or cancelled. information on Cust Reg user name associated with last update to campaign. This field will update each time a campaign is created, edited, or cancelled. ID (CRID) of the Mail Owner associated with the Informed Delivery campaign. associated with the Informed Delivery campaign. PostalOne! generated unique identifier for a saturation type campaign. This field should not be used for NON-SEQ, MID, or SEQ campaigns. indicator dictating whether a campaign is eligible for Social Sharing. By default, mail campaigns will be displayed alongside options to share the campaign to various social media platforms. If a mailer opts out of this feature, then these options will not be displayed with the campaign. displayed serial range for SEQ type campaigns. This field is required for SEQ campaigns only and is not allowed for submission for any other campaign types. values include Submitted, Active, Complete, Inactive, Draft, Cancelled, and Deleted campaign submission. For this parameter to work correctly, it must be used in conjunction with a >, >=, <, or <= operator (e.g, “submittedDatetime>2025-07-05”). indicator dictating whether a campaign is eligible for MID and Serial Number parameters to be appended to the end of the Target URL for tracking purposes. By default, the MID and Serial Number parameters for a given mailpiece will be added to end of the Target URL that users are taken to upon clicking on a campaign. If a mailer opts out of this feature, then these MID and Serial Number fields will not be appended to the campaign’s Target URL.

Parameters:

  • scope (Scope6)

    Required parameter: The scope of the request, which

  • crid (String)

    Required parameter: The campaign submitter’s Customer

  • offset (Integer) (defaults to: 0)

    Optional parameter: Number of records to skip

  • limit (Integer) (defaults to: 100)

    Optional parameter: Number of results per page.

  • sort (String) (defaults to: nil)

    Optional parameter: Sorting order for results. To use

  • ezsearch (String) (defaults to: nil)

    Optional parameter: This filter will do a

  • barcode_count (Float) (defaults to: nil)

    Optional parameter: Number of IMBs associated

  • brand_display_name (String) (defaults to: nil)

    Optional parameter: User defined field

  • campaign_code (String) (defaults to: nil)

    Optional parameter: User defined field that

  • mid (String) (defaults to: nil)

    Optional parameter: The Mailer ID for the campaign -

  • mailpiece_shape (String) (defaults to: nil)

    Optional parameter: Identifier on what

  • campaign_title (String) (defaults to: nil)

    Optional parameter: User defined field that

  • campaign_type (String) (defaults to: nil)

    Optional parameter: Identifier on how the

  • created_datetime (Date) (defaults to: nil)

    Optional parameter: Date of initial

  • campaign_source (String) (defaults to: nil)

    Optional parameter: Gives information on

  • end_date (Date) (defaults to: nil)

    Optional parameter: Last day campaign will be

  • end_serial (String) (defaults to: nil)

    Optional parameter: The upper limit of the

  • last_modified_datetime (Date) (defaults to: nil)

    Optional parameter: Date of last

  • last_modified_source (String) (defaults to: nil)

    Optional parameter: Gives information

  • last_modified_username (String) (defaults to: nil)

    Optional parameter: Gives

  • mail_owner_crid (String) (defaults to: nil)

    Optional parameter: Customer Registration

  • mail_owner_name (String) (defaults to: nil)

    Optional parameter: Name of the Mail Owner

  • postal_one_saturation_job_id (String) (defaults to: nil)

    Optional parameter: A

  • is_shareable (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: An

  • start_date (Date) (defaults to: nil)

    Optional parameter: First day campaign will be

  • start_serial (String) (defaults to: nil)

    Optional parameter: The lower limit of the

  • status (Status) (defaults to: nil)

    Optional parameter: Status of campaign - possible

  • submitted_datetime (Date) (defaults to: nil)

    Optional parameter: Date of initial

  • has_url_params (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: An

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
# File 'lib/usps_api/apis/resources_api.rb', line 1565

def query_mail_campaigns(scope,
                         crid,
                         offset: 0,
                         limit: 100,
                         sort: nil,
                         ezsearch: nil,
                         barcode_count: nil,
                         brand_display_name: nil,
                         campaign_code: nil,
                         mid: nil,
                         mailpiece_shape: nil,
                         campaign_title: nil,
                         campaign_type: nil,
                         created_datetime: nil,
                         campaign_source: nil,
                         end_date: nil,
                         end_serial: nil,
                         last_modified_datetime: nil,
                         last_modified_source: nil,
                         last_modified_username: nil,
                         mail_owner_crid: nil,
                         mail_owner_name: nil,
                         postal_one_saturation_job_id: nil,
                         is_shareable: nil,
                         start_date: nil,
                         start_serial: nil,
                         status: nil,
                         submitted_datetime: nil,
                         has_url_params: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/{scope}/v3/campaigns/{CRID}',
                                 Server::DEFAULT)
               .template_param(new_parameter(scope, key: 'scope')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(crid, key: 'CRID')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(sort, key: 'sort'))
               .query_param(new_parameter(ezsearch, key: 'ezsearch'))
               .query_param(new_parameter(barcode_count, key: 'barcodeCount'))
               .query_param(new_parameter(brand_display_name, key: 'brandDisplayName'))
               .query_param(new_parameter(campaign_code, key: 'campaignCode'))
               .query_param(new_parameter(mid, key: 'MID'))
               .query_param(new_parameter(mailpiece_shape, key: 'mailpieceShape'))
               .query_param(new_parameter(campaign_title, key: 'campaignTitle'))
               .query_param(new_parameter(campaign_type, key: 'campaignType'))
               .query_param(new_parameter(created_datetime, key: 'createdDatetime'))
               .query_param(new_parameter(campaign_source, key: 'campaignSource'))
               .query_param(new_parameter(end_date, key: 'endDate'))
               .query_param(new_parameter(end_serial, key: 'endSerial'))
               .query_param(new_parameter(last_modified_datetime, key: 'lastModifiedDatetime'))
               .query_param(new_parameter(last_modified_source, key: 'lastModifiedSource'))
               .query_param(new_parameter(last_modified_username, key: 'lastModifiedUsername'))
               .query_param(new_parameter(mail_owner_crid, key: 'mailOwnerCRID'))
               .query_param(new_parameter(mail_owner_name, key: 'mailOwnerName'))
               .query_param(new_parameter(postal_one_saturation_job_id, key: 'postalOneSaturationJobID'))
               .query_param(new_parameter(is_shareable, key: 'isShareable'))
               .query_param(new_parameter(start_date, key: 'startDate'))
               .query_param(new_parameter(start_serial, key: 'startSerial'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(, key: 'submittedDatetime'))
               .query_param(new_parameter(has_url_params, key: 'hasUrlParams'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('OAuth_client_credentials')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(QueryString.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             InformedDeliveryCampaignsErrorException)
                .local_error('default',
                             'An unanticipated error has occurred.',
                             APIException))
    .execute
end