Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Support Personal Access Tokens. Fixes #9 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aaroncampos
Copy link

No description provided.

@aaroncampos
Copy link
Author

This small patch seems to fix the authorization. However, I'm getting a strange error when using the Advertiser Lookup API. I've opened a support with CJ on it, but perhaps @brandonbyskov can respond as well. When doing:

irb(main):002:0> cj.advertiser_lookup({'advertiser-ids' => 'joined', 'records-per-page' => 5})
ArgumentError: You must specify the company making this request using the 'requestor-cid' parameter.

The same thing happens when using curl directly. The API documentation mentions nothing about this parameter in conjunction with this API method. Anyone have any ideas? Thanks!

@brandonbyskov
Copy link

Hi @aaroncampos. I'll expand on what I wrote in #9.

We have two ways of authorizing access to our REST APIs, and both have slightly different behaviors:

  1. Developer Key (deprecated)
  • authorize without the word Bearer in the Authorization header:
Authorization: {developer-key}
  • the new requestor-cid parameter (explained below) is optional.
  1. Personal Access Token
  • authorize with the word Bearer in the Authorization header:
Authorization: Bearer {personal-access-token}
  • When using a personal access token, there is a new requestor-cid parameter that is required on some of the APIs. It's required on advertiser lookup, commission detail (deprecated in favour of the new GraphQL API), and publisher lookup APIs. Documentation about it is missing from the advertiser lookup API documentation, so I'll get that updated soon.
    You can see and exampl of a request here: https://developers.cj.com/docs/rest-apis/publisher-lookup

The value of requestor-cid parameter should be the companyId of the company making the request. The reason for this is that a personal access token allows you access to data from all companies your account is linked to (some accounts are linked to multiple companies through a linking feature), and not necessarily a single company like the developer keys.

Let me know if you have any more questions.

@jgonza1212
Copy link

I guess cj.com no longer supports

But here is a list form their api doc. hope it helps. I would just create an array to get the following.

category

Accessories
Air
Apparel
Art
Art/Photo/Music
Astrology
Auction
Audio Books
Automotive
Autumn
Babies
Back to School
Banking/Trading
Bath & Body
Beauty
Bed & Bath
Betting/Gaming
Black Friday/Cyber Monday
Blogs
Books
Books/Media
Broadband
Business
Business-to-Business
Buying and Selling
Camping and Hiking
Car
Careers
Cars & Trucks
Charitable Organizations
Children
Children's
Christmas
Classifieds
Clothing/Apparel
Collectibles
Collectibles and Memorabilia
College
Commercial
Communities
Computer & Electronics
Computer HW
Computer Support
Computer SW
Construction
Consumer Electronics
Cosmetics
Credit Cards
Credit Reporting and Repair
Department Stores
Department Stores/Malls
Discounts
Domain Registrations
E-commerce Solutions/Providers
Easter
Education
Electronic Games
Electronic Toys
Email Marketing
Employment
Energy Saving
Entertainment
Equipment
Events
Exercise & Health
Family
Father's Day
Financial Services
Flowers
Food & Drinks
Fragrance
Fundraising
Furniture
Games
Games & Toys
Garden
Gifts
Gifts & Flowers
Golf
Gourmet
Green
Greeting Cards
Groceries
Guides
Halloween
Handbags
Health and Wellness
Health Food
Home & Garden
Home Appliances
Hotel
Insurance
Internet Service Providers
Investment
Jewelry
Kitchen
Languages
Legal
Luggage
Magazines
Malls
Marketing
Matchmaking
Memorabilia
Men's
Military
Mobile Entertainment
Mortgage Loans
Mother's Day
Motorcycles
Music
Network Marketing
New Year's Resolution
New/Used Goods
News
Non-Profit
Nutritional Supplements
Office
Online Services
Online/Wireless
Outdoors
Parts & Accessories
Party Goods
Peripherals
Personal Insurance
Personal Loans
Pets
Pharmaceuticals
Phone Card Services
Photo
Productivity Tools
Professional
Professional Sports Organizations
Real Estate
Real Estate Services
Recreation & Leisure
Recycling
Rentals
Restaurants
Search Engine
Seasonal
Self Help
Services
Shoes
Sports
Sports & Fitness
Spring
Summer
Summer Sports
Tax Season
Tax Services
Teens
Telecommunications
Telephone Services
Television
Tobacco
Tools and Supplies
Toys
Travel
Utilities
Vacation
Valentine's Day
Videos/Movies
Virtual Malls
Vision Care
Water Sports
Web Design
Web Hosting/Servers
Web Tools
Weddings
Weight Loss
Wellness
Wine & Spirits
Winter
Winter Sports
Women's

### link-type
Banner
Advanced Link
Text Link
Content Link
SmartLink
Product Catalog
Advertiser SmartZone
Flash Link
Lead Form
Placement Text Link
Placement Banner
Branded Placement Text Link
Branded Placement Banner

**Language Code**
English 9
Spanish 29
French 11
German 12
Swedish 30
Arabic 1
Bengali 2
Bulgarian 3
Chinese (Simplified) 4
Chinese (Traditional) 5
Czech 6
Danish 7
Dutch 8
Finnish 10
Greek 13
Hebrew 14
Hindi 15
Hungarian 16
Indonesian 17
Italian 18
Japanese 19
Korean 20
Malay 21
Norwegian 22
Persian 23
Polish 24
Portuguese 25
Romanian 26
Russian 27
Slovenian 28
Tamil 31
Thai 32
Turkish 33
Ukrainian 34
Vietnamese 35

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants