├── .github ├── ISSUE_TEMPLATE.md ├── stale.yml └── workflows │ ├── ci-publish.yml │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.mdown ├── LICENSE ├── README.md ├── examples ├── AdAccountAdCreativesEdge.java ├── AdAccountAdCreativesPost.java ├── AdAccountAdCreativesPostCreateAdCreative.java ├── AdAccountAdCreativesPostCreateAdCreativeCanvas.java ├── AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasDV.java ├── AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasImage.java ├── AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasVideo.java ├── AdAccountAdCreativesPostEnrollStatus.java ├── AdAccountAdLabelsPost.java ├── AdAccountAdSetsEdge.java ├── AdAccountAdSetsPostAdSetCreateCpa.java ├── AdAccountAdSetsPostAdSetCreateCpaAppEvents.java ├── AdAccountAdSetsPostBehaviorTargeting.java ├── AdAccountAdSetsPostBidMultiplier.java ├── AdAccountAdSetsPostCreateAdSet.java ├── AdAccountAdSetsPostCreateAudienceNetwork.java ├── AdAccountAdSetsPostCreateMAIA.java ├── AdAccountAdSetsPostDailyBudget20.java ├── AdAccountAdSetsPostDemographicTargeting.java ├── AdAccountAdSetsPostInterestTargeting.java ├── AdAccountAdSetsPostLifetimeBudget200Duration10Days.java ├── AdAccountAdSetsPostOptimizePostEngagement.java ├── AdAccountAdSetsPostPageLikes.java ├── AdAccountAdSetsPostPlacementTargeting.java ├── AdAccountAdSetsPostReach.java ├── AdAccountAdVideosPost.java ├── AdAccountAdsEdge.java ├── AdAccountAdsPixelEdgeGetPixelCode.java ├── AdAccountAdsPixelsPost.java ├── AdAccountAdsPost.java ├── AdAccountAdsPostAdsRedownload.java ├── AdAccountAdsPostAuthorizationCategory.java ├── AdAccountAdsPostTrackingPostEngagement.java ├── AdAccountCampaignsEdge.java ├── AdAccountCampaignsPost.java ├── AdAccountCampaignsPostCategories.java ├── AdAccountCampaignsPostDailyBudget.java ├── AdAccountCampaignsPostLeadGen.java ├── AdAccountCampaignsPostLinkClicks.java ├── AdAccountCampaignsPostLocalAwareness.java ├── AdAccountCampaignsPostMAIA.java ├── AdAccountCampaignsPostMAIDPA.java ├── AdAccountCampaignsPostPageLikes.java ├── AdAccountCampaignsPostPostEngagement.java ├── AdAccountCampaignsPostVideoViews.java ├── AdAccountCustomAudiencesEdge.java ├── AdAccountCustomAudiencesEdgeDataSourceSubtype.java ├── AdAccountCustomAudiencesPostCreateCustomAudience.java ├── AdAccountCustomAudiencesPostDynamicEventValueBasedLookalikeCustomAudience.java ├── AdAccountCustomAudiencesPostDynamicValueBasedLookalikeCustomAudience.java ├── AdAccountCustomAudiencesPostPlatformCustomAudienceMACARule.java ├── AdAccountCustomAudiencesPostPlatformECAExclusions.java ├── AdAccountCustomAudiencesPostPlatformECAMultiFilters.java ├── AdAccountCustomAudiencesPostPlatformECAMultiPages.java ├── AdAccountCustomAudiencesPostPlatformEngagementCustomAudience.java ├── AdAccountCustomAudiencesPostPlatformWebsiteCustomAudience.java ├── AdAccountCustomAudiencesPostValueBasedCustomAudience.java ├── AdAccountCustomAudiencesPostValueBasedLookalikeCustomAudience.java ├── AdAccountGeneratePreviewsEdge.java ├── AdAccountGeneratePreviewsEdgeDesktopWithStoryId.java ├── AdAccountGeneratePreviewsEdgeInstagramStandards.java ├── AdAccountGeneratePreviewsEdgeMaiaWithObjectStorySpec.java ├── AdAccountNode.java ├── AdAccountProductAudiencesPostIphoneViewNoPurchase.java ├── AdAccountProductAudiencesPostNoPurchase.java ├── AdAccountReachEstimate.java ├── AdCampaignAdsEdge.java ├── AdCampaignGroupAdsEdge.java ├── AdCampaignGroupAdsEdgeAdgroupsWithStatusArchived.java ├── AdCampaignGroupAdsetsEdge.java ├── AdCampaignNode.java ├── AdCampaignNodeRead.java ├── AdCampaignNodeReadFormatUNIX.java ├── AdCampaignPost.java ├── AdCampaignPostAdsetUpdateCpa.java ├── AdCreativeNode.java ├── AdCreativeNodeRead.java ├── AdCreativeNodeReadInstagramPermalinkUrl.java ├── AdCreativePreviewsEdge.java ├── AdCreativePreviewsEdgePreview.java ├── AdCreativePreviewsEdgePreviewDynamicAds.java ├── AdCreativePreviewsEdgePreviewDynamicAdsWithCustomizations.java ├── AdSetsDelete.java ├── AdgroupDelete.java ├── AdgroupLeadsEdgeAdgroupLeads.java ├── AdgroupLeadsEdgeAdgroupLeadsDPA.java ├── AdgroupLeadsEdgeAdgroupLeadsFiltered.java ├── AdgroupNode.java ├── AdgroupPost.java ├── AdgroupPostAddLabel.java ├── AdgroupPostUpdateStatus.java ├── AdsInsightsEdgeAdCampaignInsights.java ├── AdsInsightsEdgeAdGroupInsights.java ├── AdsInsightsEdgeCampaignGroupAdLevelInsights.java ├── AdsInsightsEdgeCampaignGroupInsights.java ├── AdsPixelEventsPost.java ├── AdsPixelEventsPostCustom.java ├── AdsPixelSharedAccountsEdge.java ├── AdsPixelSharedAccountsPost.java ├── AdsPixelSharedAgenciesEdge.java ├── CampaignsDelete.java ├── CustomAudienceDelete.java ├── CustomAudienceNode.java ├── CustomAudienceNodeReadRule.java ├── CustomAudiencePost.java ├── CustomAudienceUsersPost.java ├── CustomAudienceUsersPostCrossPlatform.java ├── MULTIPost.java ├── MULTIPostOne.java ├── MULTIPostTwo.java ├── OfflineConversionsCreateOfflineSet.java ├── PROMOTE_YOUR_PAGE.java ├── PageFeedEdge.java ├── PageFeedPost.java ├── PageFeedPostFeedImageDeepLink.java ├── PageNode.java ├── PageNodePageSearch.java ├── PagePhotosEdge.java ├── PagePhotosPost.java ├── PagePictureEdge.java ├── PagePostCommentsPost.java ├── PagePostDelete.java ├── PagePostNode.java ├── PagePostPost.java ├── PagePostsEdge.java ├── PagePostsEdgePagePostCreateCarousel.java ├── PageRolesEdge.java ├── PageSubscribedAppsPost.java ├── ProductCatalogEventStatsEdge.java ├── ProductCatalogHotelsPost.java ├── ProductCatalogHotelsPostUpdateHotelsCatalogSettings.java ├── ProductCatalogProductFeedsPostProductFeed.java ├── ProductCatalogProductSetsPostHotelSet.java ├── ProductCatalogProductSetsPostProductSet.java ├── UserAccountsEdge.java ├── UserAdAccountsEdge.java ├── UserLeadGenInfoNode.java ├── UserNode.java ├── VideoThumbnailsEdge.java ├── image.png ├── image.png.zip ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── facebook │ └── ads │ └── sdk │ └── samples │ ├── AdhocAPIRequestExample.java │ ├── AsyncAdhocAPIRequestExample.java │ ├── AsyncBasicExample.java │ ├── BasicExample.java │ ├── BatchModeExample.java │ ├── CarouselAdsExample.java │ ├── CustomAudienceExample.java │ ├── ExampleConfig.java │ ├── FetchByIdsExample.java │ ├── MPAManagedPartnerOnboardingAsyncExample.java │ ├── NetworkCustomizationExample.java │ ├── PagingExample.java │ ├── QuickStartExample.java │ ├── ServerSideApiExample.java │ ├── TargetingExample.java │ ├── dpa-feed-example.xml │ └── video.mp4 ├── pom.xml ├── release.sh └── src ├── main └── java │ └── com │ └── facebook │ └── ads │ ├── sdk │ ├── ALMAdAccountInfo.java │ ├── ALMEndAdvertiserInfo.java │ ├── ALMEvent.java │ ├── ALMGuidance.java │ ├── ALMGuidanceMetrics.java │ ├── AMOneshopSettings.java │ ├── ANBlockedBICategory.java │ ├── APIConfig.java │ ├── APIContext.java │ ├── APIException.java │ ├── APINode.java │ ├── APINodeList.java │ ├── APIRequest.java │ ├── APIResponse.java │ ├── AREffect.java │ ├── Ad.java │ ├── AdAccount.java │ ├── AdAccountAAACompatibleAdObjects.java │ ├── AdAccountAAASimilarCampaigns.java │ ├── AdAccountASLSchedule.java │ ├── AdAccountAdLimitsInsights.java │ ├── AdAccountAdRulesCountByType.java │ ├── AdAccountAdRulesHistory.java │ ├── AdAccountAdVolume.java │ ├── AdAccountAdsRecommendedAudios.java │ ├── AdAccountAllPaymentMethods.java │ ├── AdAccountAmountSpentHistory.java │ ├── AdAccountAppSetupRequirements.java │ ├── AdAccountBankInfoList.java │ ├── AdAccountBillingDatePreference.java │ ├── AdAccountBusinessConstraints.java │ ├── AdAccountCampaignAttributionOptionInfo.java │ ├── AdAccountCreationRequest.java │ ├── AdAccountCustomAudienceLimits.java │ ├── AdAccountDefaultDestination.java │ ├── AdAccountDefaultObjective.java │ ├── AdAccountDeliveryEstimate.java │ ├── AdAccountDsaRecommendations.java │ ├── AdAccountIosFourteenCampaignLimits.java │ ├── AdAccountLiveVideoAdvertiser.java │ ├── AdAccountMatchedSearchApplicationsEdgeData.java │ ├── AdAccountMaxBid.java │ ├── AdAccountOptimizationGoalsAEMv2Eligibility.java │ ├── AdAccountPaymentDetails.java │ ├── AdAccountPaymentOptions.java │ ├── AdAccountPrepayDetails.java │ ├── AdAccountPromotableObjects.java │ ├── AdAccountPromotionProgressBar.java │ ├── AdAccountReachEstimate.java │ ├── AdAccountRecommendations.java │ ├── AdAccountRecommendedCamapaignBudget.java │ ├── AdAccountRelatedIcoStudy.java │ ├── AdAccountSmartSuggestedAds.java │ ├── AdAccountSpendCapChangeHistory.java │ ├── AdAccountSpendLimit.java │ ├── AdAccountSubscribedApps.java │ ├── AdAccountSubsidyAmountDetails.java │ ├── AdAccountSuggestedTag.java │ ├── AdAccountTargetingUnified.java │ ├── AdAccountTrackingData.java │ ├── AdAccountURLForAssetExtraction.java │ ├── AdAccountUser.java │ ├── AdAccountUserPermissions.java │ ├── AdAccountUserSettings.java │ ├── AdAccountYouthAdsAdvertiser.java │ ├── AdActivity.java │ ├── AdAssetBody.java │ ├── AdAssetCallToActionType.java │ ├── AdAssetCustomizationRuleCustomizationSpec.java │ ├── AdAssetDescription.java │ ├── AdAssetFeedAdditionalData.java │ ├── AdAssetFeedAdditionalDataPageNudgeMessage.java │ ├── AdAssetFeedSpec.java │ ├── AdAssetFeedSpecAssetCustomizationRule.java │ ├── AdAssetFeedSpecAssetLabel.java │ ├── AdAssetFeedSpecBody.java │ ├── AdAssetFeedSpecCallToAction.java │ ├── AdAssetFeedSpecCaption.java │ ├── AdAssetFeedSpecCarousel.java │ ├── AdAssetFeedSpecCarouselChildAttachment.java │ ├── AdAssetFeedSpecDescription.java │ ├── AdAssetFeedSpecEvents.java │ ├── AdAssetFeedSpecGroupRule.java │ ├── AdAssetFeedSpecImage.java │ ├── AdAssetFeedSpecLinkURL.java │ ├── AdAssetFeedSpecTitle.java │ ├── AdAssetFeedSpecVideo.java │ ├── AdAssetImage.java │ ├── AdAssetLinkURL.java │ ├── AdAssetMessageExtensions.java │ ├── AdAssetOnsiteDestinations.java │ ├── AdAssetTargetRuleTargeting.java │ ├── AdAssetTitle.java │ ├── AdAssetVideo.java │ ├── AdAsyncRequest.java │ ├── AdAsyncRequestSet.java │ ├── AdAsyncRequestSetNotificationResult.java │ ├── AdBidAdjustments.java │ ├── AdCampaignBidConstraint.java │ ├── AdCampaignConversionValueExpressionSpec.java │ ├── AdCampaignDeliveryEstimate.java │ ├── AdCampaignDeliveryStats.java │ ├── AdCampaignDeliveryStatsUnsupportedReasons.java │ ├── AdCampaignFrequencyControlSpecs.java │ ├── AdCampaignGroupAdvantageState.java │ ├── AdCampaignGroupIncrementalConversionOptimizationConfig.java │ ├── AdCampaignGroupMetricsMetadata.java │ ├── AdCampaignGroupStats.java │ ├── AdCampaignGroupStructureTree.java │ ├── AdCampaignIssuesInfo.java │ ├── AdCampaignLearningStageInfo.java │ ├── AdCampaignMetricsMetadata.java │ ├── AdCampaignMultiAds.java │ ├── AdCampaignOptimizationEvent.java │ ├── AdCampaignPacedBidInfo.java │ ├── AdCampaignStats.java │ ├── AdColumnSizes.java │ ├── AdContract.java │ ├── AdConversionValues.java │ ├── AdConversions.java │ ├── AdCreationPackageConfig.java │ ├── AdCreative.java │ ├── AdCreativeAdDisclaimer.java │ ├── AdCreativeAssetGroupsSpec.java │ ├── AdCreativeBrandedContentAds.java │ ├── AdCreativeBrandedContentAdsPartners.java │ ├── AdCreativeCollectionThumbnailInfo.java │ ├── AdCreativeContextualMultiAds.java │ ├── AdCreativeDegreesOfFreedomSpec.java │ ├── AdCreativeDestinationSpec.java │ ├── AdCreativeFacebookBrandedContent.java │ ├── AdCreativeFeatureActionMetadata.java │ ├── AdCreativeFeatureCustomizations.java │ ├── AdCreativeFeatureDetails.java │ ├── AdCreativeFeaturesSpec.java │ ├── AdCreativeGenerativeAssetSpec.java │ ├── AdCreativeHouseShopsAdsSellerContent.java │ ├── AdCreativeImageDataMediaElements.java │ ├── AdCreativeInsights.java │ ├── AdCreativeInstagramBrandedContent.java │ ├── AdCreativeInteractiveComponentsSpec.java │ ├── AdCreativeLinkData.java │ ├── AdCreativeLinkDataAppLinkSpec.java │ ├── AdCreativeLinkDataCallToAction.java │ ├── AdCreativeLinkDataCallToActionValue.java │ ├── AdCreativeLinkDataChildAttachment.java │ ├── AdCreativeLinkDataCustomOverlaySpec.java │ ├── AdCreativeLinkDataImageLayerSpec.java │ ├── AdCreativeLinkDataImageOverlaySpec.java │ ├── AdCreativeLinkDataMoment.java │ ├── AdCreativeLinkDataSponsorshipInfoSpec.java │ ├── AdCreativeLinkDataTemplateVideoSpec.java │ ├── AdCreativeMarketingMessageStructuredSpec.java │ ├── AdCreativeObjectStorySpec.java │ ├── AdCreativeOmnichannelLinkSpec.java │ ├── AdCreativePhotoData.java │ ├── AdCreativePhotoDataMediaElements.java │ ├── AdCreativePlaceData.java │ ├── AdCreativePlatformCustomization.java │ ├── AdCreativePortraitCustomizations.java │ ├── AdCreativePostClickConfiguration.java │ ├── AdCreativeProductData.java │ ├── AdCreativePromotionMetadataSpec.java │ ├── AdCreativeRecommenderSettings.java │ ├── AdCreativeRegionalRegulationDisclaimer.java │ ├── AdCreativeRewardInfo.java │ ├── AdCreativeShopSpec.java │ ├── AdCreativeSiteLinksSpec.java │ ├── AdCreativeSourcingSpec.java │ ├── AdCreativeStaticFallbackSpec.java │ ├── AdCreativeTemplateURLSpec.java │ ├── AdCreativeTextData.java │ ├── AdCreativeVideoData.java │ ├── AdCreativeVideoDataCustomOverlaySpec.java │ ├── AdCreativeVideoDataMediaElements.java │ ├── AdCreativeWhatsAppChannelSpec.java │ ├── AdCustomDerivedMetrics.java │ ├── AdCustomizationRuleSpec.java │ ├── AdDefaultValues.java │ ├── AdDraft.java │ ├── AdDynamicCreative.java │ ├── AdEntityTargetSpend.java │ ├── AdExportPreset.java │ ├── AdImage.java │ ├── AdKeywordStats.java │ ├── AdKeywords.java │ ├── AdKpiShift.java │ ├── AdLabel.java │ ├── AdLightAdgroup.java │ ├── AdLightCampaign.java │ ├── AdLightCampaignGroup.java │ ├── AdLimitSetting.java │ ├── AdLimitsEnforcementData.java │ ├── AdMonetizationProperty.java │ ├── AdNetworkAnalyticsAsyncQueryExport.java │ ├── AdNetworkAnalyticsAsyncQueryResult.java │ ├── AdNetworkAnalyticsSyncQueryResult.java │ ├── AdPlacePageSet.java │ ├── AdPlacePageSetMetadata.java │ ├── AdPlacement.java │ ├── AdPreview.java │ ├── AdPromotedObject.java │ ├── AdProposal.java │ ├── AdRecommendation.java │ ├── AdRecommendationData.java │ ├── AdReportRun.java │ ├── AdRule.java │ ├── AdRuleEvaluationSpec.java │ ├── AdRuleExecutionOptions.java │ ├── AdRuleExecutionSpec.java │ ├── AdRuleFilters.java │ ├── AdRuleHistory.java │ ├── AdRuleHistoryResult.java │ ├── AdRuleHistoryResultAction.java │ ├── AdRuleSchedule.java │ ├── AdRuleScheduleSpec.java │ ├── AdRuleTrigger.java │ ├── AdSavedKeywords.java │ ├── AdSavedLocation.java │ ├── AdSavedReport.java │ ├── AdSet.java │ ├── AdStudy.java │ ├── AdStudyCell.java │ ├── AdStudyObjective.java │ ├── AdStudyObjectiveID.java │ ├── AdStudyObjectiveOffsiteDatasets.java │ ├── AdTopline.java │ ├── AdToplineDetail.java │ ├── AdVideo.java │ ├── AdVolume.java │ ├── AdgroupFacebookFeedback.java │ ├── AdgroupIssuesInfo.java │ ├── AdgroupMetadata.java │ ├── AdgroupPlacementSpecificReviewFeedback.java │ ├── AdgroupReviewFeedback.java │ ├── AdjacentContentDeliveryReport.java │ ├── AdsActionStats.java │ ├── AdsAnomalyDetection.java │ ├── AdsConversionGoal.java │ ├── AdsCreationSavedState.java │ ├── AdsCustomPivotsPreview.java │ ├── AdsDataset.java │ ├── AdsEligibility.java │ ├── AdsGuidanceQEExposure.java │ ├── AdsHistogramStats.java │ ├── AdsImageCrops.java │ ├── AdsInsights.java │ ├── AdsMcmeConversion.java │ ├── AdsNamingTemplate.java │ ├── AdsOptimalDeliveryGrowthOpportunity.java │ ├── AdsPaymentCycle.java │ ├── AdsPivotRules.java │ ├── AdsPixel.java │ ├── AdsPixelCAPIIntegrationQuality.java │ ├── AdsPixelCapabilityOverride.java │ ├── AdsPixelDeliveryRecommendations.java │ ├── AdsPixelDomainControlRule.java │ ├── AdsPixelDomainLastFiredTime.java │ ├── AdsPixelEventLastFiredTime.java │ ├── AdsPixelEventPrediction.java │ ├── AdsPixelEventSuggestionRule.java │ ├── AdsPixelItemPrice.java │ ├── AdsPixelMicrodataStats.java │ ├── AdsPixelRawFiresResult.java │ ├── AdsPixelRealTimeEventLogResult.java │ ├── AdsPixelRecentEventsResult.java │ ├── AdsPixelSignalsIWLFeedbackNux.java │ ├── AdsPixelSignalsIWLNux.java │ ├── AdsPixelStats.java │ ├── AdsPixelStatsResult.java │ ├── AdsQuickViews.java │ ├── AdsReportBuilder.java │ ├── AdsReportBuilderExportCore.java │ ├── AdsReportBuilderMMMReport.java │ ├── AdsReportBuilderMMMReportScheduler.java │ ├── AdsReportBuilderSavedReport.java │ ├── AdsSegments.java │ ├── AdsSignalDiagnosticIssue.java │ ├── AdsStartYourDayWidget.java │ ├── AdsTabular.java │ ├── AdsTargetingInsights.java │ ├── AdsTextSuggestions.java │ ├── AdsUserSettings.java │ ├── AdsValueAdjustmentRule.java │ ├── AdsValueAdjustmentRuleCollection.java │ ├── AdvAInstance.java │ ├── AdvertiserVerificationStatus.java │ ├── AgeRange.java │ ├── AgencyClientDeclaration.java │ ├── Album.java │ ├── AnalyticsConfig.java │ ├── AnalyticsEntityUserConfig.java │ ├── AnalyticsFunnelQueryResult.java │ ├── AnalyticsPlatformMetricsConfig.java │ ├── AnalyticsQueryResult.java │ ├── AnalyticsSegment.java │ ├── AnalyticsUserConfig.java │ ├── AndroidAppLink.java │ ├── AppEventConfig.java │ ├── AppLinks.java │ ├── AppOptimizedCustomEvents.java │ ├── AppPublisher.java │ ├── AppRequest.java │ ├── AppRequestFormerRecipient.java │ ├── Application.java │ ├── ArAdsDataContainer.java │ ├── AssignedUser.java │ ├── AsyncRequest.java │ ├── AsyncSession.java │ ├── AttributionSpec.java │ ├── AudienceFunnel.java │ ├── AudienceOverlap.java │ ├── AudiencePermission.java │ ├── AudiencePermissionForActions.java │ ├── AudienceSharingAccountValid.java │ ├── AudienceSharingRecipientAccounts.java │ ├── AudioAsset.java │ ├── AudioCopyright.java │ ├── AudioIsrc.java │ ├── AudioRelease.java │ ├── AudioVisualReferenceMatch.java │ ├── AuthLink.java │ ├── AutomotiveModel.java │ ├── Avatar.java │ ├── AvatarProfilePicture.java │ ├── BAPIDomain.java │ ├── BCPCampaign.java │ ├── BatchRequest.java │ ├── BespokePartnerGuidanceLaser.java │ ├── BidSchedule.java │ ├── BizInboxOffsiteEmailAccount.java │ ├── BlindPig.java │ ├── BlockedUserInfo.java │ ├── BrandRequest.java │ ├── BrandSafetyBlockListUsage.java │ ├── BrandSafetyCampaignConfig.java │ ├── BrandSafetyDownloadable.java │ ├── BrandedContentAdError.java │ ├── BrandedContentEligibleSponsorIDs.java │ ├── BrandedContentShadowIGMediaID.java │ ├── BrandedContentShadowIGUserID.java │ ├── BroadTargetingCategories.java │ ├── Business.java │ ├── BusinessAdAccountRequest.java │ ├── BusinessAdsReportingReportSpecs.java │ ├── BusinessAdvertisableApplicationsResult.java │ ├── BusinessAgreement.java │ ├── BusinessApplicationRequest.java │ ├── BusinessAssetGroup.java │ ├── BusinessAssetSharingAgreement.java │ ├── BusinessCreative.java │ ├── BusinessCreativeFolder.java │ ├── BusinessCreativeInsights.java │ ├── BusinessFranchiseConfig.java │ ├── BusinessImage.java │ ├── BusinessImageTBusinessFolderPathItem.java │ ├── BusinessManagedPartnerEligibility.java │ ├── BusinessMediaAdPlacementValidationResult.java │ ├── BusinessObject.java │ ├── BusinessObjectTransferOwnershipAgreement.java │ ├── BusinessOwnedObjectOnBehalfOfRequest.java │ ├── BusinessPageRequest.java │ ├── BusinessPartnerPremiumOptions.java │ ├── BusinessProductCatalogTOS.java │ ├── BusinessProject.java │ ├── BusinessRequest.java │ ├── BusinessRoleRequest.java │ ├── BusinessSettingLogsData.java │ ├── BusinessTag.java │ ├── BusinessTrafficAnalysisReport.java │ ├── BusinessUser.java │ ├── BusinessVideo.java │ ├── BusinessVideoTBusinessFolderPathItem.java │ ├── CASSSetupOfflineEventSetProgress.java │ ├── CPASAdCreationTemplate.java │ ├── CPASAdvertiserPartnershipRecommendation.java │ ├── CPASBusinessSetupConfig.java │ ├── CPASCollaborationRequest.java │ ├── CPASLsbImageBank.java │ ├── CPASMerchantConfig.java │ ├── CPASParentCatalogSettings.java │ ├── CPASSetup.java │ ├── CPASSetupPageStructureProgress.java │ ├── CRMAddress.java │ ├── CTWAWhatsAppNumbersInfo.java │ ├── CTXDefaultOptimizationConfig.java │ ├── CTXOptimizationEligibility.java │ ├── CTXPartnerAppWelcomeMessageFlow.java │ ├── CalibratorExistingRule.java │ ├── CallAdsPhoneData.java │ ├── Campaign.java │ ├── CampaignActionsData.java │ ├── CampaignGroupBrandConfiguration.java │ ├── CampaignGroupCollaborativeAdsPartnerInfo.java │ ├── Canvas.java │ ├── CanvasAdSettings.java │ ├── CanvasBodyElement.java │ ├── CanvasCollectionThumbnail.java │ ├── CanvasDynamicSetting.java │ ├── CanvasPreview.java │ ├── CanvasTemplate.java │ ├── CatalogAdvertiserInsight.java │ ├── CatalogBasedTargeting.java │ ├── CatalogCollection.java │ ├── CatalogContentVersionConfig.java │ ├── CatalogItemAppLinks.java │ ├── CatalogItemChannelsToIntegrityStatus.java │ ├── CatalogItemOverride.java │ ├── CatalogItemRejectionReasons.java │ ├── CatalogItemValidationErrorList.java │ ├── CatalogSmartPixelSettings.java │ ├── CatalogSubVerticalList.java │ ├── CatalogWebsiteOnboardingSettings.java │ ├── CatalogWebsiteSettings.java │ ├── ChatPlugin.java │ ├── CheckBatchRequestStatus.java │ ├── ChildEvent.java │ ├── ChinaBusinessOnboardingVettingRequest.java │ ├── CloudGame.java │ ├── CloudbridgeDatasetStatus.java │ ├── CollaborativeAdsPartnerBusinesses.java │ ├── CollaborativeAdsPartnerInfoListItem.java │ ├── CollaborativeAdsShareSettings.java │ ├── ColumnSuggestions.java │ ├── Comment.java │ ├── CommerceMerchantSettings.java │ ├── CommerceMerchantSettingsSetupStatus.java │ ├── CommerceOrder.java │ ├── CommerceOrderTransactionDetail.java │ ├── CommercePayout.java │ ├── CommerceSettings.java │ ├── ConnectionsTargeting.java │ ├── ContactsMessengerSyncConfig.java │ ├── ContentBlockList.java │ ├── ContentDeliveryReport.java │ ├── ContentPublishingLimitResponse.java │ ├── ContextualBundlingSpec.java │ ├── ConversionActionQuery.java │ ├── ConversionHealthKPI.java │ ├── CopyrightAttributionInsights.java │ ├── CopyrightAudioAsset.java │ ├── CopyrightMediaMisuse.java │ ├── CopyrightReferenceContainer.java │ ├── CoverPhoto.java │ ├── CrashReporter.java │ ├── CreativeAssetTag.java │ ├── CreativeHistory.java │ ├── CreativeMulticellTestConfig.java │ ├── CreatorAssetCreative.java │ ├── CreditCard.java │ ├── CreditPartitionActionOptions.java │ ├── Currency.java │ ├── CurrencyAmount.java │ ├── CustomAudience.java │ ├── CustomAudienceAdAccount.java │ ├── CustomAudienceCapabilities.java │ ├── CustomAudienceDataSource.java │ ├── CustomAudienceGroup.java │ ├── CustomAudienceHealth.java │ ├── CustomAudienceSalts.java │ ├── CustomAudienceSession.java │ ├── CustomAudienceSharedAccountCampaignInfo.java │ ├── CustomAudienceSharingStatus.java │ ├── CustomAudienceStatus.java │ ├── CustomAudiencesTOS.java │ ├── CustomAudiencesharedAccountInfo.java │ ├── CustomConversion.java │ ├── CustomConversionActivities.java │ ├── CustomConversionStatsResult.java │ ├── CustomUserSettings.java │ ├── DACheck.java │ ├── Dataset.java │ ├── DayPart.java │ ├── DeliveryCheck.java │ ├── DeliveryCheckExtraInfo.java │ ├── DeliveryInfo.java │ ├── DeliveryStatus.java │ ├── DeliveryWindow.java │ ├── Destination.java │ ├── DirectDebit.java │ ├── DraftPost.java │ ├── DynamicARMetadata.java │ ├── DynamicContentSet.java │ ├── DynamicItemDisplayBundle.java │ ├── DynamicItemDisplayBundleFolder.java │ ├── DynamicPostChildAttachment.java │ ├── DynamicPriceConfigByDate.java │ ├── DynamicVideoMetadata.java │ ├── EducationExperience.java │ ├── EmailImport.java │ ├── EndStudyCriteria.java │ ├── Engagement.java │ ├── EntWithSponsor.java │ ├── EntityAtTextRange.java │ ├── Event.java │ ├── EventExternalTicketInfo.java │ ├── EventRegistrationSetting.java │ ├── EventSourceGroup.java │ ├── EventTicketSetting.java │ ├── EventTicketTier.java │ ├── EventTour.java │ ├── Experience.java │ ├── ExtendedCredit.java │ ├── ExtendedCreditAllocationConfig.java │ ├── ExtendedCreditApplication.java │ ├── ExtendedCreditEmail.java │ ├── ExtendedCreditInfo.java │ ├── ExtendedCreditInvoiceGroup.java │ ├── ExternalEventSource.java │ ├── ExternalEventSourceCPASEventsDebugging.java │ ├── ExternalEventSourceCPASEventsDebuggingInfo.java │ ├── ExternalMerchantSettings.java │ ├── FAMEKumo.java │ ├── FBImageCopyrightMatch.java │ ├── FBLiteToNTTransitions.java │ ├── FBPageAndInstagramAccount.java │ ├── FBPayButtonLogin.java │ ├── FantasyGame.java │ ├── FavoriteCatalog.java │ ├── FinanceObject.java │ ├── FlexibleTargeting.java │ ├── Flight.java │ ├── FranchiseProgram.java │ ├── FranchiseProgramMember.java │ ├── FundingSourceDetails.java │ ├── FundingSourceDetailsCoupon.java │ ├── FundingSourceDetailsCouponTiering.java │ ├── FundraiserPersonToCharity.java │ ├── GeoGatingPolicy.java │ ├── Group.java │ ├── HasLeadAccess.java │ ├── HighDemandPeriod.java │ ├── HighDemandPeriodTimeSuggestionWeeklySegment.java │ ├── HomeListing.java │ ├── Hotel.java │ ├── HotelRoom.java │ ├── Hours.java │ ├── IDName.java │ ├── IGAccessTokenForIGOnlyAPI.java │ ├── IGBCAdsPermission.java │ ├── IGBoostMediaAd.java │ ├── IGComment.java │ ├── IGCommentFromUser.java │ ├── IGMedia.java │ ├── IGMediaBoostEligibilityInfo.java │ ├── IGMediaForIGOnlyAPI.java │ ├── IGProductTaggingInvalidationError.java │ ├── IGRefreshAccessTokenForIGOnlyAPI.java │ ├── IGResumableVideoUploadStatus.java │ ├── IGShoppingProductAppeal.java │ ├── IGShoppingReviewStatus.java │ ├── IGShoppingReviewStatusOnsiteEligibility.java │ ├── IGShoppingReviewStatusReasonWithHelpMessage.java │ ├── IGUpcomingEvent.java │ ├── IGUser.java │ ├── IGUserExportForCAM.java │ ├── IGUserForIGOnlyAPI.java │ ├── IGUserSubscribedAppsData.java │ ├── IGVideoCopyrightCheckMatchesInformation.java │ ├── IGVideoCopyrightCheckStatus.java │ ├── IPObject.java │ ├── ImageCopyright.java │ ├── ImageCopyrightDispute.java │ ├── ImageReferenceMatch.java │ ├── InsightsResult.java │ ├── InsightsValue.java │ ├── InstagramInsightsResult.java │ ├── InstagramInsightsValue.java │ ├── InstagramRelatedProductTags.java │ ├── InstagramShoppingMerchantReviewMessage.java │ ├── InstagramUser.java │ ├── InstantArticleInsightsQueryResult.java │ ├── IosAppLink.java │ ├── JobOpening.java │ ├── KeyValue.java │ ├── KeywordDeliveryReport.java │ ├── Lead.java │ ├── LeadGenAppointmentBookingInfo.java │ ├── LeadGenAppointmentSlotsByDay.java │ ├── LeadGenAppointmentTimeSlot.java │ ├── LeadGenConditionalQuestionsGroupChoices.java │ ├── LeadGenConditionalQuestionsGroupQuestions.java │ ├── LeadGenContextCard.java │ ├── LeadGenCustomDisclaimer.java │ ├── LeadGenCustomDisclaimerBody.java │ ├── LeadGenDataDraft.java │ ├── LeadGenDirectCRMIntegrationConfig.java │ ├── LeadGenDraftQuestion.java │ ├── LeadGenFormPreviewDetails.java │ ├── LeadGenLegalContent.java │ ├── LeadGenLegalContentCheckbox.java │ ├── LeadGenPostSubmissionCheckResult.java │ ├── LeadGenPrivacyPolicy.java │ ├── LeadGenQuestion.java │ ├── LeadGenQuestionOption.java │ ├── LeadGenThankYouPage.java │ ├── LeadGenThankYouPageGatedFile.java │ ├── LeadGenThankYouPageGatedPromo.java │ ├── LeadGenURLEntityAtRanges.java │ ├── LeadgenForm.java │ ├── LifeEvent.java │ ├── Link.java │ ├── LinkedInstagramAccountData.java │ ├── LiveVideo.java │ ├── LiveVideoAdBreakConfig.java │ ├── LiveVideoAdCampaignConfig.java │ ├── LiveVideoError.java │ ├── LiveVideoInputStream.java │ ├── LiveVideoRecommendedEncoderSettings.java │ ├── LiveVideoTargeting.java │ ├── LocalServiceBusiness.java │ ├── Location.java │ ├── LookalikeSpec.java │ ├── LoomConfig.java │ ├── MCExperienceConfigForApi.java │ ├── MIXInsightsResult.java │ ├── MailingAddress.java │ ├── ManagedPartnerBusiness.java │ ├── ManagedPartnerExtendedCredit.java │ ├── McomInvoiceBankAccount.java │ ├── McomInvoiceDetails.java │ ├── McomInvoiceLists.java │ ├── McomInvoiceStatus.java │ ├── McomOnboardingStatus.java │ ├── McomPayouts.java │ ├── MeasurementReport.java │ ├── MediaCopyrightAttribution.java │ ├── MediaCopyrightUpdateRecord.java │ ├── MediaFingerprint.java │ ├── MediaTitle.java │ ├── MerchantCompliance.java │ ├── MessageDeliveryEstimate.java │ ├── MessagingAppsInfo.java │ ├── MessagingFeatureReview.java │ ├── MessagingFeatureStatus.java │ ├── MessengerAdsPartialAutomatedStepList.java │ ├── MessengerBusinessTemplate.java │ ├── MessengerCallSettings.java │ ├── MessengerDestinationPageWelcomeMessage.java │ ├── MessengerProfile.java │ ├── MinimumBudget.java │ ├── MusicVideoCopyright.java │ ├── MusicWorkCopyright.java │ ├── NullNode.java │ ├── OfflineConversionDataSet.java │ ├── OfflineConversionDataSetActivities.java │ ├── OfflineConversionDataSetOptimizationStatus.java │ ├── OfflineConversionDataSetPermissions.java │ ├── OfflineConversionDataSetUpload.java │ ├── OfflineConversionDataSetUsage.java │ ├── OfflineProductItem.java │ ├── OfflineTermsOfService.java │ ├── OffsitePixel.java │ ├── OffsiteSignalContainerBusinessObject.java │ ├── OmegaCustomerTrx.java │ ├── OpenBridgeConfiguration.java │ ├── OpenGraphContext.java │ ├── OrderIDAttributions.java │ ├── Organization.java │ ├── OutcomePredictionPoint.java │ ├── OverrideDetails.java │ ├── OwnedDomain.java │ ├── P2MInvoicePayments.java │ ├── Page.java │ ├── PageAboutStoryComposedBlock.java │ ├── PageAboutStoryComposedBlockEntityRanges.java │ ├── PageAboutStoryComposedBlockInlineStyle.java │ ├── PageAppWithLeadsAccess.java │ ├── PageBroadcast.java │ ├── PageCTSTopic.java │ ├── PageCTXBudgetSimilarAdvertiserBudgetRecommendation.java │ ├── PageCTXDefaultGreetingText.java │ ├── PageCTXMessagingFeatureLimit.java │ ├── PageCallToAction.java │ ├── PageCategory.java │ ├── PageChangeProposal.java │ ├── PageCrmsWithLeadsAccess.java │ ├── PageDirectIntegrationCrmWithLeadsAccess.java │ ├── PageGameBotQuotaInformation.java │ ├── PageGetStartedNullstate.java │ ├── PageInsightsAsyncExportRun.java │ ├── PageLeadsAccessConfig.java │ ├── PageLocationsBreakdown.java │ ├── PageMessageResponsivenessMetrics.java │ ├── PageParking.java │ ├── PagePartnerWithLeadsAccess.java │ ├── PagePaymentOptions.java │ ├── PagePost.java │ ├── PagePostExperiment.java │ ├── PagePublisher.java │ ├── PageRestaurantServices.java │ ├── PageRestaurantSpecialties.java │ ├── PageSettings.java │ ├── PageStartInfo.java │ ├── PageThreadOwner.java │ ├── PageUpcomingChange.java │ ├── PageUserMessageThreadLabel.java │ ├── PageUserPermissions.java │ ├── PageUserWithLeadsAccess.java │ ├── PartnerAccountLinking.java │ ├── PartnerCategory.java │ ├── PartnerIntegrationLinked.java │ ├── PartnerStudy.java │ ├── PartnershipAdContentSearchMedia.java │ ├── PartnershipAdsIdentity.java │ ├── PaymentEnginePayment.java │ ├── PaymentPricepoints.java │ ├── PaymentRequestDetails.java │ ├── PaymentSubscription.java │ ├── Permission.java │ ├── Persona.java │ ├── PersonalAdsPersona.java │ ├── Photo.java │ ├── PhotoMetadata.java │ ├── Place.java │ ├── PlaceTag.java │ ├── PlaceTopic.java │ ├── Placement.java │ ├── PlatformImageSource.java │ ├── PlatformSessionKey.java │ ├── PlayableContent.java │ ├── Post.java │ ├── PreapprovalReview.java │ ├── PremiumMusicVideo.java │ ├── Privacy.java │ ├── PrivacyOption.java │ ├── PrivateLiftStudyInstance.java │ ├── ProductCatalog.java │ ├── ProductCatalogCategory.java │ ├── ProductCatalogDataSource.java │ ├── ProductCatalogDiagnosticGroup.java │ ├── ProductCatalogFacets.java │ ├── ProductCatalogHotelRoomsBatch.java │ ├── ProductCatalogImageSettings.java │ ├── ProductCatalogImageSettingsInternal.java │ ├── ProductCatalogImageSettingsOperation.java │ ├── ProductCatalogLocalizationSettings.java │ ├── ProductCatalogPricingVariablesBatch.java │ ├── ProductCatalogProductSetsBatch.java │ ├── ProductCatalogUserActions.java │ ├── ProductCatalogUserTasks.java │ ├── ProductDaEventSamplesBatch.java │ ├── ProductDeliveryPreference.java │ ├── ProductEventStat.java │ ├── ProductFeed.java │ ├── ProductFeedRule.java │ ├── ProductFeedRulePreviewSample.java │ ├── ProductFeedRuleSuggestion.java │ ├── ProductFeedSchedule.java │ ├── ProductFeedUpload.java │ ├── ProductFeedUploadError.java │ ├── ProductFeedUploadErrorReport.java │ ├── ProductFeedUploadErrorSample.java │ ├── ProductFeedUploadProgress.java │ ├── ProductGroup.java │ ├── ProductImage.java │ ├── ProductItem.java │ ├── ProductItemCommerceInsights.java │ ├── ProductItemError.java │ ├── ProductItemImporterAddress.java │ ├── ProductItemInsights.java │ ├── ProductItemInvalidationError.java │ ├── ProductItemLandingPageData.java │ ├── ProductItemLocalInfo.java │ ├── ProductItemLocalInfoLatLongShape.java │ ├── ProductItemOffer.java │ ├── ProductItemShipping.java │ ├── ProductItemSubscriptionInfo.java │ ├── ProductItemUnitPrice.java │ ├── ProductSet.java │ ├── ProductSetMetadata.java │ ├── ProductSetTaxonCategory.java │ ├── ProductSetUsage.java │ ├── ProductVariant.java │ ├── ProductVisualVariant.java │ ├── Profile.java │ ├── ProfilePictureSource.java │ ├── PublisherBlockList.java │ ├── PublisherDeliveryReport.java │ ├── PublisherWhiteList.java │ ├── RTBDynamicPost.java │ ├── RawCustomAudience.java │ ├── ReachFrequencyActivity.java │ ├── ReachFrequencyAdFormat.java │ ├── ReachFrequencyCurveLowerConfidenceRange.java │ ├── ReachFrequencyCurveUpperConfidenceRange.java │ ├── ReachFrequencyDayPart.java │ ├── ReachFrequencyEstimatesCurve.java │ ├── ReachFrequencyEstimatesPlacementBreakdown.java │ ├── ReachFrequencyPrediction.java │ ├── ReachFrequencySpec.java │ ├── Recommendation.java │ ├── RecommendedIGMedia.java │ ├── RecommendedPagePost.java │ ├── RegionalRegulationIdentities.java │ ├── ReportingAudience.java │ ├── ResearchPollStudy.java │ ├── ResellerGuidance.java │ ├── RevSharePolicy.java │ ├── RichMediaElement.java │ ├── RightsManagerDataExport.java │ ├── RightsManagerInsights.java │ ├── Robot.java │ ├── SalesRightsInventoryManagement.java │ ├── SavedAudience.java │ ├── SavedMessageResponse.java │ ├── ScheduledPost.java │ ├── ScimCompanyUserPhoneNumber.java │ ├── SecuritySettings.java │ ├── ShadowIGHashtag.java │ ├── ShadowIGMediaBoostedInsightsResult.java │ ├── ShadowIGMediaBuilder.java │ ├── ShadowIGMediaCollaborators.java │ ├── ShadowIGMediaProductTags.java │ ├── ShadowIGUserCatalogProductSearch.java │ ├── ShadowIGUserCatalogProductVariant.java │ ├── ShadowIGUserPartnershipAdsMediaErrors.java │ ├── Shop.java │ ├── SignalsIWLExtractor.java │ ├── SingleOwnerAdditionalProfile.java │ ├── SiteLink.java │ ├── SlicedEventSourceGroup.java │ ├── SmartPixelInsights.java │ ├── SocialWifiSite.java │ ├── SplitTestConfig.java │ ├── SplitTestWinner.java │ ├── Status.java │ ├── StoreCatalogSettings.java │ ├── StoreLocation.java │ ├── Stories.java │ ├── StreamFilter.java │ ├── SystemUser.java │ ├── Tab.java │ ├── TaggableSubject.java │ ├── Targeting.java │ ├── TargetingAutomation.java │ ├── TargetingDynamicRule.java │ ├── TargetingGeoLocation.java │ ├── TargetingGeoLocationCity.java │ ├── TargetingGeoLocationCustomLocation.java │ ├── TargetingGeoLocationElectoralDistrict.java │ ├── TargetingGeoLocationGeoEntities.java │ ├── TargetingGeoLocationLocationCluster.java │ ├── TargetingGeoLocationLocationExpansion.java │ ├── TargetingGeoLocationMarket.java │ ├── TargetingGeoLocationPlace.java │ ├── TargetingGeoLocationPoliticalDistrict.java │ ├── TargetingGeoLocationRegion.java │ ├── TargetingGeoLocationZip.java │ ├── TargetingMarketingMessageChannels.java │ ├── TargetingProductAudienceSpec.java │ ├── TargetingProductAudienceSubSpec.java │ ├── TargetingProspectingAudience.java │ ├── TargetingRelaxation.java │ ├── TargetingSentenceLine.java │ ├── TargetingSubscriberUniverse.java │ ├── TextWithEntities.java │ ├── ThirdPartyMeasurementReportDataset.java │ ├── ThirdPartyPartnerLiftRequest.java │ ├── ThirdPartyPartnerPanelRequest.java │ ├── ThirdPartyPartnerPanelScheduled.java │ ├── ThirdPartyPartnerViewabilityRequest.java │ ├── ThreadsUser.java │ ├── TimeSuggestion.java │ ├── TimezoneOffset.java │ ├── TrackingAndConversionWithDefaults.java │ ├── TransactableItem.java │ ├── Transaction.java │ ├── URL.java │ ├── UnifiedThread.java │ ├── UniqueAdCreative.java │ ├── User.java │ ├── UserAvailableCatalogs.java │ ├── UserContext.java │ ├── UserCoverPhoto.java │ ├── UserDevice.java │ ├── UserIDForApp.java │ ├── UserIDForPage.java │ ├── UserLeadGenDisclaimerResponse.java │ ├── UserLeadGenFieldData.java │ ├── UserMobileConfig.java │ ├── UserNotificationSeenStateData.java │ ├── UserPageOneTimeOptInTokenSettings.java │ ├── UserPaymentMethodsInfo.java │ ├── UserPaymentMobilePricepoints.java │ ├── UserPaymentModulesOptions.java │ ├── ValueBasedEligibleSource.java │ ├── Vehicle.java │ ├── VehicleOffer.java │ ├── VideoCopyright.java │ ├── VideoCopyrightCheckStatus.java │ ├── VideoCopyrightConditionGroup.java │ ├── VideoCopyrightGeoGate.java │ ├── VideoCopyrightMatch.java │ ├── VideoCopyrightRule.java │ ├── VideoCopyrightSegment.java │ ├── VideoGroup.java │ ├── VideoList.java │ ├── VideoPoll.java │ ├── VideoStats.java │ ├── VideoStatus.java │ ├── VideoStatusError.java │ ├── VideoStatusProcessingPhase.java │ ├── VideoStatusPublishingPhase.java │ ├── VideoStatusUploadingPhase.java │ ├── VideoTextQuestion.java │ ├── VideoThumbnail.java │ ├── VideoUploadLimits.java │ ├── VoipInfo.java │ ├── WITUser.java │ ├── WearableDevicePublicKey.java │ ├── WebAppLink.java │ ├── WebPublisher.java │ ├── WebsiteCreativeAssetSource.java │ ├── WebsiteCreativeAssetSuggestions.java │ ├── WhatsAppBusinessAccount.java │ ├── WhatsAppBusinessHealthStatus.java │ ├── WhatsAppBusinessHealthStatusForMessageSend.java │ ├── WhatsAppBusinessPartnerClientVerificationSubmission.java │ ├── WhatsAppBusinessPreVerifiedPhoneNumber.java │ ├── WhatsAppBusinessProfile.java │ ├── WhatsAppPaymentCapabilities.java │ ├── WhatsappSubscribedAppsInfo.java │ ├── WhitehatFBDLRun.java │ ├── WifiInformation.java │ ├── WindowsAppLink.java │ ├── WindowsPhoneAppLink.java │ ├── WithAsset3D.java │ ├── WoodhengePurchasedPAYGReceipt.java │ ├── WoodhengeSupporter.java │ ├── WorkAccessCode.java │ ├── WorkExperience.java │ ├── WorkSkill.java │ ├── WorkUserBadges.java │ ├── WorkUserFrontline.java │ ├── businessdataapi │ │ ├── Content.java │ │ ├── CustomData.java │ │ ├── Event.java │ │ ├── EventRequest.java │ │ ├── EventResponse.java │ │ ├── Message.java │ │ └── UserData.java │ ├── customtype │ │ └── TargetingOptimizationTuple.java │ ├── serverside │ │ ├── ActionSource.java │ │ ├── AppData.java │ │ ├── AttributionData.java │ │ ├── AttributionModelEnum.java │ │ ├── BatchProcessor.java │ │ ├── CAPIGatewayEndpoint.java │ │ ├── Content.java │ │ ├── CustomData.java │ │ ├── CustomEndpointRequest.java │ │ ├── CustomEndpointResponse.java │ │ ├── DeliveryCategory.java │ │ ├── Event.java │ │ ├── EventRequest.java │ │ ├── EventResponse.java │ │ ├── ExtendedDeviceInfo.java │ │ ├── GenderEnum.java │ │ ├── HttpMethodEnum.java │ │ ├── HttpServiceInterface.java │ │ ├── HttpServiceParams.java │ │ ├── MessagingChannel.java │ │ ├── OriginalEventData.java │ │ ├── UserData.java │ │ └── utils │ │ │ ├── HashedListAdaptor.java │ │ │ ├── Sha256GenderEnumListAdaptor.java │ │ │ ├── Sha256StringAdaptor.java │ │ │ └── Sha256StringListAdaptor.java │ └── signal │ │ ├── Content.java │ │ ├── CustomData.java │ │ ├── Event.java │ │ ├── EventRequest.java │ │ ├── SignalResponse.java │ │ └── UserData.java │ └── utils │ ├── AppDataAdapter.java │ ├── BusinessDataApiConstants.java │ ├── CustomDataAdapter.java │ ├── ServerSideApiConstants.java │ ├── ServerSideApiUtil.java │ └── VideoUtils.java └── test ├── java └── com │ └── facebook │ └── ads │ ├── ServerSideNormalizationTest.java │ ├── ServerSideTest.java │ ├── SignalTest.java │ ├── sdk │ └── serverside │ │ ├── AttributionDataTest.java │ │ ├── BatchProcessorTest.java │ │ ├── CAPIGatewayEndpointTest.java │ │ ├── ContentTest.java │ │ ├── CustomDataTest.java │ │ ├── EventAmTest.java │ │ ├── EventRequestCustomEndpointTest.java │ │ ├── EventRequestTest.java │ │ ├── EventTest.java │ │ ├── OriginalEventDataTest.java │ │ ├── UserDataTest.java │ │ └── utils │ │ ├── HashedListAdaptorTest.java │ │ └── Sha256StringAdaptorTest.java │ └── utils │ └── ServerSideApiUtilTest.java └── kotlin └── com └── facebook └── ads └── APIContextTest.kt /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Which SDK version are you using? 2 | 3 | ### What's the issue? 4 | 5 | ### Steps/Sample code to reproduce the issue 6 | 7 | #### Observed Results: 8 | 9 | * What happened? This could be a description, log output, etc. 10 | 11 | #### Expected Results: 12 | 13 | * What did you expect to happen? 14 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | # Number of days of inactivity before an issue becomes stale 3 | daysUntilStale: 90 4 | # Number of days of inactivity before a stale issue is closed 5 | daysUntilClose: 7 6 | # Issues with these labels will never be considered stale 7 | exemptLabels: [] 8 | # Label to use when marking an issue as stale 9 | staleLabel: Stale 10 | # Comment to post when marking an issue as stale. Set to `false` to disable 11 | markComment: > 12 | Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. 13 | Thank you for your contributions. 14 | # Comment to post when closing a stale issue. Set to `false` to disable 15 | closeComment: > 16 | Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. 17 | only: issues 18 | -------------------------------------------------------------------------------- /.github/workflows/ci-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish package to the Maven Central Repository 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Set up Maven Central Repository 14 | uses: actions/setup-java@v1 15 | with: 16 | java-version: 1.8 17 | - name: Configure GPG Key 18 | run: | 19 | mkdir -p ~/.gnupg/ 20 | printf "${GPG_SIGNING_KEY}" | base64 --decode > ~/.gnupg/private.key 21 | md5sum ~/.gnupg/private.key 22 | gpg --import --no-tty --batch --yes ~/.gnupg/private.key 23 | echo use-agent >> ~/.gnupg/gpg.conf 24 | echo pinentry-mode loopback >> ~/.gnupg/gpg.conf 25 | echo allow-loopback-pinentry >> ~/.gnupg/gpg-agent.conf 26 | echo RELOADAGENT | gpg-connect-agent 27 | gpg --list-keys 28 | env: 29 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} 30 | - name: Configure Maven Credentials and GPG Key 31 | run: ./release.sh config_maven 32 | env: 33 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} 34 | OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} 35 | GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }} 36 | GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 37 | - name: Publish package 38 | run: mvn -Djava.net.preferIPv6Addresses=true clean deploy --settings="./.github/workflows/settings.xml" 39 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: Set up JDK 1.8 12 | uses: actions/setup-java@v1 13 | with: 14 | java-version: 1.8 15 | - name: Build 16 | run: mvn package 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/* 2 | !target/*.jar 3 | .idea 4 | *.class 5 | docs/DocSmithConfig.java 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated. 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.mdown: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # All rights reserved. 3 | 4 | # This source code is licensed under the license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | Facebook welcomes contributions to our SDKs. 8 | 9 | All contributors must sign a CLA (contributor license agreement) here: 10 | 11 | https://code.facebook.com/cla 12 | 13 | To contribute on behalf of your employer, sign the company CLA 14 | To contribute on behalf of yourself, sign the individual CLA 15 | 16 | All contributions: 17 | 18 | 1/ MUST be be licensed using the Apache License, Version 2.0 19 | 2/ authors MAY retain copyright by adding their copyright notice to the appropriate flies 20 | 21 | More information on the Apache License can be found here: http://www.apache.org/foundation/license-faq.html 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Meta Platforms, Inc. and affiliates. 2 | All rights reserved. 3 | 4 | You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 5 | copy, modify, and distribute this software in source code or binary form for use 6 | in connection with the web services and APIs provided by Facebook. 7 | 8 | As with any software that integrates with the Facebook platform, your use of 9 | this software is subject to the Facebook Platform Policy 10 | [http://developers.facebook.com/policy/]. This copyright notice shall be 11 | included in all copies or substantial portions of the software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getAdCreatives() 23 | .requestNameField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setName("Sample Promoted Post") 24 | .setObjectStoryId("_") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPostCreateAdCreative.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPostCreateAdCreative { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setObjectStoryId("_") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPostCreateAdCreativeCanvas.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPostCreateAdCreativeCanvas { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setImageHash("") 24 | .setObjectStorySpec( 25 | new AdCreativeObjectStorySpec() 26 | .setFieldLinkData( 27 | new AdCreativeLinkData() 28 | .setFieldCallToAction( 29 | new AdCreativeLinkDataCallToAction() 30 | .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) 31 | ) 32 | .setFieldImageHash("") 33 | .setFieldLink("") 34 | .setFieldName("Creative message") 35 | ) 36 | .setFieldPageId("") 37 | ) 38 | .execute(); 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasDV.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasDV { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setObjectStorySpec( 24 | new AdCreativeObjectStorySpec() 25 | .setFieldPageId("") 26 | .setFieldTemplateData( 27 | new AdCreativeLinkData() 28 | .setFieldCallToAction( 29 | new AdCreativeLinkDataCallToAction() 30 | .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) 31 | ) 32 | .setFieldCustomizationRulesSpec(Arrays.asList( 33 | new AdCustomizationRuleSpec() 34 | .setFieldCustomizationSpec("{\"language\":\"en_XX\"}") 35 | , 36 | new AdCustomizationRuleSpec() 37 | .setFieldCustomizationSpec("{\"language\":\"fr_XX\"}") 38 | .setFieldLink("") 39 | .setFieldMessage("French Creative message") 40 | .setFieldName("French Creative title") 41 | )) 42 | .setFieldFormatOption(AdCreativeLinkData.EnumFormatOption.VALUE_COLLECTION_VIDEO) 43 | .setFieldLink("") 44 | .setFieldMessage("English Creative message") 45 | .setFieldName("English Creative title") 46 | .setFieldRetailerItemIds(Arrays.asList(0L, 0L, 0L, 0L)) 47 | ) 48 | ) 49 | .setProductSetId("") 50 | .execute(); 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasImage { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setObjectStorySpec( 24 | new AdCreativeObjectStorySpec() 25 | .setFieldLinkData( 26 | new AdCreativeLinkData() 27 | .setFieldCallToAction( 28 | new AdCreativeLinkDataCallToAction() 29 | .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) 30 | ) 31 | .setFieldCustomizationRulesSpec(Arrays.asList( 32 | new AdCustomizationRuleSpec() 33 | .setFieldCustomizationSpec("{\"language\":\"en_XX\"}") 34 | , 35 | new AdCustomizationRuleSpec() 36 | .setFieldCustomizationSpec("{\"language\":\"fr_XX\"}") 37 | .setFieldLink("") 38 | .setFieldMessage("French Creative message") 39 | .setFieldName("French Creative title") 40 | )) 41 | .setFieldLink("") 42 | .setFieldMessage("English Creative message") 43 | .setFieldName("English Creative title") 44 | .setFieldPicture("") 45 | .setFieldRetailerItemIds(Arrays.asList(0L, 0L, 0L, 0L)) 46 | ) 47 | .setFieldPageId("") 48 | ) 49 | .setProductSetId("") 50 | .execute(); 51 | 52 | } 53 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasVideo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasVideo { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setObjectStorySpec( 24 | new AdCreativeObjectStorySpec() 25 | .setFieldPageId("") 26 | .setFieldVideoData( 27 | new AdCreativeVideoData() 28 | .setFieldCallToAction( 29 | new AdCreativeLinkDataCallToAction() 30 | .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) 31 | .setFieldValue( 32 | new AdCreativeLinkDataCallToActionValue() 33 | .setFieldLink("") 34 | ) 35 | ) 36 | .setFieldImageUrl("") 37 | .setFieldMessage("English Creative message") 38 | .setFieldRetailerItemIds(Arrays.asList(0L, 0L, 0L, 0L)) 39 | .setFieldTitle("English Creative title") 40 | .setFieldVideoId("") 41 | ) 42 | ) 43 | .setProductSetId("") 44 | .execute(); 45 | 46 | } 47 | } -------------------------------------------------------------------------------- /examples/AdAccountAdCreativesPostEnrollStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdCreativesPostEnrollStatus { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdCreative() 23 | .setName("Sample Promoted") 24 | .setObjectStorySpec( 25 | new AdCreativeObjectStorySpec() 26 | .setFieldLinkData( 27 | new AdCreativeLinkData() 28 | .setFieldImageHash("") 29 | .setFieldLink("") 30 | .setFieldMessage("try it out") 31 | ) 32 | .setFieldPageId("") 33 | ) 34 | .setParam("degrees_of_freedom_spec", "{\"creative_features_spec\":\"{\"standard_enhancements\":\"{\\"enroll_status\\":\\"OPT_IN\\"}\"}\"}") 35 | .setParam("special_ad_categories", "[]") 36 | .execute(); 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /examples/AdAccountAdLabelsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdLabelsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdLabel() 23 | .setName("My Label") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getAdSets() 23 | .requestNameField() 24 | .requestIdField() 25 | .requestStatusField() 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostAdSetCreateCpa.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostAdSetCreateCpa { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("A CPA Ad Set") 24 | .setCampaignId("") 25 | .setDailyBudget(5000L) 26 | .setStartTime("2024-07-27T00:47:13-0700") 27 | .setEndTime("2024-08-03T00:47:13-0700") 28 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 29 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 30 | .setBidAmount(1000L) 31 | .setPromotedObject("{\"page_id\":\"\"}") 32 | .setTargeting( 33 | new Targeting() 34 | .setFieldFacebookPositions(Arrays.asList("feed")) 35 | .setFieldGeoLocations( 36 | new TargetingGeoLocation() 37 | .setFieldCountries(Arrays.asList("US")) 38 | ) 39 | ) 40 | .setParam("user_os", "iOS") 41 | .setParam("publisher_platforms", "facebook") 42 | .setParam("device_platforms", "mobile") 43 | .execute(); 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostAdSetCreateCpaAppEvents { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("A CPA Ad Set optimized for App Events") 24 | .setCampaignId("") 25 | .setDailyBudget(300L) 26 | .setStartTime("2024-08-05T17:55:15-0700") 27 | .setEndTime("2024-08-12T17:55:15-0700") 28 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 29 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_OFFSITE_CONVERSIONS) 30 | .setBidAmount(100L) 31 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 32 | .setPromotedObject("{\"application_id\":\"\",\"object_store_url\":\"\",\"custom_event_type\":\"PURCHASE\"}") 33 | .setTargeting( 34 | new Targeting() 35 | .setFieldFacebookPositions(Arrays.asList("feed")) 36 | .setFieldGeoLocations( 37 | new TargetingGeoLocation() 38 | .setFieldCountries(Arrays.asList("US")) 39 | ) 40 | .setFieldUserOs(Arrays.asList("iOS")) 41 | ) 42 | .execute(); 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostBehaviorTargeting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostBehaviorTargeting { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My AdSet") 24 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 25 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 26 | .setBidAmount(2L) 27 | .setDailyBudget(1000L) 28 | .setCampaignId("") 29 | .setTargeting( 30 | new Targeting() 31 | .setFieldBehaviors(Arrays.asList( 32 | new IDName() 33 | .setFieldId(6007101597783L) 34 | .setFieldName("Business Travelers") 35 | , 36 | new IDName() 37 | .setFieldId(6004386044572L) 38 | .setFieldName("Android Owners (All)") 39 | )) 40 | .setFieldFacebookPositions(Arrays.asList("feed")) 41 | .setFieldGeoLocations( 42 | new TargetingGeoLocation() 43 | .setFieldCountries(Arrays.asList("US")) 44 | ) 45 | ) 46 | .execute(); 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostBidMultiplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostBidMultiplier { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My Adset with bid multiplier") 24 | .setCampaignId("") 25 | .setDailyBudget(3000L) 26 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 27 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_OFFSITE_CONVERSIONS) 28 | .setBidAmount(500L) 29 | .setBidAdjustments("{\"user_groups\":{\"gender\":{\"male\":0.8,\"female\":1}}}") 30 | .setPromotedObject("{\"product_set_id\":\"\",\"custom_event_type\":\"ADD_TO_CART\"}") 31 | .setTargeting( 32 | new Targeting() 33 | .setFieldFacebookPositions(Arrays.asList("feed")) 34 | .setFieldGeoLocations( 35 | new TargetingGeoLocation() 36 | .setFieldCountries(Arrays.asList("US")) 37 | ) 38 | ) 39 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 40 | .execute(); 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostCreateAdSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostCreateAdSet { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My First AdSet") 24 | .setLifetimeBudget(20000L) 25 | .setStartTime("2024-07-27T00:46:29-0700") 26 | .setEndTime("2024-08-03T00:46:29-0700") 27 | .setCampaignId("") 28 | .setBidAmount(500L) 29 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 30 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_POST_ENGAGEMENT) 31 | .setTargeting( 32 | new Targeting() 33 | .setFieldAgeMax(24L) 34 | .setFieldAgeMin(20L) 35 | .setFieldBehaviors(Arrays.asList( 36 | new IDName() 37 | .setFieldId(6002714895372L) 38 | .setFieldName("All travelers") 39 | )) 40 | .setFieldFacebookPositions(Arrays.asList("feed")) 41 | .setFieldGenders(Arrays.asList(1L)) 42 | .setFieldGeoLocations( 43 | new TargetingGeoLocation() 44 | .setFieldCities(Arrays.asList( 45 | new TargetingGeoLocationCity() 46 | .setFieldDistanceUnit("mile") 47 | .setFieldKey("777934") 48 | .setFieldRadius(10L) 49 | )) 50 | .setFieldCountries(Arrays.asList("US")) 51 | .setFieldRegions(Arrays.asList( 52 | new TargetingGeoLocationRegion() 53 | .setFieldKey("4081") 54 | )) 55 | ) 56 | .setFieldInterests(Arrays.asList( 57 | new IDName() 58 | .setFieldId("") 59 | .setFieldName("") 60 | )) 61 | .setFieldLifeEvents(Arrays.asList( 62 | new IDName() 63 | .setFieldId(6002714398172L) 64 | .setFieldName("Newlywed (1 year)") 65 | )) 66 | .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network")) 67 | ) 68 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 69 | .execute(); 70 | 71 | } 72 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostCreateAudienceNetwork.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostCreateAudienceNetwork { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My Ad Set") 24 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_LINK_CLICKS) 25 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_LINK_CLICKS) 26 | .setBidAmount(2L) 27 | .setDailyBudget(1000L) 28 | .setCampaignId("") 29 | .setTargeting( 30 | new Targeting() 31 | .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE)) 32 | .setFieldFacebookPositions(Arrays.asList("feed")) 33 | .setFieldGeoLocations( 34 | new TargetingGeoLocation() 35 | .setFieldCountries(Arrays.asList("US")) 36 | ) 37 | .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network")) 38 | ) 39 | .execute(); 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostCreateMAIA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostCreateMAIA { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("Mobile App Installs Ad Set") 24 | .setDailyBudget(1000L) 25 | .setBidAmount(2L) 26 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 27 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_APP_INSTALLS) 28 | .setCampaignId("") 29 | .setPromotedObject("{\"application_id\":\"\",\"object_store_url\":\"\"}") 30 | .setTargeting( 31 | new Targeting() 32 | .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE)) 33 | .setFieldFacebookPositions(Arrays.asList("feed")) 34 | .setFieldGeoLocations( 35 | new TargetingGeoLocation() 36 | .setFieldCountries(Arrays.asList("US")) 37 | ) 38 | .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network")) 39 | .setFieldUserOs(Arrays.asList("IOS")) 40 | ) 41 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 42 | .execute(); 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostDailyBudget20.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostDailyBudget20 { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My First Adset") 24 | .setDailyBudget(2000L) 25 | .setStartTime("2024-07-29T17:54:47-0700") 26 | .setEndTime("2024-08-05T17:54:47-0700") 27 | .setCampaignId("") 28 | .setBidAmount(100L) 29 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_LINK_CLICKS) 30 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_LINK_CLICKS) 31 | .setTargeting( 32 | new Targeting() 33 | .setFieldFacebookPositions(Arrays.asList("feed")) 34 | .setFieldGeoLocations( 35 | new TargetingGeoLocation() 36 | .setFieldCountries(Arrays.asList("US")) 37 | ) 38 | ) 39 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 40 | .execute(); 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostDemographicTargeting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostDemographicTargeting { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My First AdSet") 24 | .setDailyBudget(10000L) 25 | .setBidAmount(300L) 26 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 27 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 28 | .setCampaignId("") 29 | .setPromotedObject("{\"page_id\":\"\"}") 30 | .setTargeting( 31 | new Targeting() 32 | .setFieldAgeMax(24L) 33 | .setFieldAgeMin(20L) 34 | .setFieldBehaviors(Arrays.asList( 35 | new IDName() 36 | .setFieldId(6002714895372L) 37 | .setFieldName("All travelers") 38 | )) 39 | .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE)) 40 | .setFieldFacebookPositions(Arrays.asList("feed")) 41 | .setFieldGenders(Arrays.asList(1L)) 42 | .setFieldGeoLocations( 43 | new TargetingGeoLocation() 44 | .setFieldCities(Arrays.asList( 45 | new TargetingGeoLocationCity() 46 | .setFieldDistanceUnit("mile") 47 | .setFieldKey(777934L) 48 | .setFieldRadius(10L) 49 | )) 50 | .setFieldCountries(Arrays.asList("US")) 51 | .setFieldRegions(Arrays.asList( 52 | new TargetingGeoLocationRegion() 53 | .setFieldKey("4081") 54 | )) 55 | ) 56 | .setFieldInterests(Arrays.asList( 57 | new IDName() 58 | .setFieldId("") 59 | .setFieldName("") 60 | )) 61 | .setFieldLifeEvents(Arrays.asList( 62 | new IDName() 63 | .setFieldId(6002714398172L) 64 | .setFieldName("Newlywed (1 year)") 65 | )) 66 | .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network")) 67 | ) 68 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 69 | .execute(); 70 | 71 | } 72 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostInterestTargeting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostInterestTargeting { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My First AdSet") 24 | .setDailyBudget(10000L) 25 | .setBidAmount(300L) 26 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 27 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 28 | .setCampaignId("") 29 | .setPromotedObject("{\"page_id\":\"\"}") 30 | .setTargeting( 31 | new Targeting() 32 | .setFieldAgeMax(24L) 33 | .setFieldAgeMin(20L) 34 | .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE)) 35 | .setFieldFacebookPositions(Arrays.asList("feed")) 36 | .setFieldFlexibleSpec(Arrays.asList( 37 | new FlexibleTargeting() 38 | .setFieldInterests(Arrays.asList( 39 | new IDName() 40 | .setFieldId("") 41 | .setFieldName("") 42 | )) 43 | )) 44 | .setFieldGenders(Arrays.asList(1L)) 45 | .setFieldGeoLocations( 46 | new TargetingGeoLocation() 47 | .setFieldCities(Arrays.asList( 48 | new TargetingGeoLocationCity() 49 | .setFieldDistanceUnit("mile") 50 | .setFieldKey(777934L) 51 | .setFieldRadius(10L) 52 | )) 53 | .setFieldCountries(Arrays.asList("US")) 54 | .setFieldRegions(Arrays.asList( 55 | new TargetingGeoLocationRegion() 56 | .setFieldKey("4081") 57 | )) 58 | ) 59 | .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network")) 60 | ) 61 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 62 | .execute(); 63 | 64 | } 65 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostLifetimeBudget200Duration10Days { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My First Adset") 24 | .setLifetimeBudget(20000L) 25 | .setStartTime("2024-07-29T17:54:57-0700") 26 | .setEndTime("2024-08-08T17:54:57-0700") 27 | .setCampaignId("") 28 | .setBidAmount(100L) 29 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_LINK_CLICKS) 30 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_LINK_CLICKS) 31 | .setTargeting( 32 | new Targeting() 33 | .setFieldFacebookPositions(Arrays.asList("feed")) 34 | .setFieldGeoLocations( 35 | new TargetingGeoLocation() 36 | .setFieldCountries(Arrays.asList("US")) 37 | ) 38 | .setFieldPublisherPlatforms(Arrays.asList("facebook", "audience_network")) 39 | ) 40 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 41 | .execute(); 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostOptimizePostEngagement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostOptimizePostEngagement { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My First Adset") 24 | .setLifetimeBudget(20000L) 25 | .setStartTime("2024-07-29T17:55:06-0700") 26 | .setEndTime("2024-08-08T17:55:06-0700") 27 | .setCampaignId("") 28 | .setBidAmount(500L) 29 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 30 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_POST_ENGAGEMENT) 31 | .setTargeting( 32 | new Targeting() 33 | .setFieldAgeMax(24L) 34 | .setFieldAgeMin(20L) 35 | .setFieldBehaviors(Arrays.asList( 36 | new IDName() 37 | .setFieldId(6002714895372L) 38 | .setFieldName("All travelers") 39 | )) 40 | .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_DESKTOP)) 41 | .setFieldFacebookPositions(Arrays.asList("feed")) 42 | .setFieldGenders(Arrays.asList(1L)) 43 | .setFieldGeoLocations( 44 | new TargetingGeoLocation() 45 | .setFieldCities(Arrays.asList( 46 | new TargetingGeoLocationCity() 47 | .setFieldDistanceUnit("mile") 48 | .setFieldKey(777934L) 49 | .setFieldRadius(10L) 50 | )) 51 | .setFieldCountries(Arrays.asList("US")) 52 | .setFieldRegions(Arrays.asList( 53 | new TargetingGeoLocationRegion() 54 | .setFieldKey("4081") 55 | )) 56 | ) 57 | .setFieldLifeEvents(Arrays.asList( 58 | new IDName() 59 | .setFieldId(6002714398172L) 60 | .setFieldName("Newlywed (1 year)") 61 | )) 62 | .setFieldPublisherPlatforms(Arrays.asList("facebook")) 63 | ) 64 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 65 | .execute(); 66 | 67 | } 68 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostPageLikes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostPageLikes { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My Reach Ad Set") 24 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 25 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 26 | .setBidAmount(2L) 27 | .setDailyBudget(1000L) 28 | .setCampaignId("") 29 | .setTargeting( 30 | new Targeting() 31 | .setFieldFacebookPositions(Arrays.asList("feed")) 32 | .setFieldGeoLocations( 33 | new TargetingGeoLocation() 34 | .setFieldCountries(Arrays.asList("US")) 35 | ) 36 | ) 37 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 38 | .setPromotedObject("{\"page_id\":\"\"}") 39 | .execute(); 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostPlacementTargeting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostPlacementTargeting { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My AdSet") 24 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 25 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 26 | .setBidAmount(2L) 27 | .setDailyBudget(1000L) 28 | .setCampaignId("") 29 | .setTargeting( 30 | new Targeting() 31 | .setFieldFacebookPositions(Arrays.asList("feed")) 32 | .setFieldGeoLocations( 33 | new TargetingGeoLocation() 34 | .setFieldCountries(Arrays.asList("US")) 35 | ) 36 | .setFieldPublisherPlatforms(Arrays.asList("facebook")) 37 | ) 38 | .setPromotedObject("{\"page_id\":\"\"}") 39 | .execute(); 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /examples/AdAccountAdSetsPostReach.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdSetsPostReach { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdSet() 23 | .setName("My Reach Ad Set") 24 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_REACH) 25 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 26 | .setBidAmount(2L) 27 | .setDailyBudget(1000L) 28 | .setCampaignId("") 29 | .setTargeting( 30 | new Targeting() 31 | .setFieldExcludedGeoLocations( 32 | new TargetingGeoLocation() 33 | .setFieldRegions(Arrays.asList( 34 | new TargetingGeoLocationRegion() 35 | .setFieldKey("3847") 36 | )) 37 | ) 38 | .setFieldFacebookPositions(Arrays.asList("feed")) 39 | .setFieldGeoLocations( 40 | new TargetingGeoLocation() 41 | .setFieldCountries(Arrays.asList("US")) 42 | ) 43 | ) 44 | .setStatus(AdSet.EnumStatus.VALUE_PAUSED) 45 | .setPromotedObject("{\"page_id\":\"\"}") 46 | .execute(); 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /examples/AdAccountAdVideosPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdVideosPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdVideo() 23 | .setSource("") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getAds() 23 | .requestNameField() 24 | .requestIdField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsPixelEdgeGetPixelCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsPixelEdgeGetPixelCode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdsPixel(id, context).get() 23 | .requestCodeField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsPixelsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsPixelsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdsPixel() 23 | .setName("My WCA Pixel") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAd() 23 | .setName("My Ad") 24 | .setAdsetId(L) 25 | .setCreative( 26 | new AdCreative() 27 | .setFieldId("") 28 | ) 29 | .setStatus(Ad.EnumStatus.VALUE_PAUSED) 30 | .execute(); 31 | 32 | } 33 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsPostAdsRedownload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsPostAdsRedownload { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAd() 23 | .setName("My AdGroup with Redownload") 24 | .setAdsetId(L) 25 | .setCreative( 26 | new AdCreative() 27 | .setFieldId("") 28 | ) 29 | .setParam("redownload", "1") 30 | .setStatus(Ad.EnumStatus.VALUE_PAUSED) 31 | .execute(); 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsPostAuthorizationCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsPostAuthorizationCategory { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAd() 23 | .setName("My AdGroup") 24 | .setAdsetId(L) 25 | .setCreative( 26 | new AdCreative() 27 | .setFieldId("") 28 | ) 29 | .setStatus(Ad.EnumStatus.VALUE_PAUSED) 30 | .setParam("authorization_category", "POLITICAL") 31 | .execute(); 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /examples/AdAccountAdsPostTrackingPostEngagement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountAdsPostTrackingPostEngagement { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAd() 23 | .setName("My First Ad") 24 | .setAdsetId(L) 25 | .setCreative( 26 | new AdCreative() 27 | .setFieldId("") 28 | ) 29 | .setTrackingSpecs("{\"action.type\":\"post_engagement\",\"post\":\"\",\"page\":\"\"}") 30 | .setStatus(Ad.EnumStatus.VALUE_PAUSED) 31 | .execute(); 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getCampaigns() 23 | .setEffectiveStatus(Arrays.asList(Campaign.EnumEffectiveStatus.VALUE_ACTIVE,Campaign.EnumEffectiveStatus.VALUE_PAUSED)) 24 | .requestNameField() 25 | .requestObjectiveField() 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostCategories.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostCategories { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("My First Campaign with special ad categories") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_LEADS) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setDailyBudget(1000L) 27 | .setParam("special_ad_categories", "[]") 28 | .setParam("special_ad_category_country", "[\"MX\"]") 29 | .execute(); 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostDailyBudget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostDailyBudget { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("My First Campaign with daily budget") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_LEADS) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setDailyBudget(1000L) 27 | .setParam("special_ad_categories", "[]") 28 | .execute(); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostLeadGen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostLeadGen { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("Lead generation campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_LEADS) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostLinkClicks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostLinkClicks { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("My campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_TRAFFIC) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostLocalAwareness.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostLocalAwareness { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("Local ad campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_AWARENESS) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostMAIA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostMAIA { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("Mobile App Installs Campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_APP_PROMOTION) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostMAIDPA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostMAIDPA { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("App Installs Campaign with Dynamic Product Ads") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_APP_PROMOTION) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostPageLikes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostPageLikes { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("My First Campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_ENGAGEMENT) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostPostEngagement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostPostEngagement { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("My First Campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_ENGAGEMENT) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCampaignsPostVideoViews.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCampaignsPostVideoViews { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCampaign() 23 | .setName("Video Views campaign") 24 | .setObjective(Campaign.EnumObjective.VALUE_OUTCOME_ENGAGEMENT) 25 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 26 | .setParam("special_ad_categories", "[]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getCustomAudiences() 23 | .requestField("id") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesEdgeDataSourceSubtype.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesEdgeDataSourceSubtype { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getCustomAudiences() 23 | .requestField("data_source") 24 | .requestField("subtype") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostCreateCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostCreateCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My new Custom Audience") 24 | .setSubtype(CustomAudience.EnumSubtype.VALUE_CUSTOM) 25 | .setDescription("People who purchased on my website") 26 | .setCustomerFileSource(CustomAudience.EnumCustomerFileSource.VALUE_USER_PROVIDED_ONLY) 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostDynamicEventValueBasedLookalikeCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostDynamicEventValueBasedLookalikeCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("Test Value-Based lookalike from Pixel") 24 | .setSubtype(CustomAudience.EnumSubtype.VALUE_LOOKALIKE) 25 | .setLookalikeSpec("{\"origin_event_sources\":[{\"id\":\"\",\"event_names\":[\"AddToCart\"]}],\"type\":\"custom_ratio\",\"ratio\":0.01,\"country\":\"US\"}") 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostDynamicValueBasedLookalikeCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostDynamicValueBasedLookalikeCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("Test Value-Based lookalike from Pixel") 24 | .setSubtype(CustomAudience.EnumSubtype.VALUE_LOOKALIKE) 25 | .setLookalikeSpec("{\"origin_event_sources\":[{\"id\":\"\"}],\"type\":\"custom_ratio\",\"ratio\":0.01,\"country\":\"US\"}") 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostPlatformCustomAudienceMACARule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostPlatformCustomAudienceMACARule { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My Test Website Custom Audience") 24 | .setRule("{\"inclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"app\"}],\"retention_seconds\":8400,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"fb_mobile_purchase\"}]}}]}}") 25 | .setPrefill(true) 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostPlatformECAExclusions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostPlatformECAExclusions { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My Test Engagement Custom Audience") 24 | .setRule("{\"inclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"page\"}],\"retention_seconds\":31536000,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"page_engaged\"}]}}]},\"exclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"page\"}],\"retention_seconds\":31536000,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"page_cta_clicked\"}]}}]}}") 25 | .setPrefill(true) 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostPlatformECAMultiFilters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostPlatformECAMultiFilters { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My Test Engagement Custom Audience") 24 | .setRule("{\"inclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"page\"}],\"retention_seconds\":31536000,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"page_engaged\"},{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"page_engaged\"}]}}]}}") 25 | .setPrefill(true) 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostPlatformECAMultiPages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostPlatformECAMultiPages { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My Test Engagement Custom Audience") 24 | .setRule("{\"inclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"page\"},{\"id\":\"\",\"type\":\"page\"}],\"retention_seconds\":31536000,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"page_engaged\"}]}}]}}") 25 | .setPrefill(true) 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostPlatformEngagementCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostPlatformEngagementCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My Test Engagement Custom Audience") 24 | .setRule("{\"inclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"page\"}],\"retention_seconds\":31536000,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"event\",\"operator\":\"eq\",\"value\":\"page_engaged\"}]}}]}}") 25 | .setPrefill(true) 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostPlatformWebsiteCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostPlatformWebsiteCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("My Test Website Custom Audience") 24 | .setRule("{\"inclusions\":{\"operator\":\"or\",\"rules\":[{\"event_sources\":[{\"id\":\"\",\"type\":\"pixel\"}],\"retention_seconds\":8400,\"filter\":{\"operator\":\"and\",\"filters\":[{\"field\":\"url\",\"operator\":\"i_contains\",\"value\":\"shoes\"}]}}]}}") 25 | .setPrefill(true) 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostValueBasedCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostValueBasedCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("Value-Based Custom Audience") 24 | .setSubtype(CustomAudience.EnumSubtype.VALUE_CUSTOM) 25 | .setIsValueBased(true) 26 | .setCustomerFileSource(CustomAudience.EnumCustomerFileSource.VALUE_PARTNER_PROVIDED_ONLY) 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountCustomAudiencesPostValueBasedLookalikeCustomAudience.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountCustomAudiencesPostValueBasedLookalikeCustomAudience { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createCustomAudience() 23 | .setName("Value-Based lookalike") 24 | .setSubtype(CustomAudience.EnumSubtype.VALUE_LOOKALIKE) 25 | .setOriginAudienceId("") 26 | .setLookalikeSpec("{\"type\":\"custom_ratio\",\"ratio\":0.01,\"country\":\"US\"}") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountGeneratePreviewsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountGeneratePreviewsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getGeneratePreviews() 23 | .setCreative( 24 | new AdCreative() 25 | ) 26 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_) 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountGeneratePreviewsEdgeDesktopWithStoryId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountGeneratePreviewsEdgeDesktopWithStoryId { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getGeneratePreviews() 23 | .setCreative( 24 | new AdCreative() 25 | .setFieldObjectStoryId("_") 26 | ) 27 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_DESKTOP_FEED_STANDARD) 28 | .execute(); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AdAccountGeneratePreviewsEdgeInstagramStandards.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountGeneratePreviewsEdgeInstagramStandards { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getGeneratePreviews() 23 | .setCreative( 24 | new AdCreative() 25 | .setFieldInstagramActorId("") 26 | .setFieldObjectStorySpec( 27 | new AdCreativeObjectStorySpec() 28 | .setFieldLinkData( 29 | new AdCreativeLinkData() 30 | .setFieldCallToAction( 31 | new AdCreativeLinkDataCallToAction() 32 | .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_LEARN_MORE) 33 | .setFieldValue( 34 | new AdCreativeLinkDataCallToActionValue() 35 | .setFieldLink("") 36 | ) 37 | ) 38 | .setFieldCaption("www.example.com") 39 | .setFieldImageHash("") 40 | .setFieldLink("") 41 | .setFieldMessage("Message") 42 | ) 43 | .setFieldPageId("") 44 | ) 45 | ) 46 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_INSTAGRAM_STANDARD) 47 | .execute(); 48 | 49 | } 50 | } -------------------------------------------------------------------------------- /examples/AdAccountGeneratePreviewsEdgeMaiaWithObjectStorySpec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountGeneratePreviewsEdgeMaiaWithObjectStorySpec { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getGeneratePreviews() 23 | .setCreative( 24 | new AdCreative() 25 | .setFieldObjectStorySpec( 26 | new AdCreativeObjectStorySpec() 27 | .setFieldLinkData( 28 | new AdCreativeLinkData() 29 | .setFieldCallToAction( 30 | new AdCreativeLinkDataCallToAction() 31 | .setFieldType(AdCreativeLinkDataCallToAction.EnumType.VALUE_USE_APP) 32 | .setFieldValue( 33 | new AdCreativeLinkDataCallToActionValue() 34 | .setFieldLink("") 35 | ) 36 | ) 37 | .setFieldDescription("Description") 38 | .setFieldLink("") 39 | .setFieldMessage("Message") 40 | .setFieldName("Name") 41 | .setFieldPicture("") 42 | ) 43 | .setFieldPageId("") 44 | ) 45 | ) 46 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_MOBILE_FEED_STANDARD) 47 | .execute(); 48 | 49 | } 50 | } -------------------------------------------------------------------------------- /examples/AdAccountNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).get() 23 | .requestNameField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdAccountProductAudiencesPostIphoneViewNoPurchase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountProductAudiencesPostIphoneViewNoPurchase { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createProductAudience() 23 | .setName("Test Iphone Product Audience") 24 | .setProductSetId("") 25 | .setInclusions("[{\"retention_seconds\":86400,\"rule\":{\"and\":[{\"event\":{\"eq\":\"AddToCart\"}},{\"userAgent\":{\"i_contains\":\"iPhone\"}}]}}]") 26 | .setExclusions("[{\"retention_seconds\":172800,\"rule\":{\"event\":{\"eq\":\"Purchase\"}}}]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountProductAudiencesPostNoPurchase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountProductAudiencesPostNoPurchase { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createProductAudience() 23 | .setName("Test Product Audience") 24 | .setProductSetId("") 25 | .setInclusions("[{\"retention_seconds\":86400,\"rule\":{\"event\":{\"eq\":\"AddToCart\"}}},{\"retention_seconds\":72000,\"rule\":{\"event\":{\"eq\":\"ViewContent\"}}}]") 26 | .setExclusions("[{\"retention_seconds\":172800,\"rule\":{\"event\":{\"eq\":\"Purchase\"}}}]") 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/AdAccountReachEstimate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdAccountReachEstimate { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).getReachEstimate() 23 | .setTargetingSpec( 24 | new Targeting() 25 | .setFieldAgeMax(40L) 26 | .setFieldAgeMin(20L) 27 | .setFieldGeoLocations( 28 | new TargetingGeoLocation() 29 | .setFieldCountries(Arrays.asList("US")) 30 | ) 31 | ) 32 | .execute(); 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /examples/AdCampaignAdsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignAdsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).getAds() 23 | .requestNameField() 24 | .requestIdField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdCampaignGroupAdsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignGroupAdsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Campaign(id, context).getAds() 23 | .requestNameField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdCampaignGroupAdsEdgeAdgroupsWithStatusArchived.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignGroupAdsEdgeAdgroupsWithStatusArchived { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Campaign(id, context).getAds() 23 | .setEffectiveStatus("[\"ARCHIVED\"]") 24 | .requestNameField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdCampaignGroupAdsetsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignGroupAdsetsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Campaign(id, context).getAdSets() 23 | .requestNameField() 24 | .requestStartTimeField() 25 | .requestEndTimeField() 26 | .requestDailyBudgetField() 27 | .requestLifetimeBudgetField() 28 | .execute(); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AdCampaignNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).get() 23 | .requestAdsetScheduleField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdCampaignNodeRead.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignNodeRead { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).get() 23 | .requestNameField() 24 | .requestStatusField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdCampaignNodeReadFormatUNIX.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignNodeReadFormatUNIX { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).get() 23 | .setParam("date_format", "U") 24 | .requestIdField() 25 | .requestNameField() 26 | .requestStartTimeField() 27 | .requestEndTimeField() 28 | .execute(); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /examples/AdCampaignPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).update() 23 | .setBidAdjustments("{\"user_groups\":{\"user_bucket\":{\"event_sources\":[\"\",\"\"],\"1\":0.1,\"2\":0.2,\"3\":0.3,\"default\":{\"gender\":{\"male\":0.99,\"female\":0.12}}}}}") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdCampaignPostAdsetUpdateCpa.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCampaignPostAdsetUpdateCpa { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).update() 23 | .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) 24 | .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_LINK_CLICKS) 25 | .setBidAmount(200L) 26 | .setTargeting( 27 | new Targeting() 28 | .setFieldFacebookPositions(Arrays.asList("feed")) 29 | .setFieldGeoLocations( 30 | new TargetingGeoLocation() 31 | .setFieldCountries(Arrays.asList("US")) 32 | ) 33 | ) 34 | .execute(); 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /examples/AdCreativeNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativeNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).get() 23 | .requestAssetFeedSpecField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdCreativeNodeRead.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativeNodeRead { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).get() 23 | .requestNameField() 24 | .requestObjectStoryIdField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdCreativeNodeReadInstagramPermalinkUrl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativeNodeReadInstagramPermalinkUrl { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).get() 23 | .requestInstagramPermalinkUrlField() 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdCreativePreviewsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativePreviewsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).getPreviews() 23 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_DESKTOP_FEED_STANDARD) 24 | .setProductItemIds("[\"\"]") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdCreativePreviewsEdgePreview.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativePreviewsEdgePreview { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).getPreviews() 23 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_DESKTOP_FEED_STANDARD) 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdCreativePreviewsEdgePreviewDynamicAds.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativePreviewsEdgePreviewDynamicAds { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).getPreviews() 23 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_DESKTOP_FEED_STANDARD) 24 | .setProductItemIds("[\"\"]") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdCreativePreviewsEdgePreviewDynamicAdsWithCustomizations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdCreativePreviewsEdgePreviewDynamicAdsWithCustomizations { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdCreative(id, context).getPreviews() 23 | .setAdFormat(AdPreview.EnumAdFormat.VALUE_DESKTOP_FEED_STANDARD) 24 | .setProductItemIds("[\"\"]") 25 | .setDynamicCustomization("{\"language\":\"fr_XX\",\"country\":\"FR\"}") 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdSetsDelete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdSetsDelete { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).delete() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/AdgroupDelete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupDelete { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).delete() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/AdgroupLeadsEdgeAdgroupLeads.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupLeadsEdgeAdgroupLeads { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).getLeads() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/AdgroupLeadsEdgeAdgroupLeadsDPA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupLeadsEdgeAdgroupLeadsDPA { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).getLeads() 23 | .requestFieldDataField() 24 | .requestRetailerItemIdField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupLeadsEdgeAdgroupLeadsFiltered { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).getLeads() 23 | .setParam("filtering", "[{\"field\":\"time_created\",\"operator\":\"GREATER_THAN\",\"value\":1721709809}]") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdgroupNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).get() 23 | .requestIdField() 24 | .requestNameField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdgroupPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).update() 23 | .setName("My New Ad") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdgroupPostAddLabel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupPostAddLabel { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).update() 23 | .setName("My New Ad with Label") 24 | .setAdlabels("[{\"id\":\"\",\"name\":\"My Label\"}]") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdgroupPostUpdateStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdgroupPostUpdateStatus { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).update() 23 | .setParam("adgroup_status", "PAUSED") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdsInsightsEdgeAdCampaignInsights.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsInsightsEdgeAdCampaignInsights { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdSet(id, context).getInsights() 23 | .setParam("breakdown", "publisher_platform") 24 | .requestField("impressions") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdsInsightsEdgeAdGroupInsights.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsInsightsEdgeAdGroupInsights { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Ad(id, context).getInsights() 23 | .setDatePreset(AdsInsights.EnumDatePreset.VALUE_LAST_7D) 24 | .requestField("impressions") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdsInsightsEdgeCampaignGroupAdLevelInsights.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsInsightsEdgeCampaignGroupAdLevelInsights { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Campaign(id, context).getInsights() 23 | .setLevel(AdsInsights.EnumLevel.VALUE_AD) 24 | .requestField("impressions") 25 | .requestField("ad_id") 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/AdsInsightsEdgeCampaignGroupInsights.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsInsightsEdgeCampaignGroupInsights { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Campaign(id, context).getInsights() 23 | .setDatePreset(AdsInsights.EnumDatePreset.VALUE_LAST_3D) 24 | .requestField("impressions") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdsPixelEventsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsPixelEventsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdsPixel(id, context).createEvent() 23 | .setData("[{\"event_name\":\"PageView\",\"event_time\":1721461428,\"user_data\":{\"fbc\":\"fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890\",\"fbp\":\"fb.1.1558571054389.1098115397\",\"em\":\"309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd\"}}]") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdsPixelEventsPostCustom.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.APIContext; 10 | import com.facebook.ads.sdk.APIException; 11 | import com.facebook.ads.sdk.serverside.ActionSource; 12 | import com.facebook.ads.sdk.serverside.Content; 13 | import com.facebook.ads.sdk.serverside.CustomData; 14 | import com.facebook.ads.sdk.serverside.DeliveryCategory; 15 | import com.facebook.ads.sdk.serverside.Event; 16 | import com.facebook.ads.sdk.serverside.EventRequest; 17 | import com.facebook.ads.sdk.serverside.EventResponse; 18 | import com.facebook.ads.sdk.serverside.UserData; 19 | 20 | import java.util.Arrays; 21 | 22 | public class ServerSideApiExample { 23 | 24 | public static final String ACCESS_TOKEN = ""; 25 | public static final String PIXEL_ID = ""; 26 | 27 | public static void main(String[] args) { 28 | APIContext context = new APIContext(ACCESS_TOKEN).enableDebug(true); 29 | context.setLogger(System.out); 30 | 31 | UserData userData = new UserData() 32 | .emails(Arrays.asList("joe@eg.com")) 33 | .phones(Arrays.asList("12345678901", "14251234567")) 34 | // It is recommended to send Client IP and User Agent for Conversions API Events. 35 | .clientIpAddress(clientIpAddress) 36 | .clientUserAgent(clientUserAgent) 37 | .fbc("fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890") 38 | .fbp("fb.1.1558571054389.1098115397"); 39 | 40 | Content content = new Content() 41 | .productId("product123") 42 | .quantity(1L) 43 | .deliveryCategory(DeliveryCategory.home_delivery); 44 | 45 | CustomData customData = new CustomData() 46 | .addContent(content) 47 | .currency("usd") 48 | .value(123.45F); 49 | 50 | Event purchaseEvent = new Event(); 51 | purchaseEvent.eventName("Purchase") 52 | .eventTime(System.currentTimeMillis() / 1000L) 53 | .userData(userData) 54 | .customData(customData) 55 | .eventSourceUrl("http://jaspers-market.com/product/123") 56 | .actionSource(ActionSource.website); 57 | 58 | EventRequest eventRequest = new EventRequest(PIXEL_ID, context); 59 | eventRequest.addDataItem(purchaseEvent); 60 | 61 | try { 62 | EventResponse response = eventRequest.execute(); 63 | System.out.println(String.format("Standard API response : %s ", response)); 64 | } catch (APIException e) { 65 | e.printStackTrace(); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /examples/AdsPixelSharedAccountsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsPixelSharedAccountsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdsPixel(id, context).getSharedAccounts() 23 | .setBusiness("") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/AdsPixelSharedAccountsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsPixelSharedAccountsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdsPixel(id, context).createSharedAccount() 23 | .setAccountId("") 24 | .setBusiness("") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/AdsPixelSharedAgenciesEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class AdsPixelSharedAgenciesEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdsPixel(id, context).getSharedAgencies() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/CampaignsDelete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CampaignsDelete { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Campaign(id, context).delete() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/CustomAudienceDelete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CustomAudienceDelete { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new CustomAudience(id, context).delete() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/CustomAudienceNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CustomAudienceNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new CustomAudience(id, context).get() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/CustomAudienceNodeReadRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CustomAudienceNodeReadRule { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new CustomAudience(id, context).get() 23 | .requestNameField() 24 | .requestRuleField() 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/CustomAudiencePost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CustomAudiencePost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new CustomAudience(id, context).update() 23 | .setName("Updated Name for CA") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/CustomAudienceUsersPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CustomAudienceUsersPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new CustomAudience(id, context).createUser() 23 | .setPayload("{\"schema\":[\"EMAIL\",\"LOOKALIKE_VALUE\"],\"data\":[[\"9b431636bd164765d63c573c346708846af4f68fe3701a77a3bdd7e7e5166254\",44.5],[\"8cc62c145cd0c6dc444168eaeb1b61b351f9b1809a579cc9b4c9e9d7213a39ee\",140],[\"4eaf70b1f7a797962b9d2a533f122c8039012b31e0a52b34a426729319cb792a\",0],[\"98df8d46f118f8bef552b0ec0a3d729466a912577830212a844b73960777ac56\",0.9]]}") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/CustomAudienceUsersPostCrossPlatform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class CustomAudienceUsersPostCrossPlatform { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new CustomAudience(id, context).createUser() 23 | .setPayload("{\"schema\":[\"EMAIL\",\"MADID\",\"APPUID\",\"LOOKALIKE_VALUE\"],\"app_ids\":[\"\"],\"data\":[[\"b36a83701f1c3191e19722d6f90274bc1b5501fe69ebf33313e440fe4b0fe210\",\"6032d997-3ab0-4de0-aa16-8af0e5b482fb\",\"1234567890\",\"0.9\"],[\"2b3b2b9ce842ab8b6a6c614cb1f9604bb8a0d502d1af49c526b72b10894e95b5\",\"B67385F8-9A82-4670-8C0A-6F9EA7513F5F\",\"\",\"0\"],[\"898628e28890f937bdf009391def42879c401a4bcf1b5fd24e738d9f5da8cbbb\",\"\",\"9876543210\",\"0.4\"]]}") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/MULTIPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class MULTIPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdLabel() 23 | .setName("My Label 1") 24 | .execute(); 25 | 26 | new AdAccount(id, context).createAdLabel() 27 | .setName("My Label 2") 28 | .execute(); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /examples/MULTIPostOne.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class MULTIPostOne { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdLabel() 23 | .setName("My Label 1") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/MULTIPostTwo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class MULTIPostTwo { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdAccount(id, context).createAdLabel() 23 | .setName("My Label 2") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/OfflineConversionsCreateOfflineSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class OfflineConversionsCreateOfflineSet { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Business(id, context).createOfflineConversionDataSet() 23 | .setName("offline_event_set") 24 | .setDescription("conversion data used for superbowl campaign") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/PageFeedEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageFeedEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getFeed() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/PageFeedPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageFeedPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).createFeed() 23 | .setMessage("This is a test value") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/PageFeedPostFeedImageDeepLink.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageFeedPostFeedImageDeepLink { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).createFeed() 23 | .setMessage("This is a test message") 24 | .setCallToAction("{\"type\":\"BUY_NOW\",\"value\":{\"link\":\"\",\"app_link\":\"\"}}") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/PageNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getLocations() 23 | .setParam("limit", "30000") 24 | .requestField("location{latitude") 25 | .requestField("longitude}") 26 | .requestIsPermanentlyClosedField() 27 | .execute(); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /examples/PageNodePageSearch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageNodePageSearch { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).get() 23 | .setParam("type", "adradiussuggestion") 24 | .setParam("latitude", "51.5152253") 25 | .setParam("longitude", "-0.1423029") 26 | .execute(); 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /examples/PagePhotosEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePhotosEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getPhotos() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/PagePhotosPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePhotosPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).createPhoto() 23 | .setUrl("https://www.facebook.com/images/fb_icon_325x325.png") 24 | .setPublished(true) 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/PagePictureEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePictureEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getPicture() 23 | .setRedirect(true) 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/PagePostCommentsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePostCommentsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new PagePost(id, context).createComment() 23 | .setMessage("This is a test value") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/PagePostDelete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePostDelete { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new PagePost(id, context).delete() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/PagePostNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePostNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new PagePost(id, context).get() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/PagePostPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePostPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new PagePost(id, context).update() 23 | .setMessage("This is a test value") 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/PagePostsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePostsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getPosts() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/PagePostsEdgePagePostCreateCarousel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PagePostsEdgePagePostCreateCarousel { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getPosts() 23 | .setParam("message", "Browse our latest products") 24 | .setParam("published", "0") 25 | .setParam("child_attachments", "[{\"link\":\"\",\"name\":\"Product 1\",\"description\":\"$4.99\",\"image_hash\":\"\"},{\"link\":\"\",\"name\":\"Product 2\",\"description\":\"$4.99\",\"image_hash\":\"\"},{\"link\":\"\",\"name\":\"Product 3\",\"description\":\"$4.99\",\"image_hash\":\"\"},{\"link\":\"\",\"name\":\"Product 4\",\"description\":\"$4.99\",\"image_hash\":\"\"}]") 26 | .setParam("caption", "WWW.EXAMPLE.COM") 27 | .setParam("link", "http://www.example.com/products") 28 | .execute(); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /examples/PageRolesEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageRolesEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).getRoles() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/PageSubscribedAppsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class PageSubscribedAppsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Page(id, context).createSubscribedApp() 23 | .setSubscribedFields(Arrays.asList(Page.EnumSubscribedFields.VALUE_LEADGEN)) 24 | .execute(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /examples/ProductCatalogEventStatsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class ProductCatalogEventStatsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new ProductCatalog(id, context).getEventStats() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/ProductCatalogHotelsPost.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class ProductCatalogHotelsPost { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new ProductCatalog(id, context).createHotel() 23 | .setHotelId("h_1") 24 | .setName("Sample Hotel") 25 | .setDescription("hotel description") 26 | .setBrand("hotel brand") 27 | .setUrl("http://www.example.com/samplehotel") 28 | .setImages("[{\"image_url\":\"https://www.example.com/pic1.jpg\",\"tags\":[\"front view\",\"balcony\"]},{\"image_url\":\"http://www.example.com/pic2.jpg\",\"tags\":[\"lobby view\"]}]") 29 | .setAddress("{\"street_address\":\"1 Hacker Way\",\"city\":\"Menlo Park\",\"region\":\"California\",\"country\":\"United States\",\"postal_code\":\"94025\",\"neighborhoods\":[\"Palo Alto\",\"Menlo Park\"],\"latitude\":37.484116,\"longitude\":-122.148244}") 30 | .setGuestRatings("[{\"score\":7.8,\"max_score\":10,\"rating_system\":\"sample_rating\",\"number_of_raters\":780}]") 31 | .setStarRating((double) 4) 32 | .setPhone("+351234123456") 33 | .execute(); 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /examples/ProductCatalogHotelsPostUpdateHotelsCatalogSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class ProductCatalogHotelsPostUpdateHotelsCatalogSettings { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new ProductCatalog(id, context).update() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/ProductCatalogProductFeedsPostProductFeed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class ProductCatalogProductFeedsPostProductFeed { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new ProductCatalog(id, context).createProductFeed() 23 | .setName("Test Feed") 24 | .setSchedule("{\"interval\":\"DAILY\",\"url\":\"http://www.example.com/sample_feed.tsv\",\"hour\":\"22\"}") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/ProductCatalogProductSetsPostHotelSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class ProductCatalogProductSetsPostHotelSet { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new ProductCatalog(id, context).createProductSet() 23 | .setName("Test Hotel Set") 24 | .setFilter("{\"brand\":{\"i_contains\":\"sample brand\"}}") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/ProductCatalogProductSetsPostProductSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class ProductCatalogProductSetsPostProductSet { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new ProductCatalog(id, context).createProductSet() 23 | .setName("Test Set") 24 | .setFilter("{\"product_type\":{\"i_contains\":\"shirt\"}}") 25 | .execute(); 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /examples/UserAccountsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class UserAccountsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new User(id, context).getAccounts() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/UserAdAccountsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class UserAdAccountsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new User(id, context).getAdAccounts() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/UserLeadGenInfoNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class UserLeadGenInfoNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new Lead(id, context).get() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/UserNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class UserNode { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new User(id, context).get() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/VideoThumbnailsEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | import com.facebook.ads.sdk.*; 10 | import java.io.File; 11 | import java.util.Arrays; 12 | 13 | public class VideoThumbnailsEdge { 14 | public static void main (String args[]) throws APIException { 15 | 16 | String access_token = ""; 17 | String app_secret = ""; 18 | String app_id = ""; 19 | String id = ""; 20 | APIContext context = new APIContext(access_token).enableDebug(true); 21 | 22 | new AdVideo(id, context).getThumbnails() 23 | .execute(); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /examples/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebook/facebook-java-business-sdk/308e048eeccb18125481222c7b0737ba3f4b1a06/examples/image.png -------------------------------------------------------------------------------- /examples/image.png.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebook/facebook-java-business-sdk/308e048eeccb18125481222c7b0737ba3f4b1a06/examples/image.png.zip -------------------------------------------------------------------------------- /examples/src/main/java/com/facebook/ads/sdk/samples/ExampleConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to 5 | * use, copy, modify, and distribute this software in source code or binary 6 | * form for use in connection with the web services and APIs provided by 7 | * Facebook. 8 | * 9 | * As with any software that integrates with the Facebook platform, your use 10 | * of this software is subject to the Facebook Developer Principles and 11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice 12 | * shall be included in all copies or substantial portions of the software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | public class ExampleConfig { 25 | public static final String ACCESS_TOKEN = "Your Access Token"; 26 | public static final Long ACCOUNT_ID = "Your Account ID"; 27 | public static final String APP_SECRET = "Your app secret"; 28 | public static final String IMAGE_FILE = "image.png"; 29 | public static final String VIDEO_FILE = "video.mp4"; 30 | public static final String PAGE_ID = "Your Page ID"; 31 | public static final Long BUSINESS_ID = "Your Business ID"; 32 | public static final String DPA_FEED_FILE_PATH = "dpa-feed-example.xml"; 33 | public static final String CAMPAIGN_ID = "Your campaign ID"; 34 | } 35 | -------------------------------------------------------------------------------- /examples/src/main/java/com/facebook/ads/sdk/samples/PagingExample.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to 5 | * use, copy, modify, and distribute this software in source code or binary 6 | * form for use in connection with the web services and APIs provided by 7 | * Facebook. 8 | * 9 | * As with any software that integrates with the Facebook platform, your use 10 | * of this software is subject to the Facebook Developer Principles and 11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice 12 | * shall be included in all copies or substantial portions of the software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | import com.facebook.ads.sdk.APIContext; 25 | import com.facebook.ads.sdk.APIException; 26 | import com.facebook.ads.sdk.APINodeList; 27 | import com.facebook.ads.sdk.AdAccount; 28 | import com.facebook.ads.sdk.Campaign; 29 | 30 | public class PagingExample { 31 | public static final String ACCESS_TOKEN = ExampleConfig.ACCESS_TOKEN; 32 | public static final Long ACCOUNT_ID = ExampleConfig.ACCOUNT_ID; 33 | public static final String APP_SECRET = ExampleConfig.APP_SECRET; 34 | public static final APIContext context = new APIContext(ACCESS_TOKEN, APP_SECRET).enableDebug(false); 35 | 36 | public static void main(String[] args) throws APIException { 37 | AdAccount account = new AdAccount(ACCOUNT_ID, context); 38 | APINodeList campaigns = account.getCampaigns().requestAllFields().execute(); 39 | while (campaigns != null) { 40 | for (Campaign campaign : campaigns) { 41 | System.out.println(campaign); 42 | } 43 | campaigns = campaigns.nextPage(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /examples/src/main/java/com/facebook/ads/sdk/samples/QuickStartExample.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to 5 | * use, copy, modify, and distribute this software in source code or binary 6 | * form for use in connection with the web services and APIs provided by 7 | * Facebook. 8 | * 9 | * As with any software that integrates with the Facebook platform, your use 10 | * of this software is subject to the Facebook Developer Principles and 11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice 12 | * shall be included in all copies or substantial portions of the software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | import com.facebook.ads.sdk.APIContext; 25 | import com.facebook.ads.sdk.AdAccount; 26 | import com.facebook.ads.sdk.Campaign; 27 | import com.facebook.ads.sdk.APIException; 28 | 29 | public class QuickStartExample { 30 | 31 | public static final String ACCESS_TOKEN = ExampleConfig.ACCESS_TOKEN; 32 | public static final Long ACCOUNT_ID = ExampleConfig.ACCOUNT_ID; 33 | public static final String APP_SECRET = ExampleConfig.APP_SECRET; 34 | public static final APIContext context = new APIContext(ACCESS_TOKEN, APP_SECRET).enableDebug(true); 35 | 36 | public static void main(String[] args) { 37 | try { 38 | AdAccount account = new AdAccount(ACCOUNT_ID, context); 39 | Campaign campaign = account.createCampaign() 40 | .setName("Java SDK Test Campaign") 41 | .setObjective(Campaign.EnumObjective.VALUE_LINK_CLICKS) 42 | .setSpendCap(10000L) 43 | .setStatus(Campaign.EnumStatus.VALUE_PAUSED) 44 | .execute(); 45 | System.out.println(campaign.fetch()); 46 | } catch (APIException e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /examples/src/main/java/com/facebook/ads/sdk/samples/ServerSideApiExample.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and 5 | * distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | * As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 13 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | import com.facebook.ads.sdk.APIContext; 20 | import com.facebook.ads.sdk.APIException; 21 | import com.facebook.ads.sdk.serverside.Event; 22 | import com.facebook.ads.sdk.serverside.EventRequest; 23 | import com.facebook.ads.sdk.serverside.EventResponse; 24 | import com.facebook.ads.sdk.serverside.GenderEnum; 25 | import com.facebook.ads.sdk.serverside.UserData; 26 | 27 | public class ServerSideApiExample { 28 | 29 | // Set your access token and pixel id 30 | public static final String ACCESS_TOKEN = null; 31 | public static final String PIXEL_ID = null; 32 | 33 | public static void main(String[] args) throws Exception { 34 | 35 | if (ACCESS_TOKEN == null || PIXEL_ID == null) { 36 | throw new Exception("ACCESS_TOKEN and PIXEL_ID are required fields."); 37 | } 38 | 39 | APIContext context = new APIContext(ACCESS_TOKEN); 40 | context.setLogger(System.out); 41 | 42 | EventRequest eventRequest = new EventRequest(PIXEL_ID, context); 43 | Event event = new Event(); 44 | event.eventName("Lead") 45 | .eventTime(System.currentTimeMillis() / 1000L); 46 | 47 | UserData userData = (new UserData()) 48 | .email("joe@eg.com") 49 | .phone("16505551212") 50 | .zipcode("94035") 51 | .gender(GenderEnum.FEMALE); 52 | 53 | event.setUserData(userData); 54 | eventRequest.addDataItem(event); 55 | 56 | try { 57 | // Create Server-Side event request and execute. 58 | EventResponse response = eventRequest.execute(); 59 | System.out.println(String.format("Server-Side API response : %s ", response)); 60 | } catch (APIException e) { 61 | e.printStackTrace(); 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /examples/src/main/java/com/facebook/ads/sdk/samples/dpa-feed-example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Store 4 | 5 | 6 | DB_1 7 | Dog Bowl In Blue 8 | Solid plastic Dog Bowl in marine blue color 9 | http://www.example.com/bowls/db-1.html 10 | http://images.example.com/DB_1.png 11 | Example 12 | new 13 | in stock 14 | 9.99 GBP 15 | 16 | UK 17 | Standard 18 | 4.95 GBP 19 | 20 | Animals > Pet Supplies 21 | Made in Waterford, IE 22 | 23 | -------------------------------------------------------------------------------- /examples/src/main/java/com/facebook/ads/sdk/samples/video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebook/facebook-java-business-sdk/308e048eeccb18125481222c7b0737ba3f4b1a06/examples/src/main/java/com/facebook/ads/sdk/samples/video.mp4 -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | # All rights reserved. 3 | 4 | # This source code is licensed under the license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | main() { 8 | echo "start config" 9 | set -e 10 | case $1 in 11 | "config_maven") config_maven "$@" ;; 12 | esac 13 | } 14 | 15 | 16 | config_maven(){ 17 | if [[ -z "${OSSRH_USERNAME}" || -z "${OSSRH_TOKEN}" ]]; then 18 | die "ERROR: Variables OSSRH_USERNAME or OSSRH_TOKEN not defined" 19 | exit 201 20 | fi 21 | 22 | if [[ -z "${GPG_KEYNAME}" || -z "${GPG_PASSPHRASE}" ]]; then 23 | die "ERROR: Variables GPG_KEYNAME or GPG_PASSPHRASE not defined" 24 | exit 201 25 | fi 26 | 27 | cat < ./.github/workflows/settings.xml 28 | 29 | 30 | 31 | ossrh 32 | 33 | true 34 | 35 | 36 | gpg 37 | ${GPG_KEYNAME} 38 | ${GPG_PASSPHRASE} 39 | 40 | 41 | 42 | 43 | 44 | ossrh 45 | ${OSSRH_USERNAME} 46 | ${OSSRH_TOKEN} 47 | 48 | 49 | 50 | EOF 51 | } 52 | 53 | die() { 54 | echo "" 55 | echo "FATAL: $*" >&2 56 | exit 1 57 | } 58 | 59 | main "$@" 60 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/APIConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to 5 | * use, copy, modify, and distribute this software in source code or binary 6 | * form for use in connection with the web services and APIs provided by 7 | * Facebook. 8 | * 9 | * As with any software that integrates with the Facebook platform, your use 10 | * of this software is subject to the Facebook Developer Principles and 11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice 12 | * shall be included in all copies or substantial portions of the software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | 24 | package com.facebook.ads.sdk; 25 | 26 | public class APIConfig { 27 | public static final String DEFAULT_API_VERSION = "v22.0"; 28 | public static final String DEFAULT_API_BASE = "https://graph.facebook.com"; 29 | public static final String DEFAULT_VIDEO_API_BASE = "https://graph-video.facebook.com"; 30 | public static final String USER_AGENT = "fbbizsdk-java-v22.0.3"; 31 | }; 32 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/APIResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to 5 | * use, copy, modify, and distribute this software in source code or binary 6 | * form for use in connection with the web services and APIs provided by 7 | * Facebook. 8 | * 9 | * As with any software that integrates with the Facebook platform, your use 10 | * of this software is subject to the Facebook Developer Principles and 11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice 12 | * shall be included in all copies or substantial portions of the software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | * 22 | */ 23 | package com.facebook.ads.sdk; 24 | 25 | import com.google.gson.JsonObject; 26 | import java.util.Map; 27 | import java.util.List; 28 | 29 | public interface APIResponse { 30 | public String getRawResponse(); 31 | public JsonObject getRawResponseAsJsonObject(); 32 | public APINode head(); 33 | public APIException getException(); 34 | public String getHeader(); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/businessdataapi/Message.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | *

4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and 5 | * distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | *

8 | * As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | *

12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 13 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.businessdataapi; 19 | 20 | import com.google.gson.annotations.SerializedName; 21 | 22 | /** 23 | * Server side pixel event response. 24 | */ 25 | 26 | public class Message { 27 | 28 | @SerializedName("event") 29 | public String event; 30 | 31 | @SerializedName("data_drop_reason") 32 | public String dataDropReason; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/customtype/TargetingOptimizationTuple.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.customtype; 19 | 20 | import com.google.gson.annotations.SerializedName; 21 | 22 | public class TargetingOptimizationTuple { 23 | @SerializedName("key") 24 | private String mKey = null; 25 | @SerializedName("value") 26 | private Long mValue = null; 27 | 28 | public String getKey() { 29 | return mKey; 30 | } 31 | 32 | public Long getValue() { 33 | return mValue; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/ActionSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package com.facebook.ads.sdk.serverside; 20 | 21 | /** 22 | * Used to specify where the conversion occurred. 23 | * See https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event#action-source 24 | */ 25 | public enum ActionSource { 26 | 27 | /** 28 | * Conversion happened over email. 29 | */ 30 | email, 31 | 32 | /** 33 | * Conversion was made on your website. 34 | */ 35 | website, 36 | 37 | /** 38 | * Conversion was made using your app. 39 | */ 40 | app, 41 | 42 | /** 43 | * Conversion was made over the phone. 44 | */ 45 | phone_call, 46 | 47 | /** 48 | * Conversion was made via a messaging app, SMS, or online messaging feature. 49 | */ 50 | chat, 51 | 52 | /** 53 | * Conversion was made in person at your physical store. 54 | */ 55 | physical_store, 56 | 57 | /** 58 | * Conversion happened automatically, for example, a subscription renewal that’s set on auto-pay each month. 59 | */ 60 | system_generated, 61 | 62 | /** 63 | * Conversion happened through a business messaging channel, such as WhatsApp or Instagram Direct. 64 | */ 65 | business_messaging, 66 | 67 | /** 68 | * Conversion happened in a way that is not listed. 69 | */ 70 | other 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/AttributionModelEnum.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | *

4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and 5 | * distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | *

8 | * As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | *

12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 13 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.serverside; 19 | 20 | public enum AttributionModelEnum { 21 | 22 | CUSTOMIZED_MULTI_TOUCH("customized_multi_touch"), 23 | FIRST_TOUCH("first_touch"), 24 | LAST_CLICK("last_click"), 25 | LAST_TOUCH("last_touch"), 26 | LINEAR("linear"), 27 | POSITION_BASED("position_based"), 28 | TIME_DECAY("time_decay"), 29 | UNKNOWN("unknown"); 30 | 31 | private String value; 32 | 33 | AttributionModelEnum(String value) { 34 | this.value = value; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return value; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/CustomEndpointRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * This source code is licensed under the license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | package com.facebook.ads.sdk.serverside; 9 | 10 | import com.facebook.ads.sdk.APIContext; 11 | import com.facebook.ads.sdk.APIException; 12 | import com.google.common.util.concurrent.ListenableFuture; 13 | 14 | import java.util.List; 15 | 16 | public interface CustomEndpointRequest { 17 | 18 | public CustomEndpointResponse sendEvent(APIContext context, String pixelId, List data) throws APIException.FailedRequestException; 19 | 20 | public ListenableFuture sendEventAsync(APIContext context, String pixelId, List Data); 21 | 22 | public void setFilter(Filter filter); 23 | 24 | public void setSendToEndpointOnly(boolean sendToEndpointOnly); 25 | 26 | public boolean isSendToEndpointOnly(); 27 | 28 | public String getEndpoint(); 29 | 30 | interface Filter { 31 | public boolean shouldSendEvent(Event a); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/CustomEndpointResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * This source code is licensed under the license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | package com.facebook.ads.sdk.serverside; 9 | 10 | import com.google.gson.annotations.SerializedName; 11 | 12 | /** 13 | * Server side response to a custom endpoint 14 | */ 15 | 16 | public class CustomEndpointResponse { 17 | 18 | @SerializedName("message") 19 | public String message; 20 | 21 | @SerializedName("response_code") 22 | public String responseCode; 23 | 24 | public CustomEndpointResponse(String message, String responseCode) { 25 | this.message = message; 26 | this.responseCode = responseCode; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/DeliveryCategory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package com.facebook.ads.sdk.serverside; 20 | 21 | /** 22 | * Type of delivery for a purchase event. 23 | * See https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/custom-data#delivery-category 24 | */ 25 | public enum DeliveryCategory { 26 | 27 | /** 28 | * Customer needs to enter the store to get the purchased product. 29 | */ 30 | in_store, 31 | 32 | /** 33 | * Customer picks up their order by driving to a store and waiting inside their vehicle. 34 | */ 35 | curbside, 36 | 37 | /** 38 | * Purchase is delivered to the customer's home. 39 | */ 40 | home_delivery 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/GenderEnum.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | *

4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and 5 | * distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | *

8 | * As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | *

12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 13 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.serverside; 19 | 20 | public enum GenderEnum { 21 | 22 | MALE("m"), 23 | FEMALE("f"); 24 | 25 | private String value; 26 | 27 | GenderEnum(String value) { 28 | this.value = value; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return value; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/HttpMethodEnum.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * This source code is licensed under the license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | package com.facebook.ads.sdk.serverside; 9 | 10 | public enum HttpMethodEnum { 11 | 12 | POST("POST"), 13 | PUT("PUT"), 14 | GET("GET"), 15 | DELETE("DELETE"); 16 | 17 | private String value; 18 | 19 | HttpMethodEnum(String value) { 20 | this.value = value; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return value; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/HttpServiceInterface.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * This source code is licensed under the license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | package com.facebook.ads.sdk.serverside; 9 | 10 | import com.facebook.ads.sdk.AdsPixel; 11 | 12 | import java.util.Map; 13 | 14 | public interface HttpServiceInterface { 15 | public EventResponse executeRequest( 16 | String url, 17 | HttpMethodEnum httpMethod, 18 | Map headers, 19 | HttpServiceParams params 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/MessagingChannel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | 19 | package com.facebook.ads.sdk.serverside; 20 | 21 | /** 22 | * Used to specify which messaging channel was used. 23 | * See https://developers.facebook.com/docs/marketing-api/conversions-api/business-messaging 24 | */ 25 | public enum MessagingChannel { 26 | 27 | /** 28 | * Conversation happened on Instagram Direct. 29 | */ 30 | instagram, 31 | 32 | /** 33 | * Conversation happened on Messenger. 34 | */ 35 | messenger, 36 | 37 | /** 38 | * Conversation happened on WhatsApp. 39 | */ 40 | whatsapp, 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/utils/Sha256GenderEnumListAdaptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | *

4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and 5 | * distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | *

8 | * As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | *

12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 13 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.serverside.utils; 19 | 20 | import com.facebook.ads.sdk.serverside.GenderEnum; 21 | import com.facebook.ads.utils.ServerSideApiUtil; 22 | import com.google.gson.stream.JsonReader; 23 | import java.io.IOException; 24 | import java.io.UnsupportedEncodingException; 25 | 26 | public class Sha256GenderEnumListAdaptor extends HashedListAdaptor { 27 | @Override 28 | protected GenderEnum readFromJson(JsonReader reader) throws IOException { 29 | throw new UnsupportedEncodingException(); 30 | } 31 | 32 | @Override 33 | protected String normalizeAndHash(GenderEnum input, String fieldName) { 34 | String hashedValue = null; 35 | if (input != null) { 36 | hashedValue = ServerSideApiUtil.hash(input.toString()); 37 | } 38 | return hashedValue; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/serverside/utils/Sha256StringListAdaptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.serverside.utils; 19 | 20 | import com.facebook.ads.utils.ServerSideApiUtil; 21 | import com.google.gson.stream.JsonReader; 22 | 23 | import java.io.IOException; 24 | 25 | public class Sha256StringListAdaptor extends HashedListAdaptor { 26 | 27 | @Override 28 | protected String readFromJson(JsonReader reader) throws IOException { 29 | return reader.nextString(); 30 | } 31 | 32 | @Override 33 | protected String normalizeAndHash(String value, String fieldName) { 34 | if (value == null) { 35 | return null; 36 | } 37 | String hashedValue = null; 38 | if (ServerSideApiUtil.isAlreadyHashed(value)) { 39 | hashedValue = value; 40 | } else { 41 | String normalizedString = ServerSideApiUtil.normalize(value, fieldName); 42 | if (normalizedString != null) { 43 | hashedValue = ServerSideApiUtil.hash(normalizedString); 44 | } 45 | } 46 | return hashedValue; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/sdk/signal/SignalResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * This source code is licensed under the license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | package com.facebook.ads.sdk.signal; 9 | 10 | public class SignalResponse { 11 | private U businessDataApi = null; 12 | private T conversionApi = null; 13 | 14 | public SignalResponse(T conversionApiData, U businessDataApiData) { 15 | this.businessDataApi = businessDataApiData; 16 | this.conversionApi = conversionApiData; 17 | } 18 | 19 | /** 20 | * @return business data api data 21 | */ 22 | public U getBusinessDataAPIData() { 23 | return this.businessDataApi; 24 | } 25 | 26 | /** 27 | * @return conversion api 28 | */ 29 | public T getConversionAPIData() { 30 | return this.conversionApi; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/facebook/ads/utils/BusinessDataApiConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | *

4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, and 5 | * distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | *

8 | * As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | *

12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 13 | * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.utils; 19 | 20 | public class BusinessDataApiConstants { 21 | 22 | public static final String EMAIL = "em"; 23 | 24 | public static final String PHONE_NUMBER = "ph"; 25 | 26 | public static final String DATE_OF_BIRTH = "db"; 27 | 28 | public static final String LAST_NAME = "ln"; 29 | 30 | public static final String FIRST_NAME = "fn"; 31 | 32 | public static final String CITY = "ct"; 33 | 34 | public static final String COUNTRY = "country"; 35 | 36 | public static final String STATE = "st"; 37 | 38 | public static final String ZIP_CODE = "zp"; 39 | 40 | public static final String EXTERNAL_ID = "external_id"; 41 | 42 | public static final String ADDRESS = "addr"; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/com/facebook/ads/sdk/serverside/CAPIGatewayEndpointTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * This source code is licensed under the license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | package com.facebook.ads.sdk.serverside; 9 | 10 | import com.facebook.ads.sdk.APIContext; 11 | import com.facebook.ads.sdk.APIException; 12 | import org.junit.Rule; 13 | import org.junit.Test; 14 | import static org.junit.Assert.assertEquals; 15 | import static org.junit.Assert.assertFalse; 16 | import static org.junit.Assert.assertTrue; 17 | import org.junit.rules.ExpectedException; 18 | import static org.mockito.Mockito.mock; 19 | import java.security.InvalidParameterException; 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | public class CAPIGatewayEndpointTest { 24 | @Rule 25 | public final ExpectedException thrown = ExpectedException.none(); 26 | 27 | @Test 28 | public void BuildersAndGettersTest() { 29 | final CAPIGatewayEndpoint capigIngressRequest = new CAPIGatewayEndpoint("https://example.com", "ACCESS_KEY"); 30 | assertEquals(capigIngressRequest.getEndpoint(), "https://example.com"); 31 | assertFalse(capigIngressRequest.isSendToEndpointOnly()); 32 | capigIngressRequest.setSendToEndpointOnly(true); 33 | assertTrue(capigIngressRequest.isSendToEndpointOnly()); 34 | } 35 | 36 | @Test 37 | public void invalidURLTest() { 38 | thrown.expect(InvalidParameterException.class); 39 | new CAPIGatewayEndpoint("badDomain", "ACCESS_KEY"); 40 | thrown.expectMessage("URL is in invalid format"); 41 | } 42 | 43 | @Test 44 | public void filterAllEvents() throws APIException.FailedRequestException { 45 | final CustomEndpointRequest.Filter filterAllEvents = a -> false; 46 | final CAPIGatewayEndpoint capigIngressRequest = new CAPIGatewayEndpoint("https://capig-instance.com", "ACCESS_KEY"); 47 | capigIngressRequest.setFilter(filterAllEvents); 48 | final List events = new ArrayList(); 49 | final Event event1 = new Event(); 50 | event1.setEventId("1"); 51 | final Event event2 = new Event(); 52 | event2.setEventId("2"); 53 | events.add(event1); 54 | events.add(event2); 55 | final CustomEndpointResponse response = capigIngressRequest.sendEvent(mock(APIContext.class), "pixelId", events); 56 | assertEquals(response.message, "No events to send"); 57 | assertEquals(response.responseCode, null); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/test/java/com/facebook/ads/sdk/serverside/ContentTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | *

4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to 5 | * use, copy, modify, and distribute this software in source code or binary 6 | * form for use in connection with the web services and APIs provided by 7 | * Facebook. 8 | *

9 | * As with any software that integrates with the Facebook platform, your use 10 | * of this software is subject to the Facebook Developer Principles and 11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice 12 | * shall be included in all copies or substantial portions of the software. 13 | *

14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | */ 22 | package com.facebook.ads.sdk.serverside; 23 | 24 | import org.junit.Test; 25 | 26 | import static org.junit.Assert.assertEquals; 27 | 28 | public class ContentTest { 29 | @Test 30 | public void ContentToStringTest() { 31 | Content content = new Content() 32 | .productId("1-id") 33 | .quantity(2L) 34 | .itemPrice(3.99F) 35 | .title("4-title") 36 | .description("5-description") 37 | .brand("6-brand") 38 | .category("7-category") 39 | .deliveryCategory(DeliveryCategory.in_store); 40 | String expected = String.join("\n", "class Content {", 41 | " productId: 1-id", 42 | " quantity: 2", 43 | " itemPrice: 3.99", 44 | " title: 4-title", 45 | " description: 5-description", 46 | " brand: 6-brand", 47 | " category: 7-category", 48 | " deliveryCategory: in_store", 49 | "}"); 50 | 51 | assertEquals(content.toString(), expected); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/com/facebook/ads/sdk/serverside/EventAmTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.serverside; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.assertArrayEquals; 23 | import static org.junit.Assert.assertEquals; 24 | 25 | public class EventAmTest { 26 | @Test 27 | public void BuildersAndGettersTest() { 28 | Event event = new Event(); 29 | UserData userData = new UserData(); 30 | CustomData customData = new CustomData(); 31 | String[] dataProcessingOptions = {"AMO"}; 32 | String eventName = "custom"; 33 | long eventTime = 123L; 34 | ActionSource actionSource = null; 35 | String advancedMeasurementTable = "test_am_table"; 36 | 37 | event.setEventName(eventName); 38 | event.setEventTime(eventTime); 39 | event.setUserData(userData); 40 | event.setCustomData(customData); 41 | event.setDataProcessingOptions(dataProcessingOptions); 42 | event.setActionSource(actionSource); 43 | event.setAdvancedMeasurementTable(advancedMeasurementTable); 44 | 45 | assertEquals(event.getEventName(), eventName); 46 | assertEquals((long) event.getEventTime(), eventTime); 47 | assertEquals(event.getUserData(), userData); 48 | assertEquals(event.getCustomData(), customData); 49 | assertArrayEquals(event.getDataProcessingOptions(), dataProcessingOptions); 50 | assertEquals(event.getActionSource(), actionSource); 51 | assertEquals(event.getAdvancedMeasurementTable(), advancedMeasurementTable); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/com/facebook/ads/sdk/serverside/utils/Sha256StringAdaptorTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. 3 | * 4 | *

You are hereby granted a non-exclusive, worldwide, royalty-free license to use, copy, modify, 5 | * and distribute this software in source code or binary form for use in connection with the web 6 | * services and APIs provided by Facebook. 7 | * 8 | *

As with any software that integrates with the Facebook platform, your use of this software is 9 | * subject to the Facebook Developer Principles and Policies [http://developers.facebook.com/policy/]. 10 | * This copyright notice shall be included in all copies or substantial portions of the software. 11 | * 12 | *

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | */ 18 | package com.facebook.ads.sdk.serverside.utils; 19 | 20 | import com.facebook.ads.utils.ServerSideApiConstants; 21 | import com.facebook.ads.utils.ServerSideApiUtil; 22 | import com.google.gson.stream.JsonWriter; 23 | import org.junit.Test; 24 | import org.mockito.Mockito; 25 | 26 | import java.io.IOException; 27 | 28 | import static org.mockito.Mockito.*; 29 | 30 | public class Sha256StringAdaptorTest { 31 | @Test 32 | public void WriteWorksWhenNormalizeFunctionReturnsNull() throws IOException, NoSuchFieldException, IllegalAccessException { 33 | JsonWriter writer = mock(JsonWriter.class); 34 | Sha256StringAdaptor adaptor = spy(new Sha256StringAdaptor()); 35 | Mockito.doReturn(ServerSideApiConstants.LAST_NAME).when(adaptor).getFieldName(writer); 36 | adaptor.write(writer, " "); 37 | 38 | verify(writer).value((String) null); 39 | } 40 | 41 | @Test 42 | public void WriteWorksWhenNormalizeFunctionReturnsString() throws IOException, NoSuchFieldException, IllegalAccessException { 43 | JsonWriter writer = mock(JsonWriter.class); 44 | Sha256StringAdaptor adaptor = spy(new Sha256StringAdaptor()); 45 | String fieldName = ServerSideApiConstants.LAST_NAME; 46 | doReturn(fieldName).when(adaptor).getFieldName(writer); 47 | String lastName = "LastName"; 48 | String normalizedValue = ServerSideApiUtil.normalize(lastName, fieldName); 49 | String hashedValue = ServerSideApiUtil.hash(normalizedValue); 50 | adaptor.write(writer, lastName); 51 | 52 | verify(writer).value(hashedValue); 53 | } 54 | } 55 | --------------------------------------------------------------------------------